24CSectionRectangle::CSectionRectangle(
double dWidth,
double dHeight)
46 Element.Attribute(
"Width", &
m_dWidth);
60 double dLength = t * dTotalLength;
62 if ( dLength <= dPartLength )
67 if ( dLength <= dPartLength )
72 if ( dLength <= dPartLength )
77 if ( dLength <= dPartLength )
81 return XY(
m_dWidth/2.0, -(dTotalLength - dLength) );
94 if ( iNumPoints == 2 )
105 double dAveSpacing = dTotalLength / (iNumPoints-1);
107 int iNumYSpaces = (int)(
m_dHeight / dAveSpacing);
108 if ( ( iNumYSpaces % 2 ) || iNumYSpaces == 0 )
112 double dYSpacing =
m_dHeight/iNumYSpaces;
114 int iNumXSpaces = iNumPoints/2 - iNumYSpaces;
115 double dXSpacing =
m_dWidth/iNumXSpaces;
122 for (
int i=0; i < iNumYSpaces/2; ++i )
124 SectionPoint.
y += dYSpacing;
128 for (
int i = 0; i < iNumXSpaces; ++i )
130 SectionPoint.
x -= dXSpacing;
134 for (
int i = 0; i < iNumYSpaces; ++i )
136 SectionPoint.
y -= dYSpacing;
140 for (
int i = 0; i < iNumXSpaces; ++i )
142 SectionPoint.
x += dXSpacing;
146 for (
int i = 0; i < (iNumYSpaces/2)-1; ++i )
148 SectionPoint.
y += dYSpacing;
Abstract base class respresenting a yarn cross-section.
virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const
Used for saving data to XML.
vector< XY > m_EdgePoints
List of 2d points creating the outline of the cross-section.
virtual string GetType() const =0
Derived class should return the class name.
CObjectContainer< CSectionMesh > m_pSectionMesh
Pointer to a derived class of SectionMesh, this class is in charge of creating the section mesh.
Create a rectangular mesh, the number of layers can be specified or set as -1 for automatic determina...
CSectionRectangle(double dWidth, double dHeight)
string GetType() const
Derived class should return the class name.
void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const
Used for saving data to XML.
virtual const vector< XY > & GetPoints(int iNumPoints, bool bEquiSpaced=false) const
Get a section with given number of points on the perimeter.
bool operator==(const CSection &CompareMe) const
Overloaded equality operator to determine if two sections are the same.
XY GetPoint(double t) const
Get a point lying on the perimeter correspending to parametric value t.
string GetDefaultName() const
Get the default name to assign to a section.
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.