32# define MAX_VOLUME_FRACTION 0.87
38CTextileOrthogonal::CTextileOrthogonal(
int iNumXYarns,
int iNumYYarns,
double dXSpacing,
double dYSpacing,
double dXHeight,
double dYHeight,
bool bRefine,
bool bWeavePattern)
39:
CTextile3DWeave( iNumXYarns, iNumYYarns, dXSpacing, dYSpacing, dXHeight, dYHeight, bRefine)
63 TGERROR(
"Unable to swap position, index out of range: " << x <<
", " << y);
66 vector<PATTERN3D> &Cell =
GetCell(x, y);
67 int size = Cell.size();
72 Cell[0] = Cell[size-1];
82 while( iNumWeftLayers > 1 )
85 if ( iNumWarpLayers > 0 )
93 while( iNumWarpLayers > 0 )
127 bool bSuccess =
true;
158 for (k=0; k<(int)Cell.size(); ++k)
173 for (k=0; k<(int)Cell.size(); ++k)
181 if ( (z - dHalfHeight) <
m_dMinZ )
253 for (k=0; k<(int)Cell.size(); ++k)
267 for (k=0; k<(int)Cell.size(); ++k)
315 vector<int>::iterator itpYarn;
316 double dWidth, dHeight;
325 for (itpYarn =
m_XYarns[i].begin(); itpYarn !=
m_XYarns[i].end(); ++itpYarn)
335 m_Yarns[*itpYarn].AssignSection( YarnSections );
354 for (itpYarn =
m_YYarns[i].begin(), j=0; itpYarn !=
m_YYarns[i].end(); ++itpYarn, ++j)
363 m_Yarns[*itpYarn].AssignSection( YarnSections );
376 vector<CYarn>::iterator itYarn;
381 itYarn->AddRepeat(
XYZ(dWidth, 0, 0));
382 itYarn->AddRepeat(
XYZ(0, dHeight, 0));
429 bool bSuccess =
true;
459 for (k=0; k<(int)Cell.size(); ++k)
474 for (k=0; k<(int)Cell.size(); ++k)
482 if ( (z - dHalfHeight) <
m_dMinZ )
512 if ( k != (
int)Cell.size()- 1 )
515 const vector<PATTERN3D> &NextYCell =
GetCell(NextYCellIndex, i );
545 const vector<PATTERN3D> &Cell =
GetCell(j, 0);
546 for (k=0; k<(int)Cell.size(); ++k)
582 for (k=0; k<(int)Cell.size(); ++k)
636 vector<int>::iterator itpYarn;
637 double dWidth, dHeight;
646 for (itpYarn =
m_XYarns[i].begin(); itpYarn !=
m_XYarns[i].end(); ++itpYarn)
656 m_Yarns[*itpYarn].AssignSection( YarnSections );
675 for (itpYarn =
m_YYarns[i].begin(), j=0; itpYarn !=
m_YYarns[i].end(); ++itpYarn, ++j)
684 m_Yarns[*itpYarn].AssignSection( YarnSections );
697 vector<CYarn>::iterator itYarn;
754 const vector<PATTERN3D> &Cell =
GetCell(i,j);
758 int iBinderIndex = Cell.size() - 1;
761 if ( iBinderIndex < 1 )
764 double dDefaultBinderOffset =
m_XYarnData[j].dHeight/2.0;
774 int BinderYarnIndex =
GetYarnIndex( i, j, iBinderIndex );
781 if ( BinderYarnIndex == -1 || WeftYarnIndex == -1 )
784 XYZ WeftNode =
m_Yarns[WeftYarnIndex].GetNode( j )->GetPosition();
785 XYZ BinderNode =
m_Yarns[BinderYarnIndex].GetNode( CurrentNode )->GetPosition();
789 if ( YarnSection ==
NULL )
792 string WeftType = YarnSection->
GetType();
793 if ( WeftType !=
"CSectionPowerEllipse" && WeftType !=
"CSectionHybrid" )
798 string BinderType = BinderYarnSection->
GetType();
799 double dBinderOffset = dDefaultBinderOffset;
800 if ( BinderType ==
"CSectionHybrid" )
807 if ( PrevCellBinder < iBinderIndex )
810 XYZ NewNode = WeftNode;
816 NewNode.
x -= itBinderData->second.dHeight / 2.0;
818 NewNode.
x -= dDefaultBinderOffset;
819 NewNode.
z = NewNode.
z + SectionPoint.
y;
820 m_Yarns[BinderYarnIndex].InsertNode( NewNode, CurrentNode);
825 if ( CurrentNode == 0 )
845 if ( NextCellBinder < iBinderIndex )
847 XYZ NewNode = WeftNode;
866 NewNode.
x += itBinderData->second.dHeight / 2.0;
868 NewNode.
x += dDefaultBinderOffset;
869 NewNode.
z = NewNode.
z + SectionPoint.
y;
870 m_Yarns[BinderYarnIndex].InsertNode( NewNode, CurrentNode+1 );
877 delete BinderYarnSection;
882 int BinderYarnIndex =
GetYarnIndex( i, j, iBinderIndex );
889 if ( BinderYarnIndex == -1 || WeftYarnIndex == -1 )
894 if ( YarnSection ==
NULL )
897 string WeftType = YarnSection->
GetType();
898 if ( WeftType !=
"CSectionPowerEllipse" && WeftType !=
"CSectionHybrid" )
905 string BinderType = BinderYarnSection->
GetType();
906 double dBinderOffset = dDefaultBinderOffset;
907 if ( BinderType ==
"CSectionHybrid" )
912 XYZ WeftNode =
m_Yarns[WeftYarnIndex].GetNode( j )->GetPosition();
913 XYZ BinderNode =
m_Yarns[BinderYarnIndex].GetNode( CurrentNode )->GetPosition();
917 if ( PrevCellBinder > iBinderIndex )
919 XYZ NewNode = WeftNode;
925 NewNode.
x -= itBinderData->second.dHeight / 2.0;
927 NewNode.
x -= dDefaultBinderOffset;
928 NewNode.
z = NewNode.
z + SectionPoint.
y;
929 m_Yarns[BinderYarnIndex].InsertNode( NewNode, CurrentNode);
934 if ( CurrentNode == 0 )
954 if ( NextCellBinder > iBinderIndex )
956 XYZ NewNode = WeftNode;
974 NewNode.
x += itBinderData->second.dHeight / 2.0;
976 NewNode.
x += dDefaultBinderOffset;
977 NewNode.
z = NewNode.
z + SectionPoint.
y;
978 m_Yarns[BinderYarnIndex].InsertNode( NewNode, CurrentNode+1 );
985 delete BinderYarnSection;
997 int iBinderIndex = -1;
1002 const vector<PATTERN3D> &Cell =
GetCell(i,j);
1004 int iCellSize = Cell.size();
1006 if ( Cell[0] != NextCell[0] )
1008 if ( iBinderIndex == -1 )
1020 double FibreArea =
m_Yarns[iBinderIndex].GetFibreArea(
"mm^2");
1024 TGERROR(
"Binder yarn initial volume fraction exceeds max Vf Yarn: " << iBinderIndex );
1033 double dMaxWidth, dMaxHeight;
1038 double dMaxArea = dMaxWidth * dMaxHeight;
1039 Binder.
dWidth = dMaxWidth;
1042 if ( InitialArea < dMaxArea )
1044 Binder.
dHeight = InitialArea/dMaxWidth;
1054 Binder.
dHeight = MaxVfArea/dMaxWidth;
1076 vector<int> RectYarnIndex;
1082 const vector<PATTERN3D> &Cell =
GetCell(i,j);
1083 int iCellSize = Cell.size();
1087 XYZ TopNode, BottomNode;
1088 if ( iTopWeftIndex != -1 )
1089 TopNode =
m_Yarns[iTopWeftIndex].GetNode(j)->GetPosition();
1090 if ( iBottomWeftIndex != -1 )
1091 BottomNode =
m_Yarns[iBottomWeftIndex].GetNode(j)->GetPosition();
1095 double StartThickness = 0.0;
1098 for (
int k = 2; k < iCellSize-2; ++k )
1113 double CellHeightReduction = TargetThickness / StartThickness;
1114 double zDisplacement = 0.0;
1115 if ( fabs( 1.0 - CellHeightReduction ) >
TOL && CellHeightReduction < 1.0 )
1118 for (
int k = 2; k < iCellSize-2; ++k )
1123 double MaxWidth = 0.0;
1125 if ( YarnIndex == -1 )
1127 if (
m_Yarns[YarnIndex].GetYarnSection()->
GetType() !=
"CYarnSectionInterpNode" )
1129 double FibreArea =
m_Yarns[YarnIndex].GetFibreArea(
"mm^2");
1130 if ( FibreArea == 0.0 )
1132 TGERROR(
"Cannot adjust height of yarn" << YarnIndex <<
": No fibre area set" );
1141 Node =
m_Yarns[YarnIndex].GetNode(i)->GetPosition();
1147 Node =
m_Yarns[YarnIndex].GetNode(j)->GetPosition();
1151 XYZ PrevNode =
m_Yarns[YarnIndex].GetNode(j-1)->GetPosition();
1152 zDisplacement = Node.
z - PrevNode.
z;
1153 Node.
z = PrevNode.
z;
1158 map<pair<int, int>,
YARNDATA>::iterator itBinderData;
1163 MaxWidth -= itBinderData->second.dHeight / 2.0;
1168 MaxWidth -= itBinderData->second.dHeight / 2.0;
1173 if ( YarnSection ==
NULL || MaxWidth == 0.0)
1177 double OldHeight = YarnSection->
GetHeight();
1178 double TargetHeight = CellHeightReduction * OldHeight;
1179 double MaxArea = MaxWidth * TargetHeight;
1182 double StartVolumeFraction = FibreArea/TargetArea;
1183 double AreaVolumeFraction = FibreArea/MaxArea;
1187 if ( AreaVolumeFraction > MaxVolumeFraction )
1189 TGERROR(
"Cannot achieve this thickness: exceeds maximum volume fraction");
1193 if ( AreaVolumeFraction > StartVolumeFraction )
1196 *YarnSection = Section;
1207 double HeightChange = OldHeight - YarnSection->
GetHeight();
1210 Node.
z = Node.
z - 0.5*HeightChange - zDisplacement;
1211 zDisplacement += HeightChange;
1223 XYZ EndNode =
m_Yarns[YarnIndex].GetNode(iNumYarns)->GetPosition();
1225 m_Yarns[YarnIndex].ReplaceNode( iNumYarns,
CNode(EndNode) );
1230 if ( YarnSection->
GetPower() == 0.0 )
1232 vector<int>::iterator itRectYarnIndex = find( RectYarnIndex.begin(), RectYarnIndex.end(), YarnIndex );
1233 if ( itRectYarnIndex == RectYarnIndex.end() )
1235 RectYarnIndex.push_back( YarnIndex );
1238 m_Yarns[YarnIndex].AssignSection(*pYarnSections);
1239 delete pYarnSections;
1252 XYZ Node =
m_Yarns[YarnIndex].GetNode(j)->GetPosition();
1256 XYZ PrevNode =
m_Yarns[YarnIndex].GetNode(j-1)->GetPosition();
1257 zDisplacement = Node.
z - PrevNode.
z;
1258 Node.
z = PrevNode.
z;
1262 Node.
z -= zDisplacement;
1274 Node =
m_Yarns[YarnIndex].GetNode(i)->GetPosition();
1275 Node.
z -= zDisplacement;
1288 vector<int>::iterator itRectYarnIndex;
1289 for ( itRectYarnIndex = RectYarnIndex.begin(); itRectYarnIndex != RectYarnIndex.end(); ++itRectYarnIndex )
1295 if ( YarnSection->
GetPower() == 0.0 )
1307 m_Yarns[*itRectYarnIndex].AssignSection(*pYarnSections);
1322 const vector<PATTERN3D> &Cell =
GetCell(i,j);
1328 if ( YarnIndex == -1 )
1330 if (
m_Yarns[YarnIndex].GetYarnSection()->
GetType() !=
"CYarnSectionInterpNode" )
1332 double FibreArea =
m_Yarns[YarnIndex].GetFibreArea(
"mm^2");
1333 if ( FibreArea == 0.0 )
1335 TGERROR(
"Cannot adjust height of yarn" << YarnIndex <<
": No fibre area set" );
1346 XYZ BottomYarn =
m_Yarns[YarnIndex].GetNode(j)->GetPosition();
1347 int TopYarnIndex =
GetYarnIndex( i, j, Cell.size()-2 );
1348 XYZ TopYarn =
m_Yarns[TopYarnIndex].GetNode(j)->GetPosition();
1349 double MidSectionHeight = TopYarn.
z - BottomYarn.
z - YarnSection->
GetHeight();
1357 map<pair<int, int>,
YARNDATA>::iterator itBinderData;
1362 MaxWidth -= itBinderData->second.dHeight / 2.0;
1367 MaxWidth -= itBinderData->second.dHeight / 2.0;
1377 double TargetHeight, WeftTargetHeight, BinderWeftTargetHeight;
1381 WeftTargetHeight = TargetHeight -
m_dGapSize;
1390 if ( (fabs(PowerEllipseSection.
GetHeight()/2.0 - BinderWeftTargetHeight) >
TOL && (PowerEllipseSection.
GetHeight()/2.0) > BinderWeftTargetHeight ) )
1392 AdjustWeftHeight( PowerEllipseSection, MaxWidth, TargetArea, MaxVolumeFraction, FibreArea, BinderWeftTargetHeight );
1397 if ( fabs(PowerEllipseSection.
GetHeight()/2.0 - WeftTargetHeight) >
TOL )
1399 if ( (PowerEllipseSection.
GetHeight()/2.0) > WeftTargetHeight )
1401 AdjustWeftHeight( PowerEllipseSection, MaxWidth, TargetArea, MaxVolumeFraction, FibreArea, WeftTargetHeight );
1405 double EllipseTargetHeight = WeftTargetHeight * 2.0;
1424 if ( (fabs(TopPowerEllipseSection.
GetHeight()/2.0 - BinderWeftTargetHeight) >
TOL && (TopPowerEllipseSection.
GetHeight()/2.0) > BinderWeftTargetHeight ) )
1426 AdjustWeftHeight( TopPowerEllipseSection, MaxWidth, TargetArea, MaxVolumeFraction, FibreArea, BinderWeftTargetHeight );
1431 if ( fabs(TopPowerEllipseSection.
GetHeight()/2.0 - WeftTargetHeight) >
TOL )
1434 if ( (TopPowerEllipseSection.
GetHeight()/2.0) > WeftTargetHeight )
1436 AdjustWeftHeight( TopPowerEllipseSection, MaxWidth, TargetArea, MaxVolumeFraction, FibreArea, WeftTargetHeight );
1440 double EllipseTargetHeight = WeftTargetHeight * 2.0;
1453 delete pYarnSections;
1466 XYZ NodePos =
m_Yarns[YarnIndex].GetNode(Node)->GetPosition();
1467 NodePos.
z += Offset;
1468 m_Yarns[YarnIndex].ReplaceNode( Node,
CNode(NodePos) );
1473 NodePos.
z += Offset;
1477 m_Yarns[YarnIndex].AssignSection( *pYarnSections );
1478 delete pYarnSections;
1483 double InitialHeight = PowerEllipseSection.
GetHeight();
1485 double HeightReduction = TargetHeight / (PowerEllipseSection.
GetHeight()/2.0);
1486 if ( HeightReduction <= 0.1 )
1487 HeightReduction = 0.1;
1494 double Area = PowerEllipseSection.
GetArea( PowerEllipseSection.
GetPoints(40) );
1495 double VolumeFraction = FibreArea/(Area/2.0);
1496 if ( VolumeFraction > MaxVolumeFraction )
1499 double MinArea = (FibreArea/MaxVolumeFraction) * 2.0;
1509 double InitialHeight = PowerEllipseSection.
GetHeight();
1515 double HeightReduction = TargetHeight / (PowerEllipseSection.
GetHeight()/2.0);
1516 if ( HeightReduction <= 0.1 )
1517 HeightReduction = 0.1;
1524 double Area = PowerEllipseSection.
GetArea( PowerEllipseSection.
GetPoints(40) );
1525 double VolumeFraction = FibreArea/(Area/2.0);
1526 if ( VolumeFraction > MaxVolumeFraction )
1529 double MinArea = (FibreArea/MaxVolumeFraction) * 2.0;
1538 XYZ Node =
m_Yarns[YarnIndex].GetNode(i)->GetPosition();
1544 LastNode.
z = Node.
z;
1578 const vector<PATTERN3D> &Cell =
GetCell(i,j);
1579 int iMaxIndex = (int)Cell.size() - 1;
1581 if ( iMaxIndex < 1 )
1590 if ( BinderYarnIndex == -1 || WeftYarnIndex == -1 )
1599 int TopWeftYarnIndex =
GetYarnIndex( i, j, iMaxIndex-1 );
1601 if ( BinderYarnIndex == -1 || WeftYarnIndex == -1 )
1610 XYZ WeftNode =
m_Yarns[WeftYarnIndex].GetNode( j )->GetPosition();
1611 XYZ BinderNode =
m_Yarns[BinderYarnIndex].GetNode( i )->GetPosition();
1612 XYZ OppositeWeftNode =
m_Yarns[OppositeWeftYarnIndex].GetNode( j )->GetPosition();
1616 string Type = WeftYarnSection->
GetType();
1618 if ( Type !=
"CSectionHybrid" )
1620 delete WeftYarnSection;
1626 Type = WeftYarnSection->
GetType();
1627 if ( Type !=
"CSectionHybrid" )
1629 delete OppositeWeftSection;
1636 Height = WeftNode.
z - OppositeWeftNode.
z;
1640 Height = OppositeWeftNode.
z - WeftNode.
z;
1643 double MidSectionHeight = Height;
1644 Height = MidSectionHeight/2.0 + WeftHeight;
1650 double FibreArea =
m_Yarns[BinderYarnIndex].GetFibreArea(
"mm^2");
1654 TGERROR(
"Binder yarn initial volume fraction exceeds max Vf Yarn: " << BinderYarnIndex );
1656 delete WeftYarnSection;
1662 delete WeftYarnSection;
1667 double TargetArea = InitialArea * 2.0;
1672 double PowerEllipseArea = PowerEllipseSection.
GetArea( PowerEllipseSection.
GetPoints(40));
1673 double dCrimp = 0.0;
1674 bool bCorrectCrimpInterference =
false;
1676 if ( PowerEllipseArea < TargetArea )
1678 double WidthHeightReduction = 1.0;
1680 double MaxWidth = PowerEllipseSection.
GetWidth() * 2.25;
1684 PowerEllipseArea = PowerEllipseSection.
GetArea( PowerEllipseSection.
GetPoints(40));
1685 double VolumeFraction = FibreArea/(PowerEllipseArea/2.0);
1695 double WeftArea = WeftYarnSection->
GetArea( WeftYarnSection->
GetPoints(40));
1696 double WeftFibreArea =
m_Yarns[WeftYarnIndex].GetFibreArea(
"mm^2");
1697 double WeftVolumeFraction = WeftFibreArea/WeftArea;
1711 double MaxHeight = WeftHeight * 2.0;
1714 if ( TargetWeftHeight >= MinWeftPowerEllipse->
GetHeight()/2.0 )
1716 WeftPowerEllipse->
SetHeight( TargetWeftHeight * 2.0 );
1725 WeftArea = WeftPowerEllipse->
GetArea( WeftPowerEllipse->
GetPoints(40) ) / 2.0;
1728 delete WeftPowerEllipse;
1730 delete MinWeftPowerEllipse;
1732 WeftVolumeFraction = WeftFibreArea/WeftArea;
1737 TGERROR(
"Can't reduce outer weft and binder to fit without exceeding max Vf: Binder Yarn " << BinderYarnIndex <<
"Weft Yarn " << WeftYarnIndex );
1741 dCrimp = WeftHeight + PowerEllipseSection.
GetHeight()/2.0 - dBinderWeftTargetHeight;
1745 Height = MidSectionHeight/2.0 + OppositeWeftHeight;
1750 if ( dOppositeSpace <
TOL )
1752 bCorrectCrimpInterference =
true;
1756 if ( dCrimp < dOppositeSpace )
1762 dOffset = dOppositeSpace;
1763 bCorrectCrimpInterference =
true;
1765 const vector<PATTERN3D> &Cell =
GetCell(i,j);
1766 int iMaxIndex = (int)Cell.size() - 1;
1769 for (
int k = 1; k < iMaxIndex-1; ++k )
1776 for (
int k = 2; k < iMaxIndex; ++k )
1787 else if ( PowerEllipseArea > TargetArea )
1793 TGLOG(
"New binder power ellipse area > target area => Vf decreased");
1798 XYZ Node =
m_Yarns[BinderYarnIndex].GetNode(i)->GetPosition();
1806 WeftNode.
z -= dCrimp;
1811 WeftNode.
z += dCrimp;
1813 m_Yarns[WeftYarnIndex].ReplaceNode( j, WeftNode );
1816 if ( bCorrectCrimpInterference )
1819 delete WeftYarnSection;
1820 delete BinderYarnSection;
1831 XYZ NodePos =
m_Yarns[YarnIndex].GetNode(Node)->GetPosition();
1832 NodePos.
z += Offset;
1833 m_Yarns[YarnIndex].ReplaceNode( Node,
CNode(NodePos) );
1838 NodePos.
z += Offset;
1842 m_Yarns[YarnIndex].AssignSection( *pYarnSections );
1843 delete pYarnSections;
1848 XY TopSectionPoint, BottomSectionPoint;
1849 TopSectionPoint = Section->
GetPoint(0.25);
1850 BottomSectionPoint = Section->
GetPoint(0.75);
1851 return TopSectionPoint.
y - BottomSectionPoint.
y;
1856 XY LeftPoint, RightPoint;
1857 LeftPoint = Section->
GetPoint(0.5);
1858 RightPoint = Section->
GetPoint(0.0);
1859 return RightPoint.
x - LeftPoint.
x;
1866 m_Yarns[YarnIndex].AssignSection(*pInterpNodeSection);
1867 delete pInterpNodeSection;
1872 if ( itBinderData !=
m_BinderData.end() && itBinderData->second.dWidth >= (itBinderData->second.dSpacing-
TOL) )
1874 CSectionPowerEllipse ThroughBinder( itBinderData->second.dWidth, itBinderData->second.dHeight, 0.0 );
1886 if ( Area > TargetArea )
1888 else if ( Area < TargetArea )
1890 double NewVolumeFraction = FibreArea/(TargetArea/2.0);
1894 double HeightReduction = 1.0;
1901 int i = StartIndex + 1;
1909 if ( StartIndex == 0 )
1923 string WeftType = YarnSection->
GetType();
1925 if ( WeftType ==
"CSectionPowerEllipse" )
1932 return SectionPoint;
1939 const vector<PATTERN3D> &Cell =
GetCell(i,j);
1943 vector<int>::iterator itpYarn;
1944 vector<pair<int, int> > RepeatLimits;
1945 vector<pair<double, XYZ> > Intersections;
1953 RepeatLimits.resize(2, pair<int, int>(-1, 0));
1954 vector<double> Modifiers;
1955 vector< vector<double> > YarnSectionModifiers;
1957 int WarpYarnIndex [2];
1958 int WarpCellIndex = IsTop ? Cell.size()-3 : 2;
1961 WarpYarnIndex[0] =
GetYarnIndex( i, WarpPrevIndex, WarpCellIndex );
1962 WarpYarnIndex[1] =
GetYarnIndex( i, WarpNextIndex, WarpCellIndex );
1966 WeftYarnMesh.
Clear();
1967 m_Yarns[WeftYarnIndex].AddSurfaceToMesh(WeftYarnMesh, RepeatLimits);
1973 double WeftWidth [2];
1977 for (k=0; k < 2; ++k)
1983 pInterpolation =
m_Yarns[WarpYarnIndex[k]].GetInterpolation();
1984 Node = pInterpolation->
GetNode(
m_Yarns[WarpYarnIndex[k]].GetMasterNodes(), i, 0);
1988 pYarnSection =
m_Yarns[WarpYarnIndex[k]].GetYarnSection();
1989 vector<XY> Points = pYarnSection->
GetSection(YarnPosInfo,
m_Yarns[WarpYarnIndex[k]].GetNumSectionPoints());
1990 Centre =
m_Yarns[WarpYarnIndex[k]].GetMasterNodes()[i].GetPosition();
1991 vector<XY>::iterator itPoint;
1993 for (itPoint = Points.begin(); itPoint != Points.end(); ++itPoint)
1995 P = itPoint->
x * Side + itPoint->
y * Up + Centre;
1996 if (WeftYarnMesh.
IntersectLine(Centre, P, Intersections, make_pair(
true,
false)))
1998 double dU = Intersections[0].first;
1999 XYZ Normal = Intersections[0].second;
2001 dU -= 0.5 * dProjectedGap;
2006 Modifiers.push_back(dU);
2009 Modifiers.push_back(1);
2011 YarnSectionModifiers.push_back(Modifiers);
2017 for ( k=0; k<2; ++k )
2022 pYarnSection =
m_Yarns[WarpYarnIndex[k]].GetYarnSection();
2028 Points = pYarnSection->
GetSection(YarnPosInfo, YarnSectionModifiers[k].size());
2029 for (
int ind=0; ind<(int)Points.size(); ++ind)
2031 Points[ind] *= YarnSectionModifiers[k][ind];
2043 double u = 0.95 * ( WeftWidth[k]/2.0 ) / YarnPosInfo.
SectionLengths[i];
2046 u = 1 - 0.95 * ( (WeftWidth[k]/2.0) / YarnPosInfo.
SectionLengths[PrevSectionIndex] );
2047 pYarnSections->
InsertSection( PrevSectionIndex, u, Section );
2049 m_Yarns[WarpYarnIndex[k]].AssignSection(*pYarnSections);
2050 delete pYarnSections;
2062 delete pYarnSections;
2069 if ( YarnIndex == -1 )
2074 Node =
m_Yarns[YarnIndex].GetNode(i)->GetPosition();
2080 LastNode.
z = Node.
z;
2086 Node =
m_Yarns[YarnIndex].GetNode(j)->GetPosition();
2092 LastNode.
z = Node.
z;
2103 int iNumWefts = (int)
m_YYarns[i].size();
2104 vector<string> Rows;
2105 Rows.resize(iNumWefts);
2109 vector<PATTERN3D> &Cell =
GetCell(i, j);
2112 vector<bool> bWeftSet(iNumWefts,
false);
2113 int iWeft = iNumWefts-1;
2115 for (
int k = (
int)Cell.size()-1; k >= 0; --k )
2120 for (
int iW = 0; iW < iNumWefts; ++iW )
2122 if ( !bWeftSet[iW] )
2123 Rows[iW].push_back(
'1');
2125 Rows[iW].push_back(
'0');
2129 bWeftSet[iWeft] =
true;
2141 for (
int iW = iNumWefts-1 ; iW >=0; --iW )
2147 for (
int iW = 0 ; iW < iNumWefts; ++iW )
2155 int NumLayers = *(max_element( Layers.begin(), Layers.end() ));
2157 vector<int>::iterator itWarp;
2158 vector<int>::iterator itLayers;
2160 if ( Layers.size() != Warp.size() )
2161 TGERROR(
"Can't add weft row, warp and layer sizes do not match");
2163 itWarp = Warp.begin();
2165 int PrevYCellIndex = -1;
2168 bool bFound =
false;
2169 itLayers = Layers.begin();
2170 while ( itLayers != Layers.end() && !bFound )
2172 vector<PATTERN3D> &Cell =
GetCell(Weft, j);
2184 if ( *itWarp == 0 && bFirst )
2186 PrevYCellIndex = (NumLayers - (*itLayers)+1 )*2 + 1;
2193 }
while ( itLayers != Layers.end() && *itLayers != 1 );
2196 PrevYCellIndex = (NumLayers - *(itLayers-1))*2 +1;
2208 itWarp = Warp.begin();
2211 for ( itLayers = Layers.begin(); itLayers != Layers.end(); )
2213 vector<PATTERN3D> &Cell =
GetCell(Weft, j);
2215 YarnCell.assign(Cell.size(), -1);
2223 if ( PrevYCellIndex != -1 )
2226 YarnCell[PrevYCellIndex] = Weft;
2237 if ( *itWarp == 0 && bFirst )
2239 int WeftCellIndex = (NumLayers - (*itLayers)+1 )*2 + 1;
2240 PrevYCellIndex = WeftCellIndex;
2242 YarnCell[WeftCellIndex] = Weft;
2251 WarpIndex = (NumLayers - (*itLayers)+1) *2;
2257 }
while ( itLayers != Layers.end() && *itLayers != 1 );
2260 int WeftCellIndex = (NumLayers - *(itLayers-1))*2 +1;
2261 PrevYCellIndex = WeftCellIndex;
2264 YarnCell[(NumLayers - *(itLayers-1))*2 +1] = Weft;
2274 vector<PATTERN3D> &Cell =
GetCell(Weft, j);
2276 vector<PATTERN3D> &PrevCell =
GetCell(Weft, j-1);
2277 vector<PATTERN3D> &NextCell =
GetCell(Weft, j+1);
2281 if ( NextWeftHeight != PrevWeftHeight )
2285 YarnCell[WeftHeight] = -1;
2286 YarnCell[PrevWeftHeight] = Weft;
2304 bool bRemoveCells =
true;
2308 vector<PATTERN3D> &Cell1 =
GetCell(i,j);
2309 vector<PATTERN3D> &Cell2 =
GetCell(i+1,j);
2311 if ( (Cell1[0] != Cell2[0] || Cell1[Cell1.size()-1] != Cell2[Cell2.size()-1]) )
2318 Levels.push_back(Level2);
2319 bRemoveCells =
false;
2324 Levels.push_back(-1);
2325 bRemoveCells =
false;
2330 Levels.push_back(Level2);
2347 vector<PATTERN3D> &Cell =
GetCell(i,j);
2352 YarnCell[Levels[j]] = NextYarnCell[Levels[j]];
2366 vector<PATTERN3D> &Cell =
GetCell(i,j);
2367 vector<PATTERN3D> &Cell1 =
GetCell(i+1,j);
2370 if ( Levels[j] != -1 )
2374 YarnCell[Levels[j]] = YarnCell1[Levels[j]];
2375 YarnCell1[Levels[j]] = -1;
2382 vector<int> DeleteCell;
2393 vector<PATTERN3D> &Cell1 =
GetCell(i,j);
2394 vector<PATTERN3D> &Cell2 =
GetCell(i+1,j);
2398 if ( ((Cell1[0] != Cell2[0] || Cell1[Cell1.size()-1] != Cell2[Cell2.size()-1])) )
2402 DeleteCell.push_back(0);
2409 for ( k = 1; k < Cell2.size(); ++k )
2417 if ( k != Cell2.size() )
2419 DeleteCell.push_back(1);
2426 if ( DeleteCell[j] == 0 )
2433 vector<PATTERN3D> &Cell =
GetCell(i,j);
2434 vector<PATTERN3D> &Cell1 =
GetCell(i+1,j);
2437 for (
int k = 1; k < Cell1.size(); ++k )
2442 YarnCell[k] = YarnCell1[k];
2462 vector<PATTERN3D> &Cell =
GetCell(i,j);
2481 if ( i < Cell.size() )
2489 int i = Cell.size()-2;
2506 int i = Cell.size() - 1;
2534 int iXYarnCount = 0;
2536 vector<PATTERN3D> Pattern =
GetCell(x, y);
2558 int i = YarnCell.size() - 1;
2561 if (YarnCell[i] == WeftIndex)
2571 for (
int i = 0; i <
m_YYarns.size(); ++i)
2573 vector<int>::iterator itYYarns;
2574 for (itYYarns =
m_YYarns[i].begin(); itYYarns !=
m_YYarns[i].end(); ++itYYarns)
2576 if (iYarn == WeftIndex)
2586 const vector<PATTERN3D> &Cell =
GetCell(i, j);
2587 const vector<PATTERN3D> &YarnCell =
GetYarnCell(i, j);
2597 const vector<PATTERN3D> &NextCell =
GetCell(i, NextCellIndex);
2598 const vector<PATTERN3D> &PrevCell =
GetCell(i, PrevCellIndex);
2600 const vector<PATTERN3D> &NextYarnCell =
GetYarnCell(i, NextCellIndex);
2601 const vector<PATTERN3D> &PrevYarnCell =
GetYarnCell(i, PrevCellIndex);
2605 int iMaxIndex = Cell.size() - 1;
2608 XYZ WarpBelowNode, WarpAboveNode;
2609 int iStartNode = CurrentNode;
2614 double dWeftOffset =
m_YYarnData[i].dHeight / 2.0;
2618 if (WeftYarnIndex == -1)
2621 int WarpAboveIndex, WarpBelowIndex;
2622 int WarpAboveCellIndex, WarpBelowCellIndex;
2625 if (iIndex < (
int)Cell.size() - 1)
2628 if (WarpAboveCellIndex != -1)
2630 WarpAboveIndex =
GetYarnIndex(i, j, WarpAboveCellIndex);
2631 if (WarpAboveIndex >= 0)
2632 WarpAboveNode =
m_Yarns[WarpAboveIndex].GetNode(i)->GetPosition();
2636 WarpAboveIndex = -1;
2639 WarpAboveIndex = -1;
2645 if (WarpBelowCellIndex != -1)
2647 WarpBelowIndex =
GetYarnIndex(i, j, WarpBelowCellIndex);
2648 if (WarpBelowIndex >= 0)
2649 WarpBelowNode =
m_Yarns[WarpBelowIndex].GetNode(i)->GetPosition();
2653 WarpBelowIndex = -1;
2656 WarpBelowIndex = -1;
2658 XYZ WeftNode =
m_Yarns[WeftYarnIndex].GetNode(CurrentNode)->GetPosition();
2660 if (iIndex > 0 && iPrevIndex != -1 && iPrevIndex < iIndex - 1 && PrevCell[iPrevIndex] ==
PATTERN3D_YYARN )
2663 if (WarpBelowIndex == -1)
2666 if (YarnSection ==
NULL)
2670 XYZ NewNode = WarpBelowNode;
2672 if (iIndex - iPrevIndex > 2)
2674 SectionPoint = YarnSection->
GetPoint(0.5);
2675 NewNode.
y = NewNode.
y + SectionPoint.
x - dWeftOffset -
m_dGapSize;
2676 NewNode.
z = NewNode.
z + SectionPoint.
y;
2677 m_Yarns[WeftYarnIndex].InsertNode(NewNode, CurrentNode);
2683 if (!(iIndex < iMaxIndex && iNextIndex > iIndex && NextCell[iNextIndex] ==
PATTERN3D_YYARN
2684 &&
GetYarnIndex(i, NextCellIndex, iNextIndex) == WeftYarnIndex))
2692 else if (iIndex < iMaxIndex && iPrevIndex != -1 && iPrevIndex > iIndex + 1 && PrevCell[iPrevIndex] ==
PATTERN3D_YYARN )
2694 if (WarpAboveCellIndex != iIndex + 1)
2698 if (YarnSection ==
NULL)
2701 XYZ NewNode = WarpAboveNode;
2703 if (iPrevIndex - iIndex > 2)
2705 SectionPoint = YarnSection->
GetPoint(0.5);
2706 NewNode.
y = NewNode.
y + SectionPoint.
x - dWeftOffset -
m_dGapSize;
2707 NewNode.
z = NewNode.
z + SectionPoint.
y;
2708 m_Yarns[WeftYarnIndex].InsertNode(NewNode, CurrentNode);
2712 NewNode = WarpAboveNode;
2717 if (!(iIndex > 0 && iNextIndex < iIndex && NextCell[iNextIndex] ==
PATTERN3D_YYARN
2718 &&
GetYarnIndex(i, NextCellIndex, iNextIndex) == WeftYarnIndex))
2725 &&
GetYarnIndex(i, NextCellIndex, iNextIndex) == WeftYarnIndex)
2734 if (iIndex > 0 && iNextIndex != -1 && iNextIndex < iIndex - 1 && NextCell[iNextIndex] ==
PATTERN3D_YYARN )
2739 if (YarnSection ==
NULL)
2743 &&
GetYarnIndex(i, PrevCellIndex, iPrevIndex) == WeftYarnIndex)
2749 XYZ NewNode = WarpBelowNode;
2751 if (!(iIndex < iMaxIndex && iPrevIndex > iIndex && PrevCell[iPrevIndex] ==
PATTERN3D_YYARN
2752 &&
GetYarnIndex(i, PrevCellIndex, iPrevIndex) == WeftYarnIndex))
2761 if (iIndex - iNextIndex > 2)
2763 SectionPoint = YarnSection->
GetPoint(0);
2764 NewNode = WarpBelowNode;
2765 NewNode.
y = NewNode.
y + SectionPoint.
x + dWeftOffset +
m_dGapSize;
2766 NewNode.
z = NewNode.
z + SectionPoint.
y;
2767 m_Yarns[WeftYarnIndex].InsertNode(NewNode, CurrentNode + 1);
2773 else if (iIndex < iMaxIndex && iNextIndex != -1 && iNextIndex > iIndex + 1 && NextCell[iNextIndex] ==
PATTERN3D_YYARN )
2775 if (WarpAboveCellIndex != iIndex + 1)
2780 if (YarnSection ==
NULL)
2784 &&
GetYarnIndex(i, PrevCellIndex, iPrevIndex) == WeftYarnIndex)
2790 XYZ NewNode = WarpAboveNode;
2792 if (!(iIndex > 0 && iPrevIndex < iIndex && PrevCell[iPrevIndex] ==
PATTERN3D_YYARN
2793 &&
GetYarnIndex(i, PrevCellIndex, iPrevIndex) == WeftYarnIndex))
2802 if (iNextIndex - iIndex > 2)
2804 SectionPoint = YarnSection->
GetPoint(0);
2805 NewNode = WarpAboveNode;
2806 NewNode.
y = NewNode.
y + SectionPoint.
x + dWeftOffset +
m_dGapSize;
2807 NewNode.
z = NewNode.
z + SectionPoint.
y;
2808 m_Yarns[WeftYarnIndex].InsertNode(NewNode, CurrentNode + 1);
2818 XYZ NewNode =
m_Yarns[WeftYarnIndex].GetNode(0)->GetPosition();
2827 int i = YarnCell.size()-1;
2831 if (YarnCell[i] != -1)
2851 for (
int k = 0; k < NumWefts; ++k)
2853 int CurrentYNode = 0;
2856 if (WeftIndex == -1)
2859 for (
int j = 0; j < iNumXYarns; ++j)
2861 CurrentYNode =
AddWeftNodes(CurrentYNode, i, j, WeftIndex);
#define TGLOGINDENT(MESSAGE)
Combines the TGLOG macro and TGLOGAUTOINDENT macro in one.
#define TGERROR(MESSAGE)
Macros used to report the file name and line number to the TexGenError and TexGenLog functions.
Bezier interpolation for yarn paths.
Abstract base class for describing the yarn path interpolations.
virtual CSlaveNode GetNode(const vector< CNode > &MasterNodes, int iIndex, double t) const =0
Get a node from parametric function. Initialise should be called first.
Defines the nodes and elements of a surface or volume mesh.
void ConvertQuadstoTriangles(bool bQuality=true)
Convert the quad elements to triangles.
void Convert3Dto2D()
Convert all 3D elements to 2D elements representing their surface.
void Clear()
Empty mesh nodes and indices.
int IntersectLine(const XYZ &P1, const XYZ &P2, vector< pair< double, XYZ > > &IntersectionPoints, pair< bool, bool > TrimResults=make_pair(false, false), bool bForceFind=false) const
Find the points where a line intersects the mesh.
Represents a point on the centreline of a yarn.
void AddRow(string Row)
Add a row representing one weft insertion '1' indicates warp up, '0' warp down and '2' no yarn.
CSection * Copy() const
Create a copy of the derived section and return a pointer to the newly created instance.
Abstract base class respresenting a yarn cross-section.
virtual CSection * Copy() const =0
Create a copy of the derived section and return a pointer to the newly created instance.
void AssignSectionMesh(const CSectionMesh &SectionMesh)
Assign a mesh to the section.
virtual string GetType() const =0
Derived class should return the class name.
static double GetArea(const vector< XY > &Section)
Get the area of a section.
virtual const vector< XY > & GetPoints(int iNumPoints, bool bEquiSpaced=false) const
Get a section with given number of points on the perimeter.
virtual XY GetPoint(double t) const =0
Get a point lying on the perimeter correspending to parametric value t.
Hybrid of any number of other sections.
XY GetPoint(double t) const
Get a point lying on the perimeter correspending to parametric value t.
Create a rectangular mesh, the number of layers can be specified or set as -1 for automatic determina...
Creates a polygonal section, where a list of points are given to form the closed polygon.
CSection * Copy() const
Create a copy of the derived section and return a pointer to the newly created instance.
void SetHeight(double dHeight)
void SetPower(double dPower)
A derivation of the CNode class which contains data specific to slave nodes such as sections.
Represents a 3D woven textile.
void AddNoYarnLayer()
Add empty layer.
void ReplaceLastNode(int BinderYarnIndex, XYZ &NewNode, XYZ &BinderNode) const
Replace last node with node offset to match node 0.
vector< YARNDATA > m_XYarnData
vector< vector< int > > m_XYarns
double m_dFabricThickness
int FindWarpBelowIndex(const vector< PATTERN3D > &Cell, int iIndex) const
int GetYarnIndex(int x, int y, int z) const
void FindPowerEllipseSectionHeight(double &MaxHeight, double &TargetArea, CSectionPowerEllipse *YarnSection) const
void SetYarnProperties(CYarn &Yarn, int iType) const
void CheckUpVectors(int WarpIndex, bool Yarn=PATTERN3D_XYARN, bool bYarnsIndex=false) const
int FindWarpAboveIndex(const vector< PATTERN3D > &Cell, int iIndex) const
bool AdjustPowerEllipseSectionWidth(double &HeightReduction, double &MaxWidth, double TargetArea, CSectionPowerEllipse *YarnSection) const
Adjust section to target height whilst maintaining cross-sectional area.
double GetHeight() const
Get the height of the unit cell.
int FindPrevYCellIndex(int Starti, int j, int k) const
Find next cell in x direction which isn't a noyarn, searching backwards.
int FindWeftHeight(const vector< PATTERN3D > &Cell) const
double m_dMaxVolumeFraction
int FindNextCellIndex(int index) const
Find next cell in y direction which isn't a binder yarn.
int FindNextYCellIndex(int Starti, int j, int k) const
Find next cell in x direction which isn't a noyarn.
bool NoYarnCell(vector< PATTERN3D > &Cell)
bool IsBinderYarn(int index) const
Check if X yarn is binder or warp. Returns true if binder.
vector< YARNDATA > m_YYarnData
void AddBinderLayer()
Add yarns parallel to the X axis in binder yarn positions, no yarns in warp positions.
CSection * GetCrossSection(int YarnIndex, int Node=-1) const
Gets the cross-section of a yarn, either constant or interp node, power elliptical sections.
void AddWarpLayer()
Add yarns parallel to the X axis in warp yarn positions, no yarns in binder positions.
void InsertWeftNode(CSection *YarnSection, double t, XYZ &WarpNode, int &CurrentNode, int WeftYarnIndex, double Offset, bool bInsert=true) const
void ReducePowerEllipseHeight(double &TargetArea, CSectionPowerEllipse *YarnSection) const
void RemoveCell(int x, int y)
bool AdjustPowerEllipsePower(double &HeightReduction, double TargetArea, CSectionPowerEllipse *YarnSection, double MinPower) const
vector< vector< int > > m_YYarns
virtual double GetWidth() const
Get the width of the unit cell.
void AddYLayers(int x, int iNumberLayers)
Add given number of yarns parallel to the Y axis, with given index x.
void InsertBinderNode(CSectionPowerEllipse *YarnSection, double t, XYZ &WeftNode, int &CurrentNode, int BinderYarnIndex, double Offset, bool bInsert=true) const
Calculates a point at given point on power ellipse cross section and inserts into binder yarn.
virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType)
Used for saving data to XML.
CPatternDraft m_PatternDraft
Class for generating pattern draft from weave pattern.
const vector< PATTERN3D > & GetCell(int x, int y) const
CObjectContainer< CSectionMesh > m_pSectionMesh
vector< CYarn > m_Yarns
Vector of yarns contained within this cell.
string GetName() const
Get the name associated with this textile.
int AddYarn(const CYarn &Yarn)
Add a Yarn to the textile.
bool m_bNeedsBuilding
Variable which keeps track of wether the textile needs building or not.
void ReplaceThroughBinderSection(int BinderYarnIndex, int Node, CSection &Section, map< pair< int, int >, YARNDATA >::iterator &itBinderData) const
Replace binder cross section with default if at top, adjusted if through thickness with spacing narro...
vector< int > & GetYarnCell(int x, int y)
virtual string GetType() const
Derived class should return the class name.
void ShapeBinderYarns() const
Shape the binder yarns around the weft at top and bottom.
XY GetSectionPoint(CSection *YarnSection, double t) const
Get section point for power ellipse or hybrid section.
void ReplaceYarnSection(int YarnIndex, int Node, CSection &Section) const
Replace the yarn cross section at the given index.
int FindNextBinderIndex(int StartIndex) const
void SwapBinderPosition(int x, int y)
Binders in orthogonal weaves are either at the top or bottom of stack.
vector< vector< int > > m_WeftYarns
virtual void SetupLayers(int iNumWarpLayers, int iNumWeftLayers, int iNumBinderLayers=1)
Find min and max z values for the textile.
bool BuildWeavePatternTextile() const
void AdjustWeftToFitBinderHeight(int i, int j, CSectionPowerEllipse &PowerEllipseSection, double &MaxWidth, double &TargetArea, double &MaxVolumeFraction, double &FibreArea) const
void OffsetYarn(int i, int j, int k, double dHeight, int YarnType) const
Offset yarn at position i,j at cell height k by dHeight in the z direction.
void RemoveYarnCell(int x, int y)
void ChangeWeftSection(CSection &TopHalf, CSection &BottomHalf, int YarnIndex, int Node, double Offset) const
int FindWeftYarnIndex(int WeftIndex) const
Find yarn index from m_YYarns using single weft index.
int AddWeftNodes(int CurrentNode, int i, int j, int WeftIndex) const
Add weft nodes around outline of adjacent warp yarns.
void CorrectCrimpInterference(int i, int j, int WeftYarnIndex, bool IsTop) const
Correct interference int warp yarn caused by creating crimp in top/bottom weft yarns.
void AdjustBinderYarnSection(int i, int j) const
Adjust binder section for specified i,j position.
void ShapeWeftYarns() const
void ChangePowerEllipseSection(double &TargetArea, CSectionPowerEllipse *YarnSection, double FibreArea) const
void CheckBinderWidths() const
Check if binder yarn widths are greater than through thickness spacing. Adjust to fit if necessary.
int FindBinderHeight(const vector< PATTERN3D > &Cell) const
Find the height of the binder yarn within a cell.
virtual void ConvertToPatternDraft(int iWeftOrder=BOTTOM_TO_TOP)
bool m_bWeavePattern
Indicates whether textile is loaded from weave pattern.
double GetHybridWidth(CSectionHybrid *Section) const
Get width of hybrid section.
bool AdjustWeftHeight(CSectionPowerEllipse &PowerEllipseSection, double &MaxWidth, double &TargetArea, double &MaxVolumeFraction, double &FibreArea, double TargetHeight) const
map< pair< int, int >, YARNDATA > m_BinderData
bool AdjustMidLayerHeights() const
Adjust height of inside layers to meet specified textile thickness, keeping yarn cross-sectional area...
double GetHybridSectionWidth(int WarpIndex, int WeftIndex) const
void MoveBinderYarnPosition(vector< PATTERN3D > &Cell)
Move binder yarn to top/bottom of weft stack if there are no_yarns in cell.
virtual void SetupWeftRow(vector< int > &Layers, vector< int > &Row, int NumWarps, int Weft)
Set up row of pattern cells for one weft pattern using one row of weave pattern data and the layers p...
virtual ~CTextileOrthogonal(void)
int FindWeftYarnHeight(const vector< PATTERN3D > &YarnCell, int WeftIndex) const
Find position of given yarn index in YarnCell.
virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType)
Used for saving data to XML.
void AdjustBinderPosition(int iCellIndex, int i, int j, double dHeight, bool bIsTop) const
void AdjustBinderYarns() const
Adjust binder yarn cross sections to fit specified yarn thickness.
void ChangeBinderSection(CSection &TopHalf, CSection &BottomHalf, int YarnIndex, int Node, double Offset) const
virtual bool BuildTextile() const
Build the textile.
double GetHybridHeight(CSectionHybrid *Section) const
Get height of hybrid section. Assumes max height at mid-point.
int GetWeavePatternYarnIndex(int x, int y, int z) const
int GetWeftYarnIndex(const vector< int > &YarnCell, int n) const
Finds the y-yarn index of the nth weft yarn in a YarnCell.
CTextileOrthogonal(int iNumXYarns, int iNumYYarns, double dXSpacing, double dYSpacing, double dXHeight, double dYHeight, bool bRefine=false, bool bWeavePattern=false)
Build a weave unit cell of given width, height, yarn spacing and fabric thickness.
int AddBinderNodes(int CurrentNode, int i, int j) const
Add extra nodes to binder yarns to match shape of adjacent weft yarns.
void AdjustOuterWeftYarns() const
Represents a yarn consisting of master nodes, section and interpolation function.
Creates a section which is constant all along the yarn.
Abstract base class used to define the sections along the length of a yarn.
virtual vector< XY > GetSection(const YARN_POSITION_INFORMATION PositionInfo, int iNumPoints, bool bEquiSpaced=false) const =0
This function must be implemented by derived classes.
Creates a section which is linearly interpolated between sections defined at the nodes.
void ReplaceSection(int iIndex, const CSection &Section)
Replace a section at a node.
void AddSection(const CSection &Section)
Add a section at a node.
const CSection & GetNodeSection(int iIndex) const
void InsertSection(int iIndex, const CSection &Section)
Insert a section at a node.
int GetNumNodeSections() const
Namespace containing a series of customised math operations not found in the standard c++ library.
double DotProduct(const XYZ &left, const XYZ &right)
Get the dot product of two vectors.
XYZ CrossProduct(const XYZ &left, const XYZ &right)
Get the cross product of two vectors.
Struct for representing points in 2D space.
Struct for representing points in 3D space.
Structure used to represent the position along the length of a yarn.
double dSectionPosition
This variables varies linearly with distance from 0 to 1 from the start to the end of the current lin...
int iSection
This variable represents the index of the current section (where a section is defined as the part bet...
vector< double > SectionLengths
This contains a list of lengths representing the length of each section.
Data structure to keep track of yarn parameters.