24CTextileWeave3D::CTextileWeave3D(
int iWidth,
int iHeight,
double dSpacing,
double dThickness)
53 TGERROR(
"Unable to add yarn layer, index out of range: " << x);
59 for (j=0; j<iNumberLayers; ++j)
69 TGERROR(
"Unable to add yarn layer, index out of range: " << y);
75 for (j=0; j<iNumberLayers; ++j)
103 TGERROR(
"Unable to delete yarn layer, index out of range: " << x);
107 vector<bool>::reverse_iterator itCell;
110 for (j=0; j<iNumberLayers; ++j)
112 vector<bool> &Cell =
GetCell(x, i);
113 itCell = find(Cell.rbegin(), Cell.rend(), (
bool)
PATTERN_YYARN);
114 if (itCell != Cell.rend())
116 Cell.erase(itCell.base()-1);
127 TGERROR(
"Unable to delete yarn layer, index out of range: " << y);
131 vector<bool>::reverse_iterator itCell;
134 for (j=0; j<iNumberLayers; ++j)
136 vector<bool> &Cell =
GetCell(i, y);
137 itCell = find(Cell.rbegin(), Cell.rend(), (
bool)
PATTERN_XYARN);
138 if (itCell != Cell.rend())
140 Cell.erase(itCell.base()-1);
167 const vector<bool> &Cell =
GetCell(x, 0);
173 const vector<bool> &Cell =
GetCell(0, y);
185 iMaxLayers = max(iMaxLayers, (
int)
GetCell(i, j).size());
195 TGERROR(
"Unable to push down, index out of range: " << x <<
", " << y);
198 vector<bool> &Cell =
GetCell(x, y);
200 for (i=0; i<iLevels; ++i)
202 bool bBottom = *Cell.begin();
203 Cell.erase(Cell.begin());
204 Cell.push_back(bBottom);
213 TGERROR(
"Unable to push up, index out of range: " << x <<
", " << y);
216 vector<bool> &Cell =
GetCell(x, y);
218 vector<bool>::iterator itTop;
219 for (i=0; i<iLevels; ++i)
221 bool bTop = Cell[Cell.size()-1];
223 Cell.insert(Cell.begin(), bTop);
268 TGERROR(
"Unable to swap position, index out of range: " << x <<
", " << y);
271 vector<bool> &Cell =
GetCell(x, y);
272 if (iLevel1 < 0 || iLevel1 >= (
int)Cell.size())
274 TGERROR(
"Unable to swap position, level out of range: " << iLevel1);
277 if (iLevel2 < 0 || iLevel2 >= (
int)Cell.size())
279 TGERROR(
"Unable to swap position, level out of range: " << iLevel2);
283 bTemp = Cell[iLevel1];
284 Cell[iLevel1] = Cell[iLevel2];
285 Cell[iLevel2] = bTemp;
#define TGERROR(MESSAGE)
Macros used to report the file name and line number to the TexGenError and TexGenLog functions.
bool m_bNeedsBuilding
Variable which keeps track of wether the textile needs building or not.
int GetNumXLayers(int y) const
Retreive the number of yarns parallel to the X axis, with given index y.
void PushYUp(int x, int iLevels=1)
Push up all yarns parallel to the Y axis in the pattern by given number of levels with given index x.
void DeleteYLayers(int x, int iNumberLayers)
Delete given number of yarns parallel to the Y axis, with given index x.
void SwapPosition(int x, int y, int iLevel1, int iLevel2)
Swap the positions of two yarns in the patter with given index x, y and level iLevel1,...
int GetMaxNumLayers() const
Retreive the maximum number of layers at any crossover.
CTextileWeave3D(int iWidth, int iHeight, double dSpacing, double dThickness)
void PushXDown(int y, int iLevels=1)
Push down all yarns parallel to the X axis in the pattern by given number of levels with given index ...
void PushDown(int x, int y, int iLevels=1)
Push down all yarns in the pattern by given number of levels with given index x, y.
void DeleteXLayers(int y, int iNumberLayers)
Delete given number of yarns parallel to the X axis, with given index y.
void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType)
Used for saving data to XML.
void AddYLayers(int x, int iNumberLayers)
Add given number of yarns parallel to the Y axis, with given index x.
void PushYDown(int x, int iLevels=1)
Push down all yarns parallel to the Y axis in the pattern by given number of levels with given index ...
void PushXUp(int y, int iLevels=1)
Push up all yarns parallel to the X axis in the pattern by given number of levels with given index y.
void PushUp(int x, int y, int iLevels=1)
Push up all yarns in the pattern by given number of levels with given index x, y.
string GetDefaultName() const
Get the default name to assign to a textile.
void AddXLayers(int y, int iNumberLayers)
Add given number of yarns parallel to the X axis, with given index y.
int GetNumYLayers(int x) const
Retreive the number of yarns parallel to the Y axis, with given index x.
Represents a woven textile.
const vector< PATTERN2D > & GetCell(int x, int y) const
virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType)
Used for saving data to XML.
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.