24CSectionBezier::CSectionBezier(
const vector<XY> &BezierPoints,
bool bSingleQuadrant)
25: m_BezierPoints(BezierPoints)
31 TGERROR(
"Unable to create bezier section, number of points must be multiple of 3");
39 TGERROR(
"Unable to create bezier section, number of points-1 must be multiple of 3");
43 vector<XY>::const_iterator itPoint;
46 for (itPoint = BezierPoints.end()-2; itPoint != BezierPoints.begin(); --itPoint)
53 for (itPoint = BezierPoints.begin(); itPoint != BezierPoints.end(); ++itPoint)
61 for (itPoint = BezierPoints.end()-2; itPoint != BezierPoints.begin(); --itPoint)
86 m_BezierPoints.push_back(valueify<XY>(pPoint->Attribute(
"value")));
93 vector<XY>::const_iterator itPoint;
96 TiXmlElement Point(
"BezierPoint");
97 Point.SetAttribute(
"value",
stringify(*itPoint));
98 Element.InsertEndChild(Point);
108 if (iIndex >= iNumSections)
110 iIndex = iNumSections-1;
#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.
Section made up of bezier curves.
CSectionBezier(const vector< XY > &BezierPoints, bool bSingleQuadrant=false)
The number of points given must be a multiple of 3.
vector< XY > m_BezierPoints
bool operator==(const CSection &CompareMe) const
Overloaded equality operator to determine if two sections are the same.
void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const
Used for saving data to XML.
string GetDefaultName() const
Get the default name to assign to a section.
XY GetPoint(double t) const
Get a point lying on the perimeter correspending to parametric value t.
string GetType() const
Derived class should return the class name.
Abstract base class respresenting a yarn cross-section.
virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const
Used for saving data to XML.
virtual string GetType() const =0
Derived class should return the class name.
Namespace containing a series of customised math operations not found in the standard c++ library.
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.
T CalculateBezierPoint(T p1, T p2, T p3, T p4, double mu)
Struct for representing points in 2D space.