26CSectionHybrid::CSectionHybrid(
void)
70 pDivision->Attribute(
"Value", &dVal);
86 TiXmlElement Division(
"Division");
88 Element.InsertEndChild(Division);
92 TiXmlElement Section(
"Section");
93 m_Sections[i]->PopulateTiXmlElement(Section, OutputType);
94 Element.InsertEndChild(Section);
107 if (iIndex < 0 || iIndex >= (
int)
m_Sections.size())
109 TGERROR(
"Unable to assign section, index invalid: " << iIndex);
118 vector<double>::const_iterator itDiv;
134 double angle = rotSection->
GetAngle();
135 double t_angle = t*2*
PI;
136 double new_angle = t_angle - angle;
137 if ( new_angle < 0.0 )
139 t = new_angle / (2*
PI);
153 assert(iIndex>=0 && iIndex<(
int)
m_Divisions.size());
159 assert(iIndex>=0 && iIndex<(
int)
m_Sections.size());
#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.
Abstract base class respresenting a yarn cross-section.
virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const
Used for saving data to XML.
static CObjectContainer< CSection > CreateSection(TiXmlElement &Element)
Create a section from TiXmlElement.
virtual string GetType() const =0
Derived class should return the class name.
Hybrid of any number of other sections.
XY GetPoint(double t) const
Get a point lying on the perimeter correspending to parametric value t.
vector< CObjectContainer< CSection > > m_Sections
void AddDivision(double dFraction)
Add a division where the sections will transfer from one to the other.
bool operator==(const CSection &CompareMe) const
Overloaded equality operator to determine if two sections are the same.
CSection * Copy() const
Create a copy of the derived section and return a pointer to the newly created instance.
string GetType() const
Derived class should return the class name.
vector< double > m_Divisions
string GetDefaultName() const
Get the default name to assign to a section.
void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const
Used for saving data to XML.
const CSection & GetSection(int iIndex) const
bool AssignSection(int iIndex, const CSection &Section)
Assign a section between divisions.
CSectionHybrid(void)
Empty hybrid section, parts can be added with the AddDivision and AssignSection functions.
double GetDivision(int iIndex) const
Section which represents a rotation of another section angle given in radians.
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.
Struct for representing points in 2D space.