24CYarnSectionInterp::CYarnSectionInterp(
bool bRamped,
bool bPolar,
bool bConstMesh)
38 m_bRamped = valueify<bool>(Element.Attribute(
"Ramped"));
39 m_bPolar = valueify<bool>(Element.Attribute(
"Polar"));
53 const vector<XY> &Points1 = Section1.
GetPoints(iNumPoints, bEquiSpaced);
54 const vector<XY> &Points2 = Section2.
GetPoints(iNumPoints, bEquiSpaced);
59 for (i=0; i<iNumPoints; ++i)
76 const CMesh &Mesh1 = Section1.
GetMesh(iNumPoints, bEquiSpaced);
77 const CMesh &Mesh2 = Section2.
GetMesh(iNumPoints, bEquiSpaced);
97 XY InterpedPoint, P1, P2;
120 u = 3 * u * u - 2 * u * u * u;
128 a1 = atan2(P1.
y, P1.
x);
129 a2 = atan2(P2.
y, P2.
x);
153 p2 = Section[Section.size()/2];
155 double dAngle = atan2( dp.
y, dp.
x );
157 vector<XY> RotatedSection;
158 for (
int i = 1; i <= (int)Section.size()/4+1; ++i )
161 RotPoint.
x = Section[i].x*cos(dAngle) + Section[i].y*sin(dAngle);
162 RotPoint.
y = Section[i].y*cos(dAngle) - Section[i].x*sin(dAngle);
163 RotatedSection.push_back(RotPoint);
170 vector<XY>::iterator itRotatedSection;
172 for ( i = 0; i < (int)RotatedSection.size()-1; ++i )
174 P1 = RotatedSection[i];
175 P2 = RotatedSection[i+1];
177 if (abs(DP.
x) > abs(DP.
y))
#define TGERROR(MESSAGE)
Macros used to report the file name and line number to the TexGenError and TexGenLog functions.
Defines the nodes and elements of a surface or volume mesh.
const int AddNode(XYZ Node)
Append a node to the list of nodes, the integer returns the index of the node
const XYZ & GetNode(int iIndex) const
Get the node with given ID.
static int GetNumNodes(ELEMENT_TYPE Type)
Get the number of nodes a particular element type contains.
const list< int > & GetIndices(ELEMENT_TYPE ElemType) const
Get the element indices of a given element type.
ELEMENT_TYPE
Each element type is represented by a unique integer value.
void Clear()
Empty mesh nodes and indices.
Abstract base class respresenting a yarn cross-section.
const CMesh & GetMesh(int iNumPoints, bool bEquiSpaced=true) const
virtual string GetDefaultName() const =0
Get the default name to assign to a section.
virtual const vector< XY > & GetPoints(int iNumPoints, bool bEquiSpaced=false) const
Get a section with given number of points on the perimeter.
Abstract base class used to define the sections along the length of a yarn.
virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const
Used for saving data to XML.
XY InterpolatePoints(XY P1, XY P2, double u) const
virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const
Used for saving data to XML.
int CalculateNumberofLayers(const vector< XY > &Section) const
virtual ~CYarnSectionInterp(void)
CYarnSectionInterp(bool bRamped, bool bPolar, bool bConstMesh=true)
bool GetInterpedSection(const CSection &Section1, const CSection &Section2, double u, int iNumPoints, bool bEquiSpaced, vector< XY > &Points) const
bool GetInterpedSectionMesh(const CSection &Section1, const CSection &Section2, double u, int iNumPoints, bool bEquiSpaced, CMesh &Mesh) const
Namespace containing a series of customised math operations not found in the standard c++ library.
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.
Struct for representing points in 2D space.
Struct for representing points in 3D space.