24CSectionLenticular::CSectionLenticular(
double dWidth,
double dHeight,
double dDistortion)
27, m_dDistortion(dDistortion)
30 TGERROR(
"Warning: Lenticular section has greater height than width");
31 if (abs(dDistortion) > 0.5*dHeight+1e-9)
32 TGERROR(
"Warning: Lenticular section distortion is greater than half the height");
56 if (Element.Attribute(
"Radius") && Element.Attribute(
"Offset"))
58 double dRadius, dOffset;
59 Element.Attribute(
"Radius", &dRadius);
60 Element.Attribute(
"Offset", &dOffset);
61 m_dWidth = 2*sqrt(dRadius*dRadius-dOffset*dOffset);
67 Element.Attribute(
"Width", &
m_dWidth);
112 dMaxAngle = asin(0.5*
m_dWidth/dRadius);
116 dAngle = (1-4*t)*dMaxAngle;
117 Point.
x = dRadius*sin(dAngle);
118 Point.
y = dRadius*cos(dAngle)-dO;
122 dAngle = (-3+4*t)*dMaxAngle;
123 Point.
x = dRadius*sin(dAngle);
124 Point.
y = -(dRadius*cos(dAngle)-dO);
#define TGERROR(MESSAGE)
Macros used to report the file name and line number to the TexGenError and TexGenLog functions.
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.
void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType) const
Used for saving data to XML.
CSectionLenticular(double dWidth, double dHeight, double dDistortion=0)
string GetType() const
Derived class should return the class name.
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.
bool operator==(const CSection &CompareMe) const
Overloaded equality operator to determine if two sections are the same.
~CSectionLenticular(void)
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.