27CTextileWeave::CTextileWeave(
int iNumYYarns,
int iNumXYarns,
double dSpacing,
double dThickness)
28: m_iNumXYarns(iNumXYarns)
29, m_iNumYYarns(iNumYYarns)
31, m_dFabricThickness(dThickness)
55 TiXmlElement *pSectionMesh = Element.FirstChildElement(
"SectionMesh");
62 vector<PATTERN2D> Cell;
65 Cell.push_back(valueify<bool>(pCell->Attribute(
"value")));
72 pYarnData->Attribute(
"Width", &YarnData.
dWidth);
73 pYarnData->Attribute(
"Height", &YarnData.
dHeight);
74 pYarnData->Attribute(
"Spacing", &YarnData.
dSpacing);
79 pYarnData->Attribute(
"Width", &YarnData.
dWidth);
80 pYarnData->Attribute(
"Height", &YarnData.
dHeight);
81 pYarnData->Attribute(
"Spacing", &YarnData.
dSpacing);
89 Indices.push_back(valueify<int>(pYarn->Attribute(
"yarnindex")));
98 Indices.push_back(valueify<int>(pYarn->Attribute(
"yarnindex")));
115 TiXmlElement SectionMesh(
"SectionMesh");
117 Element.InsertEndChild(SectionMesh);
122 TiXmlElement PatternCell(
"PatternCell");
124 PatternCell.SetAttribute(
"x", Coords.first);
125 PatternCell.SetAttribute(
"y", Coords.second);
127 for (j=0; j<(int)
m_Pattern[i].size(); ++j)
129 TiXmlElement PatternElement(
"PatternElement");
132 PatternCell.InsertEndChild(PatternElement);
134 Element.InsertEndChild(PatternCell);
138 TiXmlElement XYarnData(
"XYarnData");
139 XYarnData.SetAttribute(
"index", i);
143 Element.InsertEndChild(XYarnData);
147 TiXmlElement YYarnData(
"YYarnData");
148 YYarnData.SetAttribute(
"index", i);
152 Element.InsertEndChild(YYarnData);
157 for (i=0; i<(int)
m_XYarns.size(); ++i)
159 TiXmlElement XYarns(
"XYarns");
160 XYarns.SetAttribute(
"index", i);
161 for (j=0; j<(int)
m_XYarns[i].size(); ++j)
163 TiXmlElement XYarn(
"XYarn");
165 XYarn.SetAttribute(
"yarnindex",
m_XYarns[i][j]);
166 XYarns.InsertEndChild(XYarn);
168 Element.InsertEndChild(XYarns);
170 for (i=0; i<(int)
m_YYarns.size(); ++i)
172 TiXmlElement YYarns(
"YYarns");
173 YYarns.SetAttribute(
"index", i);
174 for (j=0; j<(int)
m_YYarns[i].size(); ++j)
176 TiXmlElement YYarn(
"YYarn");
178 YYarn.SetAttribute(
"yarnindex",
m_YYarns[i][j]);
179 YYarns.InsertEndChild(YYarn);
181 Element.InsertEndChild(YYarns);
204 int i, j, k, iNumYarns, iFirstNumYarns;
209 const vector<PATTERN2D> &Cell =
GetCell(j, i);
211 for (k=0; k<(int)Cell.size(); ++k)
218 iFirstNumYarns = iNumYarns;
222 if (iFirstNumYarns != iNumYarns)
232 const vector<PATTERN2D> &Cell =
GetCell(j, i);
234 for (k=0; k<(int)Cell.size(); ++k)
241 iFirstNumYarns = iNumYarns;
245 if (iFirstNumYarns != iNumYarns)
283 for (k=0; k<(int)Cell.size(); ++k)
294 for (k=0; k<(int)Cell.size(); ++k)
320 for (k=0; k<(int)Cell.size(); ++k)
331 for (k=0; k<(int)Cell.size(); ++k)
348 vector<int>::iterator itpYarn;
349 double dWidth, dHeight;
357 for (itpYarn =
m_XYarns[i].begin(); itpYarn !=
m_XYarns[i].end(); ++itpYarn)
369 for (itpYarn =
m_YYarns[i].begin(); itpYarn !=
m_YYarns[i].end(); ++itpYarn)
378 vector<CYarn>::iterator itYarn;
383 itYarn->AddRepeat(
XYZ(dWidth, 0, 0));
384 itYarn->AddRepeat(
XYZ(0, dHeight, 0));
393 if (bAdjustYarnHeights)
422 vector<vector<int> > *pTransverseYarns;
423 vector<vector<int> > *pLongitudinalYarns;
425 int iLongitudinalNum;
428 CMesh TransverseYarnsMesh;
429 vector<int>::iterator itpYarn;
430 vector<pair<int, int> > RepeatLimits;
431 vector<pair<double, XYZ> > Intersections;
439 RepeatLimits.resize(2, pair<int, int>(-1, 0));
440 vector<double> YarnMaxWidth;
441 YarnMaxWidth.resize(
m_Yarns.size(), -1);
444 for (iDir=0; iDir<2; ++iDir)
461 for (i=0; i<iTransverseNum; ++i)
463 TransverseYarnsMesh.
Clear();
464 for (itpYarn = (*pTransverseYarns)[i].begin(); itpYarn != (*pTransverseYarns)[i].end(); ++itpYarn)
466 m_Yarns[*itpYarn].AddSurfaceToMesh(TransverseYarnsMesh, RepeatLimits);
472 for (j=0; j<iLongitudinalNum; ++j)
474 for (itpYarn = (*pLongitudinalYarns)[j].begin(); itpYarn != (*pLongitudinalYarns)[j].end(); ++itpYarn)
480 pInterpolation =
m_Yarns[*itpYarn].GetInterpolation();
481 Node = pInterpolation->
GetNode(
m_Yarns[*itpYarn].GetMasterNodes(), i, 0);
485 pYarnSection =
m_Yarns[*itpYarn].GetYarnSection();
487 vector<XY> Points = pYarnSection->
GetSection(YarnPosInfo, 2);
488 Center =
m_Yarns[*itpYarn].GetMasterNodes()[i].GetPosition();
489 vector<XY>::iterator itPoint;
490 for (itPoint = Points.begin(); itPoint != Points.end(); ++itPoint)
492 P = itPoint->
x * Side + itPoint->
y * Up + Center;
494 if (TransverseYarnsMesh.
IntersectLine(Center, P, Intersections, make_pair(
true,
false)))
496 double dU = Intersections[0].first;
497 XYZ Normal = Intersections[0].second;
499 dU -= 0.5 * dProjectedGap;
504 double dWidth = 2 *
GetLength(*itPoint) * dU;
505 if (YarnMaxWidth[*itpYarn] < 0 || dWidth < YarnMaxWidth[*itpYarn])
507 YarnMaxWidth[*itpYarn] = dWidth;
518 double dWidth, dHeight;
521 for (itpYarn =
m_XYarns[i].begin(); itpYarn !=
m_XYarns[i].end(); ++itpYarn)
523 if (YarnMaxWidth[*itpYarn] >= 0)
525 if (
m_XYarnData[i].dWidth > YarnMaxWidth[*itpYarn])
527 TGLOG(
"Changing X yarn width " << i <<
" from " <<
m_XYarnData[i].dWidth <<
" to " << YarnMaxWidth[*itpYarn]);
535 for (itpYarn =
m_YYarns[i].begin(); itpYarn !=
m_YYarns[i].end(); ++itpYarn)
537 if (YarnMaxWidth[*itpYarn] >= 0)
539 if (
m_YYarnData[i].dWidth > YarnMaxWidth[*itpYarn])
541 TGLOG(
"Changing Y yarn width " << i <<
" from " <<
m_YYarnData[i].dWidth <<
" to " << YarnMaxWidth[*itpYarn]);
556 for (itpYarn =
m_XYarns[i].begin(); itpYarn !=
m_XYarns[i].end(); ++itpYarn)
568 for (itpYarn =
m_YYarns[i].begin(); itpYarn !=
m_YYarns[i].end(); ++itpYarn)
579 for(
unsigned int i=0;i<
m_Yarns.size();++i)
583 if (ysection->
GetType()!=
"CYarnSectionInterpNode")
585 TGERROR(
"Cannot flatten a yarn with section type: " << ysection->
GetType())
589 const std::vector<CNode>& m_nodes =
m_Yarns[i].GetMasterNodes();
590 const int n_section_points =
m_Yarns[i].GetNumSectionPoints();
595 for(
unsigned int j=0;j<m_nodes.size();++j)
597 npos = m_nodes[j].GetPosition();
598 z_mid += npos.
z/m_nodes.size();
601 for(
unsigned int j=0;j<m_nodes.size();++j)
603 YarnPosInfo.
iSection = j%(m_nodes.size()-1);
604 npos = m_nodes[j].GetPosition();
605 std::vector<XY> section = NewYarnSection.
GetSection(YarnPosInfo, n_section_points);
606 for(
unsigned int k=0;k<section.size();++k)
610 if(section[k].y<-dFlatLevel && iUpDown<=0)
611 section[k].y = - dFlatLevel;
613 else if (npos.
z>z_mid && iUpDown>=0)
615 if (section[k].y>dFlatLevel)
616 section[k].y = dFlatLevel;
621 m_Yarns[i].AssignSection(NewYarnSection);
631 vector<vector<int> > *pTransverseYarns;
632 vector<vector<int> > *pLongitudinalYarns;
634 int iLongitudinalNum;
637 CMesh TransverseYarnsMesh;
638 vector<int>::iterator itpYarn;
639 vector<pair<int, int> > RepeatLimits;
640 vector<pair<double, XYZ> > Intersections;
648 RepeatLimits.resize(2, pair<int, int>(-1, 0));
649 vector<double> Modifiers;
650 vector<vector<vector<double> > > YarnSectionModifiers;
651 YarnSectionModifiers.resize(
m_Yarns.size());
654 for (iDir=0; iDir<2; ++iDir)
671 for (i=0; i<iTransverseNum; ++i)
673 TransverseYarnsMesh.
Clear();
674 for (itpYarn = (*pTransverseYarns)[i].begin(); itpYarn != (*pTransverseYarns)[i].end(); ++itpYarn)
676 m_Yarns[*itpYarn].AddSurfaceToMesh(TransverseYarnsMesh, RepeatLimits);
682 for (j=0; j<iLongitudinalNum; ++j)
684 for (itpYarn = (*pLongitudinalYarns)[j].begin(); itpYarn != (*pLongitudinalYarns)[j].end(); ++itpYarn)
690 pInterpolation =
m_Yarns[*itpYarn].GetInterpolation();
691 Node = pInterpolation->
GetNode(
m_Yarns[*itpYarn].GetMasterNodes(), i, 0);
695 pYarnSection =
m_Yarns[*itpYarn].GetYarnSection();
696 vector<XY> Points = pYarnSection->
GetSection(YarnPosInfo,
m_Yarns[*itpYarn].GetNumSectionPoints());
697 Center =
m_Yarns[*itpYarn].GetMasterNodes()[i].GetPosition();
698 vector<XY>::iterator itPoint;
700 for (itPoint = Points.begin(); itPoint != Points.end(); ++itPoint)
702 P = itPoint->
x * Side + itPoint->
y * Up + Center;
703 if (TransverseYarnsMesh.
IntersectLine(Center, P, Intersections, make_pair(
true,
false)))
705 double dU = Intersections[0].first;
706 XYZ Normal = Intersections[0].second;
708 dU -= 0.5 * dProjectedGap;
713 Modifiers.push_back(dU);
716 Modifiers.push_back(1);
718 YarnSectionModifiers[*itpYarn].push_back(Modifiers);
724 for (i=0; i<(int)
m_Yarns.size(); ++i)
727 pYarnSection =
m_Yarns[i].GetYarnSection();
731 for (j=0; j<(int)YarnSectionModifiers[i].size(); ++j)
735 Points = pYarnSection->
GetSection(YarnPosInfo, YarnSectionModifiers[i][j].size());
736 for (k=0; k<(int)Points.size(); ++k)
738 Points[k] *= YarnSectionModifiers[i][j][k];
749 for (j=0; j<(int)YarnSectionModifiers[i].size(); ++j)
755 Points = pYarnSection->
GetSection(YarnPosInfo, YarnSectionModifiers[i][j].size());
756 for (k=0; k<(int)Points.size(); ++k)
758 Points[k] *= min(YarnSectionModifiers[i][j][k], YarnSectionModifiers[i][(j+1)%YarnSectionModifiers[i].size()][k]);
766 m_Yarns[i].AssignSection(NewYarnSection);
773 for (i=0; i<(int)
m_XYarns.size(); ++i)
775 for (j=0; j<(int)
m_XYarns[i].size(); ++j)
779 int iNextSection = (iSection+1) %
m_YYarns.size();
784 for (i=0; i<(int)
m_YYarns.size(); ++i)
786 for (j=0; j<(int)
m_YYarns[i].size(); ++j)
790 int iNextSection = (iSection+1) %
m_XYarns.size();
802 TGERROR(
"Unable to set yarn width, index out of range: " << iIndex);
813 TGERROR(
"Unable to set yarn width, index out of range: " << iIndex);
824 TGERROR(
"Unable to set yarn height, index out of range: " << iIndex);
835 TGERROR(
"Unable to set yarn height, index out of range: " << iIndex);
846 TGERROR(
"Unable to set yarn spacing, index out of range: " << iIndex);
857 TGERROR(
"Unable to set yarn spacing, index out of range: " << iIndex);
869 TGERROR(
"Unable to set yarn width, index out of range: " << iIndex);
879 TGERROR(
"Unable to get yarn width, index out of range: " << iIndex);
889 TGERROR(
"Unable to get yarn height, index out of range: " << iIndex);
899 TGERROR(
"Unable to get yarn height, index out of range: " << iIndex);
909 TGERROR(
"Unable to get yarn spacing, index out of range: " << iIndex);
919 TGERROR(
"Unable to get yarn spacing, index out of range: " << iIndex);
929 TGERROR(
"Unable to get yarn spacing, index out of range: " << iIndex);
945 TGERROR(
"Unable to get yarn spacing, index out of range: " << iIndex);
1106 vector<CYarn*> Yarns;
1111 TGERROR(
"Unable to get yarn, index out of range: " << iIndex);
1114 vector<int>::iterator itIndex;
1115 for (itIndex =
m_XYarns[iIndex].begin(); itIndex !=
m_XYarns[iIndex].end(); ++itIndex)
1117 Yarns.push_back(&
m_Yarns[*itIndex]);
1124 vector<CYarn*> Yarns;
1129 TGERROR(
"Unable to get yarn, index out of range: " << iIndex);
1131 vector<int>::iterator itIndex;
1132 for (itIndex =
m_YYarns[iIndex].begin(); itIndex !=
m_YYarns[iIndex].end(); ++itIndex)
1134 Yarns.push_back(&
m_Yarns[*itIndex]);
1141 int iXYarnCount = 0;
1142 int iYYarnCount = 0;
1143 vector<PATTERN2D> Pattern =
GetCell(x, y);
1160 vector<vector<int> > *pTransverseYarns;
1161 vector<vector<int> > *pLongitudinalYarns;
1163 int iLongitudinalNum;
1166 for (iDir=0; iDir<2; ++iDir)
1187 for (
int i = 0; i < iTransverseNum-1; ++i )
1189 CYarn TransverseYarn1 =
m_Yarns[(*pTransverseYarns)[i][0]];
1190 CYarn TransverseYarn2 =
m_Yarns[(*pTransverseYarns)[i+1][0]];
1191 vector<CNode> TransverseNodes1, TransverseNodes2;
1200 for (
int j = 0; j < iLongitudinalNum; ++j )
1204 XYZ Point1 = TransverseNodes1[j].GetPosition();
1205 XYZ Point2 = TransverseNodes2[j].GetPosition();
1207 double dist =
GetLength(Point1, Point2);
1212 double Width1 = YarnSection1->
GetWidth();
1213 double Width2 = YarnSection2->
GetWidth();
1215 double dist2 = 0.5*(Width1+Width2);
1219 CNode Node1 = TransverseNodes1[j];
1220 CNode Node2 = TransverseNodes2[j];
1224 Point1.
x += 0.25 * dist;
1225 Point2.
x -= 0.25 * dist;
1229 Point1.
y += 0.25 * dist;
1230 Point2.
y -= 0.25 * dist;
1236 m_Yarns[(*pTransverseYarns)[i][0]].ReplaceNode( j, Node1 );
1237 m_Yarns[(*pTransverseYarns)[i+1][0]].ReplaceNode(j, Node2 );
1238 YarnSection2->
SetWidth( Width2 + 0.5*dist );
1239 YarnSection1->
SetWidth( Width1 + 0.5*dist );
1241 NewYarnSections1.
AddSection( *YarnSection1 );
1242 NewYarnSections2.
AddSection( *YarnSection2 );
1244 delete YarnSection1;
1245 delete YarnSection2;
1249 m_Yarns[(*pTransverseYarns)[i][0]].AssignSection( NewYarnSections1 );
1250 m_Yarns[(*pTransverseYarns)[i+1][0]].AssignSection( NewYarnSections2 );
1251 delete pYarnSections1;
1252 delete pYarnSections2;
#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.
#define FOR_EACH_TIXMLELEMENT(CHILDELEMENT, PARENTELEMENT, ELEMENTNAME)
Macro to enable looping over tinyxml easier.
Domain implementation described using planes, the simplest of which would be a box.
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 SetPosition(XYZ Position)
void SetWidth(double dWidth)
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.
Abstract base class to create a 2D mesh of a section.
static CObjectContainer< CSectionMesh > CreateSectionMesh(TiXmlElement &Element)
Create a section from TiXmlElement.
Creates a polygonal section, where a list of points are given to form the closed polygon.
A derivation of the CNode class which contains data specific to slave nodes such as sections.
Represents a textile cell containing yarns.
bool BuildTextileIfNeeded() const
Build the textile only if needed.
vector< CYarn > m_Yarns
Vector of yarns contained within this cell.
void AssignDomain(const CDomain &Domain)
Assign a domain to the textile, will be used by default to trim the domain.
string GetName() const
Get the name associated with this textile.
virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType)
Used for saving data to XML.
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.
int GetYarnIndex(int x, int y, int z) const
pair< int, int > GetCellCoordinates(int iIndex) const
double GetXYarnWidths(int iIndex) const
Get the width of the yarn parallel to the X axis, with given index.
void SetResolution(int iResolution)
Set the resolution of the yarns.
virtual void CorrectInterference() const
Adjust cross section shapes to correct interference.
double GetXYarnGapSize(int iIndex) const
Get the gap size between two yarns parallel to the X axis, with given index.
void SetGapSize(double dGapSize)
Set the size of the gap to leave between yarns when correcting interference.
bool NeedsMidSection(int iYarn, int iSection) const
virtual CDomainPlanes GetDefaultDomain(bool bSheared=false, bool bAddedHeight=true)
Get a domain which describes 6 planes triming the textile to a unit cell.
double m_dFabricThickness
void SetYarnWidths(double dWidth)
Set the width of all the yarns in the textile.
bool Valid() const
Check that the weave pattern contained in m_Pattern is valid.
double GetXYarnSpacings(int iIndex) const
Get the spacing of the yarn parallel to the X axis, with given index.
void SetYYarnSpacings(int iIndex, double dSpacing)
Set the spacing of the yarn parallel to the Y axis, with given index.
CObjectContainer< CSectionMesh > m_pSectionMesh
void SetYYarnHeights(int iIndex, double dHeight)
Set the height of the yarn parallel to the Y axis, with given index.
void SetXYarnSpacings(int iIndex, double dSpacing)
Set the spacing of the yarn parallel to the X axis, with given index.
double GetXYarnHeights(int iIndex) const
Get the height of the yarn parallel to the X axis, with given index.
void SetXYarnHeights(int iIndex, double dHeight)
Set the height of the yarn parallel to the X axis, with given index.
void AssignDefaultDomain(bool bSheared=false, bool bAddedHeight=true)
Get the default domain and assign it as the domain.
void CorrectYarnWidths() const
Adjust cross section widths to avoid interference.
double GetHeight() const
Get the height of the unit cell.
vector< vector< PATTERN2D > > m_Pattern
virtual string GetDefaultName() const
Get the default name to assign to a textile.
bool FlattenYarns(double dFlatLevel, int iUpDownBoth=0)
void SetYarnHeights(double dHeight)
Set the height of all the yarns in the textile.
double GetYYarnGapSize(int iIndex) const
Get the gap size between two yarns parallel to the Y axis, with given index.
virtual bool BuildTextile() const
Build the textile.
void SetYarnSpacings(double dSpacing)
Set the spacing of all the yarns in the textile.
void CorrectEdgeInterference()
void SetThickness(double dThickness, bool bAdjustYarnHeights=true)
Set the thickness of the fabric.
const vector< PATTERN2D > & GetCell(int x, int y) const
CTextileWeave(int iNumYYarns, int iNumXYarns, double dSpacing, double dThickness)
Build a weave unit cell of given width, height, yarn spacing and fabric thickness.
virtual ~CTextileWeave(void)
vector< vector< int > > m_XYarns
vector< vector< int > > m_YYarns
void SetYYarnWidths(int iIndex, double dWidth)
Set the width of the yarn parallel to the Y axis, with given index.
double GetYYarnWidths(int iIndex) const
Get the width of the yarn parallel to the Y axis, with given index.
vector< CYarn * > GetXYarns(int iIndex)
double GetAverageYarnWidth() const
virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType)
Used for saving data to XML.
vector< YARNDATA > m_XYarnData
vector< CYarn * > GetYYarns(int iIndex)
double GetWidth() const
Get the width of the unit cell.
double GetYYarnSpacings(int iIndex) const
Get the spacing of the yarn parallel to the Y axis, with given index.
double GetYYarnHeights(int iIndex) const
Get the height of the yarn parallel to the Y axis, with given index.
vector< YARNDATA > m_YYarnData
void SetXYarnWidths(int iIndex, double dWidth)
Set the width of the yarn parallel to the X axis, with given index.
void AssignSectionMesh(const CSectionMesh &SectionMesh)
Assign a section mesh to the weave.
Represents a yarn consisting of master nodes, section and interpolation function.
const CYarnSection * GetYarnSection() const
const vector< CNode > & GetMasterNodes() const
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 CYarnSection * Copy() const =0
This is a function to allow copying of derived classes correctly.
virtual string GetType() const =0
Derived class should return the class name.
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.
vector< XY > GetSection(const YARN_POSITION_INFORMATION PositionInfo, int iNumPoints, bool bEquiSpaced=false) const
This function must be implemented by derived classes.
Namespace containing a series of customised math operations not found in the standard c++ library.
double Max(XYZ &Vector)
Get maximum element of vector and return it.
double GetLength(const XYZ &Point1, const XYZ &Point2)
Get the length between two points.
std::string stringify(const T &x, int iPrecision=12, bool bScientific=true)
Function to convert a value (e.g. int, double, etc...) to a string.
XYZ Min(const XYZ &P1, const XYZ &P2)
Given two points, return a new point who's coordinates are the smaller of the two.
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.
Data structure to keep track of yarn parameters.
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.