TexGen
TextileOffsetAngleInterlock.cpp
Go to the documentation of this file.
1/*=============================================================================
2TexGen: Geometric textile modeller.
3Copyright (C) 2011 Louise Brown
4
5This program is free software; you can redistribute it and/or
6modify it under the terms of the GNU General Public License
7as published by the Free Software Foundation; either version 2
8of the License, or (at your option) any later version.
9
10This program is distributed in the hope that it will be useful,
11but WITHOUT ANY WARRANTY; without even the implied warranty of
12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18=============================================================================*/
19
20#include "PrecompiledHeaders.h"
22
23
24using namespace TexGen;
25
26CTextileOffsetAngleInterlock::CTextileOffsetAngleInterlock(int iNumXYarns, int iNumYYarns, double dXSpacing, double dYSpacing, double dXHeight, double dYHeight)
27: CTextile3DWeave( iNumXYarns, iNumYYarns*2, dXSpacing, dYSpacing, dXHeight, dYHeight)
28{
29}
30
32: CTextile3DWeave(Element)
33{
34}
35
37{
38}
39
41{
42 CTextile3DWeave::PopulateTiXmlElement(Element, OutputType);
43}
44
46{
47 if (x<0 || x>=m_iNumYYarns || y<0 || y>=m_iNumXYarns)
48 {
49 TGERROR("Unable to set binder position, index out of range: " << x << ", " << y);
50 return;
51 }
52
53 if ( x % 2 )
54 {
55 TGERROR("Binder positions may only be set on top layer yarns");
56 return;
57 }
58 vector<PATTERN3D> &Cell = GetCell(x, y);
59 int size = (int)Cell.size();
60 SetBinderPosition( size-1, Cell );
61 int BinderPos = (size-1) - 1;
62
63 for ( int i = 1; i <= m_iNumYYarns/2; ++i )
64 {
65 vector<PATTERN3D> &Cell = GetCell( (i+x)%m_iNumYYarns, y );
66 SetBinderPosition( BinderPos, Cell );
67 if ( BinderPos > 0 )
68 {
69 vector<PATTERN3D> &Cell = GetCell( (m_iNumYYarns-i+x)%m_iNumYYarns, y );
70 SetBinderPosition( BinderPos, Cell );
71 }
72 BinderPos -= 2;
73 if (BinderPos < 0 )
74 BinderPos = 0;
75 }
76
77 m_bNeedsBuilding = true;
78}
79
80void CTextileOffsetAngleInterlock::SetBinderPosition( int z, vector<PATTERN3D>& Cell )
81{
82 int size = (int)Cell.size();
83 for ( int j = 0; j < size; j++ )
84 {
85 if ( j == z )
86 {
87 Cell[j] = PATTERN3D_XYARN;
88 }
89 else if ( Cell[j] != PATTERN3D_YYARN )
90 {
91 Cell[j] = PATTERN3D_NOYARN;
92 }
93 }
94}
95
97{
98 for ( int i=0; i < m_iNumYYarns; ++i )
99 {
100 if ( bOffset )
101 {
103 ++i;
105 }
106 else
107 {
109 ++i;
111 }
112 }
113}
114
115void CTextileOffsetAngleInterlock::FindMinMaxZ( double &dMinZ, double &dMaxZ )
116{
117 dMinZ = dMaxZ = 0.0;
118 for (int i=0; i<m_iNumXYarns; ++i)
119 {
120 for (int j=0; j<=m_iNumYYarns; ++j)
121 {
122 const vector<PATTERN3D> &Cell = GetCell(j%m_iNumYYarns, i);
123
124 int NextYCellIndex, NextXCellIndex;
125 NextYCellIndex = (j+1)%m_iNumYYarns;
126
127 const vector<PATTERN3D> &NextYCell = GetCell(NextYCellIndex, i%m_iNumXYarns );
128 NextXCellIndex = FindNextCellIndex(i);
129
130 double z = 0.0;
131 for (int k=0; k<(int)Cell.size(); ++k)
132 {
133 if (Cell[k] == PATTERN3D_XYARN)
134 {
135 double dHalfHeight = m_XYarnData[i].dHeight / 2.0;
136 if ( k == 0 && IsBinderYarn(i) )
137 {
138 z -= dHalfHeight + m_dGapSize;
139 if ( (z - dHalfHeight) < dMinZ )
140 dMinZ = z - dHalfHeight;
141 }
142 else
143 z += dHalfHeight;
144
145 z += dHalfHeight + m_dGapSize;
146
147 }
148 else if ( Cell[k] == PATTERN3D_YYARN )
149 {
150 z += m_YYarnData[j%m_iNumYYarns].dHeight + m_dGapSize;
151 }
152 else if ( k > 0 )// PATTERN3D_NOYARN and not on bottom binder layer
153 {
154
155 if ( NextYCell[k] == PATTERN3D_XYARN )
156 {
157 z += m_XYarnData[i].dHeight + m_dGapSize;
158 }
159 else if ( NextYCell[k] == PATTERN3D_YYARN )
160 {
161 z += m_YYarnData[NextYCellIndex].dHeight + m_dGapSize;
162 }
163 else // PATTERN3D_NOYARN
164 {
165 if ( k != (int)Cell.size()-1 ) // If top binder layer don't want to add x yarn thickness
166 z += m_XYarnData[NextXCellIndex].dHeight + m_dGapSize;
167 }
168 }
169 if ( z > dMaxZ )
170 dMaxZ = z;
171 }
172 }
173 }
174}
175
176void CTextileOffsetAngleInterlock::SetupLayers( int iNumWarpLayers, int iNumWeftLayers, int iNumBinderLayers )
177{
178 if ( iNumWarpLayers != iNumWeftLayers-1 )
179 {
180 TGERROR("Unable to set up layers, number of warp layers should be one less than weft layers: warp layers " << iNumWarpLayers << ", weft layers " << iNumWeftLayers);
181 return;
182 }
184
185 // Add alternating layers
186 while( iNumWeftLayers > 0 )
187 {
188 AddYLayer( iNumWeftLayers % 2 ? 0 : 1 ); // Offset even layers
189 if ( iNumWarpLayers > 0 )
190 {
191 AddWarpLayer();
192 iNumWarpLayers--;
193 }
194 iNumWeftLayers--;
195 }
196
198}
199
201{
202 m_Yarns.clear();
203 m_YYarns.clear();
204 m_XYarns.clear();
205
206 m_YYarns.resize(m_iNumYYarns);
207 m_XYarns.resize(m_iNumXYarns);
208
209 m_dMinZ = 0.0;
210 m_dMaxZ = 0.0;
211
212 if (!Valid())
213 return false;
214
215 TGLOGINDENT("Building textile weave \"" << GetName() << "\"");
216 m_bNeedsBuilding = false;
217
218 vector<int> Yarns;
219
220 double x, y, z;
221
222 // Add x yarns (yarns parallel to the x axis)
223 int i, j, k, iYarn;
224 y = 0;
225 for (i=0; i<m_iNumXYarns; ++i)
226 {
227 y += m_XYarnData[i].dSpacing/2.0;
228 x = 0;
229 Yarns.clear();
230 for (j=0; j<=m_iNumYYarns; ++j)
231 {
232 const vector<PATTERN3D> &Cell = GetCell(j%m_iNumYYarns, i);
233
234 int NextYCellIndex, NextXCellIndex;
235 NextYCellIndex = (j+1)%m_iNumYYarns;
236
237 const vector<PATTERN3D> &NextYCell = GetCell(NextYCellIndex, i%m_iNumXYarns );
238 NextXCellIndex = FindNextCellIndex(i);
239
240 if (j==0)
241 {
242 for (k=0; k<(int)Cell.size(); ++k)
243 {
244 if (Cell[k] == PATTERN3D_XYARN)
245 {
246 Yarns.push_back(AddYarn(CYarn()));
247 }
248 }
249 }
250 m_XYarns[i] = Yarns;
251 iYarn = 0;
252
253 x += m_YYarnData[j%m_iNumYYarns].dSpacing/2.0;
254
255 z = 0.0;
256 for (k=0; k<(int)Cell.size(); ++k)
257 {
258 if (Cell[k] == PATTERN3D_XYARN)
259 {
260 double dHalfHeight = m_XYarnData[i].dHeight / 2.0;
261 if ( k == 0 && IsBinderYarn(i) ) // Bottom binder yarn
262 {
263 z -= dHalfHeight + m_dGapSize;
264 if ( (z - dHalfHeight) < m_dMinZ )
265 m_dMinZ = z - dHalfHeight;
266 }
267 else if ( k < (int)Cell.size()-1 && IsBinderYarn(i) ) // Binder yarn within mid-textile
268 {
269 dHalfHeight = m_YYarnData[NextYCellIndex].dHeight / 2.0;
270 z += dHalfHeight;
271 }
272 else
273 z += dHalfHeight;
274 m_Yarns[Yarns[iYarn]].AddNode(CNode(XYZ(x, y, z)));
275 ++iYarn;
276 z += dHalfHeight + m_dGapSize;
277 if ( z > m_dMaxZ )
278 m_dMaxZ = z;
279 }
280 else if ( Cell[k] == PATTERN3D_YYARN )
281 {
282 z += m_YYarnData[j%m_iNumYYarns].dHeight + m_dGapSize;
283 }
284 else if ( k > 0 )// PATTERN3D_NOYARN and not on bottom binder layer
285 {
286 if ( NextYCell[k] == PATTERN3D_XYARN )
287 {
288 z += m_XYarnData[i].dHeight + m_dGapSize;
289 }
290 else if ( NextYCell[k] == PATTERN3D_YYARN )
291 {
292 z += m_YYarnData[NextYCellIndex].dHeight + m_dGapSize;
293 }
294 else // PATTERN3D_NOYARN
295 {
296 z += m_XYarnData[NextXCellIndex].dHeight + m_dGapSize;
297 }
298 }
299 }
300 }
301 y += m_XYarnData[i].dSpacing/2.0;
302 }
303
304 // Add y yarns (yarns parallel to the y axis)
305 x = 0;
306 for (j=0; j<m_iNumYYarns; ++j)
307 {
308 y = 0;
309 Yarns.clear();
310 x += m_YYarnData[j].dSpacing/2.0;
311 for (i=0; i<=m_iNumXYarns; ++i)
312 {
313 const vector<PATTERN3D> &Cell = GetCell(j, i%m_iNumXYarns);
314
315 int NextYCellIndex, NextXCellIndex;
316 NextYCellIndex = (j+1)%m_iNumYYarns;
317
318 const vector<PATTERN3D> &NextYCell = GetCell(NextYCellIndex, i%m_iNumXYarns );
319 NextXCellIndex = FindNextCellIndex(i);
320
321 if (i==0)
322 {
323 for (k=0; k<(int)Cell.size(); ++k)
324 {
325 if (Cell[k] == PATTERN3D_YYARN)
326 {
327 Yarns.push_back(AddYarn(CYarn()));
328 }
329 }
330 }
331 m_YYarns[j] = Yarns;
332 iYarn = 0;
333 y += m_XYarnData[i%m_iNumXYarns].dSpacing/2.0;
334 z = 0.0;
335 //z = m_dFabricThickness/(2*Cell.size());
336 for (k=0; k<(int)Cell.size(); ++k)
337 {
338 if (Cell[k] == PATTERN3D_YYARN)
339 {
340 double dHalfHeight = m_YYarnData[j].dHeight / 2.0;
341 z += dHalfHeight;
342 m_Yarns[Yarns[iYarn]].AddNode(CNode(XYZ(x, y, z)));
343 ++iYarn;
344 z += dHalfHeight + m_dGapSize;
345 }
346 else if ( Cell[k] == PATTERN3D_XYARN && k > 0 ) // Don't adjust z if it's the bottom binder yarn
347 {
348 if ( k < (int)Cell.size()-1 && IsBinderYarn(i%m_iNumXYarns) ) // If binder yarn want to add height of surrounding weft yarns
349 {
350 z += m_YYarnData[NextYCellIndex].dHeight + m_dGapSize;
351 }
352 else
353 {
354 z += m_XYarnData[i%m_iNumXYarns].dHeight + m_dGapSize;
355 }
356 }
357 else if ( k > 0 ) // PATTERN3D_NOYARN and not on bottom binder layer
358 {
359 if ( NextYCell[k] == PATTERN3D_XYARN )
360 {
361 z += m_XYarnData[i%m_iNumXYarns].dHeight + m_dGapSize;
362 }
363 else if ( NextYCell[k] == PATTERN3D_YYARN )
364 {
365 z += m_YYarnData[NextYCellIndex].dHeight + m_dGapSize;
366 }
367 else // PATTERN3D_NOYARN
368 {
369 z += m_XYarnData[NextXCellIndex%m_iNumXYarns].dHeight + m_dGapSize;
370 }
371 }
372 }
373 if (i<m_iNumXYarns)
374 y += m_XYarnData[i].dSpacing/2.0;
375 }
376 }
377
378 // Assign sections to the yarns
379 vector<int>::iterator itpYarn;
380 double dWidth, dHeight;
381 for (i=0; i<m_iNumXYarns; ++i)
382 {
383 dWidth = m_XYarnData[i].dWidth;
384 dHeight = m_XYarnData[i].dHeight;
385 //CSectionEllipse Section(dWidth, dHeight);
386 CSectionPowerEllipse Section(dWidth, dHeight, IsBinderYarn(i) ? m_dBinderPower : m_dWarpPower );
387 if (m_pSectionMesh)
389 for (itpYarn = m_XYarns[i].begin(); itpYarn != m_XYarns[i].end(); ++itpYarn)
390 {
391 m_Yarns[*itpYarn].AssignSection(CYarnSectionConstant(Section));
392 }
393 }
394 for (i=0; i<m_iNumYYarns; ++i)
395 {
396 dWidth = m_YYarnData[i].dWidth;
397 dHeight = m_YYarnData[i].dHeight;
398 //CSectionEllipse Section(dWidth, dHeight);
399 CSectionPowerEllipse Section(dWidth, dHeight, m_dWeftPower );
400 if (m_pSectionMesh)
402 for (itpYarn = m_YYarns[i].begin(); itpYarn != m_YYarns[i].end(); ++itpYarn)
403 {
404 m_Yarns[*itpYarn].AssignSection(CYarnSectionConstant(Section));
405 }
406 }
407
409 // Add repeats and set interpolation
410 dWidth = GetWidth();
411 dHeight = GetHeight();
412 vector<CYarn>::iterator itYarn;
413 for (itYarn = m_Yarns.begin(); itYarn != m_Yarns.end(); ++itYarn)
414 {
415 itYarn->AssignInterpolation(CInterpolationBezier());
416 itYarn->SetResolution(m_iResolution);
417 itYarn->AddRepeat(XYZ(dWidth, 0, 0));
418 itYarn->AddRepeat(XYZ(0, dHeight, 0));
419 }
420
421 return true;
422}
423
425{
426 for ( int j = 0; j < m_iNumXYarns; ++j )
427 {
428 if ( IsBinderYarn( j ) )
429 {
430 int CurrentNode = 0;
431 for ( int i = 0; i < m_iNumYYarns; ++i )
432 {
433 CurrentNode = AddBinderNodes( CurrentNode, i, j );
434 CurrentNode++;
435 }
437 }
438 }
439}
440
441int CTextileOffsetAngleInterlock::AddBinderNodes( int CurrentNode, int i, int j ) const
442{
443 const vector<PATTERN3D> &Cell = GetCell(i,j);
444
445 int iMaxIndex = (int)Cell.size() - 1;
446 XY SectionPoint;
447
448 if ( iMaxIndex < 1 )
449 return CurrentNode;
450
451 double dBinderOffset = m_XYarnData[j].dHeight/2.0;
452
453 if ( Cell[iMaxIndex] == PATTERN3D_XYARN && Cell[iMaxIndex-1] == PATTERN3D_YYARN ) // Binder yarn at top and yarn underneath is weft yarn
454 {
455 int BinderYarnIndex = GetYarnIndex( i, j, iMaxIndex );
456 int WeftYarnIndex = GetYarnIndex( i, j, iMaxIndex-1 );
457
458 if ( BinderYarnIndex == -1 || WeftYarnIndex == -1 )
459 return CurrentNode;
460
461 XYZ WeftNode = m_Yarns[WeftYarnIndex].GetNode( j )->GetPosition();
462 XYZ BinderNode = m_Yarns[BinderYarnIndex].GetNode( CurrentNode )->GetPosition();
463
464 // Get cross section of weft yarn
465 CSectionPowerEllipse* YarnSection = GetWeftCrossSection( WeftYarnIndex );
466 if ( YarnSection == NULL )
467 return CurrentNode;
468
469 // Insert points around Top left quadrant of weft yarn
470 {
471 XYZ NewNode = WeftNode;
472
473 SectionPoint = YarnSection->GetPoint(0.45);
474 NewNode.x = NewNode.x + SectionPoint.x;
475 NewNode.z = NewNode.z + SectionPoint.y + dBinderOffset + m_dGapSize;
476
477 m_Yarns[BinderYarnIndex].InsertNode( NewNode, CurrentNode);
478
479 if ( CurrentNode == 0 ) // Change last node to match start
480 {
481 ReplaceLastNode( BinderYarnIndex, NewNode, BinderNode );
482 }
483 CurrentNode++;
484
485 InsertBinderNode( YarnSection, 0.4, WeftNode, CurrentNode, BinderYarnIndex, dBinderOffset + m_dGapSize );
486 InsertBinderNode( YarnSection, 0.35, WeftNode, CurrentNode, BinderYarnIndex, dBinderOffset + m_dGapSize );
487 InsertBinderNode( YarnSection, 0.3, WeftNode, CurrentNode, BinderYarnIndex, dBinderOffset + m_dGapSize );
488 }
489
490 // Insert points around upper right quadrant of weft
491 {
492 XYZ NewNode = WeftNode;
493 CurrentNode++; // Need to insert after node (ie before next node)
494 InsertBinderNode( YarnSection, 0.2, WeftNode, CurrentNode, BinderYarnIndex, dBinderOffset + m_dGapSize );
495 InsertBinderNode( YarnSection, 0.15, WeftNode, CurrentNode, BinderYarnIndex, dBinderOffset + m_dGapSize );
496 InsertBinderNode( YarnSection, 0.1, WeftNode, CurrentNode, BinderYarnIndex, dBinderOffset + m_dGapSize );
497 InsertBinderNode( YarnSection, 0.05, WeftNode, CurrentNode, BinderYarnIndex, dBinderOffset + m_dGapSize );
498 CurrentNode--;
499 }
500 delete YarnSection;
501 }
502 else if ( Cell[0] == PATTERN3D_XYARN && Cell[1] == PATTERN3D_YYARN ) // Binder yarn at bottom and yarn above is weft yarn
503 {
504 int BinderYarnIndex = GetYarnIndex( i, j, 0 );
505 int WeftYarnIndex = GetYarnIndex( i, j, 1 );
506
507 if ( BinderYarnIndex == -1 || WeftYarnIndex == -1 )
508 return CurrentNode;
509
510 // Get cross section of weft yarn
511 CSectionPowerEllipse* YarnSection = GetWeftCrossSection( WeftYarnIndex );
512 if ( YarnSection == NULL )
513 return CurrentNode;
514
515 XYZ WeftNode = m_Yarns[WeftYarnIndex].GetNode( j )->GetPosition();
516 XYZ BinderNode = m_Yarns[BinderYarnIndex].GetNode( CurrentNode )->GetPosition();
517
518 // Insert points around lower left quadrant of weft yarn
519 {
520 XYZ NewNode = WeftNode;
521 SectionPoint = YarnSection->GetPoint(0.55);
522 NewNode.x = NewNode.x + SectionPoint.x;
523 NewNode.z = NewNode.z + SectionPoint.y - dBinderOffset - m_dGapSize;
524 m_Yarns[BinderYarnIndex].InsertNode( NewNode, CurrentNode);
525
526 if ( CurrentNode == 0 ) // Change last node to match start
527 {
528 ReplaceLastNode( BinderYarnIndex, NewNode, BinderNode );
529 }
530 CurrentNode++;
531
532 NewNode = WeftNode;
533 InsertBinderNode( YarnSection, 0.6, WeftNode, CurrentNode, BinderYarnIndex, -(dBinderOffset + m_dGapSize) );
534 InsertBinderNode( YarnSection, 0.65, WeftNode, CurrentNode, BinderYarnIndex, -(dBinderOffset + m_dGapSize) );
535 InsertBinderNode( YarnSection, 0.7, WeftNode, CurrentNode, BinderYarnIndex, -(dBinderOffset + m_dGapSize) );
536 }
537
538 // Insert points around lower right quadrant of weft yarn
539 {
540 XYZ NewNode = WeftNode;
541 CurrentNode++; // Need to insert after node (ie before next node)
542 InsertBinderNode( YarnSection, 0.8, WeftNode, CurrentNode, BinderYarnIndex, -(dBinderOffset + m_dGapSize) );
543 InsertBinderNode( YarnSection, 0.85, WeftNode, CurrentNode, BinderYarnIndex, -(dBinderOffset + m_dGapSize) );
544 InsertBinderNode( YarnSection, 0.9, WeftNode, CurrentNode, BinderYarnIndex, -(dBinderOffset + m_dGapSize) );
545 InsertBinderNode( YarnSection, 0.95, WeftNode, CurrentNode, BinderYarnIndex, -(dBinderOffset + m_dGapSize) );
546 //InsertBinderNode( YarnSection, 0.98, WeftNode, CurrentNode, BinderYarnIndex, -(dBinderOffset + m_dGapSize) );
547 CurrentNode--;
548 }
549 delete YarnSection;
550 }
551 return CurrentNode;
552}
553
554int CTextileOffsetAngleInterlock::FindBinderHeight( const vector<PATTERN3D>& Cell ) const
555{
556 int i = (int)Cell.size() - 1;
557 while( i > 0 )
558 {
559 if ( Cell[i] == PATTERN3D_XYARN )
560 return i;
561 --i;
562 }
563 return i;
564}
565
567{
568 double dWidth = 0;
569
570 int i;
571
572 for (i=0; i<m_iNumYYarns; ++i)
573 {
574 dWidth += m_YYarnData[i].dSpacing/2.0;
575 }
576
577 return dWidth;
578}
579
#define TGLOGINDENT(MESSAGE)
Combines the TGLOG macro and TGLOGAUTOINDENT macro in one.
Definition: Logger.h:68
#define TGERROR(MESSAGE)
Macros used to report the file name and line number to the TexGenError and TexGenLog functions.
Definition: Logger.h:29
#define NULL
Definition: ShinyConfig.h:50
Bezier interpolation for yarn paths.
Represents a point on the centreline of a yarn.
Definition: Node.h:28
void AssignSectionMesh(const CSectionMesh &SectionMesh)
Assign a mesh to the section.
Definition: Section.cpp:227
XY GetPoint(double t) const
Get a point lying on the perimeter correspending to parametric value t.
Represents a 3D woven textile.
void AddNoYarnLayer()
Add empty layer.
void ReplaceLastNode(int BinderYarnIndex, XYZ &NewNode, XYZ &BinderNode) const
Replace last node with node offset to match node 0.
vector< YARNDATA > m_XYarnData
vector< vector< int > > m_XYarns
int GetYarnIndex(int x, int y, int z) const
void CheckUpVectors(int WarpIndex, bool Yarn=PATTERN3D_XYARN, bool bYarnsIndex=false) const
void AddYYarn(int x, PATTERN3D Pattern)
Add yarn of type XYARN or NOTYARN parallel to the Y axis.
bool Valid() const
Check that the weave pattern contained in m_Pattern is valid.
double GetHeight() const
Get the height of the unit cell.
CSectionPowerEllipse * GetWeftCrossSection(int WeftYarnIndex) const
Adjust cross section shapes to correct interference.
int FindNextCellIndex(int index) const
Find next cell in y direction which isn't a binder yarn.
bool IsBinderYarn(int index) const
Check if X yarn is binder or warp. Returns true if binder.
vector< YARNDATA > m_YYarnData
void AddBinderLayer()
Add yarns parallel to the X axis in binder yarn positions, no yarns in warp positions.
void AddWarpLayer()
Add yarns parallel to the X axis in warp yarn positions, no yarns in binder positions.
vector< vector< int > > m_YYarns
void InsertBinderNode(CSectionPowerEllipse *YarnSection, double t, XYZ &WeftNode, int &CurrentNode, int BinderYarnIndex, double Offset, bool bInsert=true) const
Calculates a point at given point on power ellipse cross section and inserts into binder yarn.
virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType)
Used for saving data to XML.
const vector< PATTERN3D > & GetCell(int x, int y) const
CObjectContainer< CSectionMesh > m_pSectionMesh
vector< CYarn > m_Yarns
Vector of yarns contained within this cell.
Definition: Textile.h:323
string GetName() const
Get the name associated with this textile.
Definition: Textile.cpp:355
int AddYarn(const CYarn &Yarn)
Add a Yarn to the textile.
Definition: Textile.cpp:122
bool m_bNeedsBuilding
Variable which keeps track of wether the textile needs building or not.
Definition: Textile.h:330
virtual void FindMinMaxZ(double &dMinZ, double &dMaxZ)
Find min and max z values for the textile.
int FindBinderHeight(const vector< PATTERN3D > &Cell) const
void SetBinderPosition(int z, vector< PATTERN3D > &Cell)
virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType)
Used for saving data to XML.
virtual double GetWidth() const
Get the width of the unit cell.
CTextileOffsetAngleInterlock(int iNumXYarns, int iNumYYarns, double dXSpacing, double dYSpacing, double dXHeight, double dYHeight)
Build a weave unit cell of given width, height, number of layers, yarn spacing and fabric thickness.
int AddBinderNodes(int CurrentNode, int i, int j) const
Add extra nodes to binder yarns to match shape of adjacent weft yarns.
void ShapeBinderYarns() const
Shape the binder yarns around the adjacent weft yarns.
virtual void SetupLayers(int iNumWarpLayers, int iNumWeftLayers, int iNumBinderLayers=1)
Setup the layers given a specified number of layers.
virtual bool BuildTextile() const
Build the textile.
Represents a yarn consisting of master nodes, section and interpolation function.
Definition: Yarn.h:49
Creates a section which is constant all along the yarn.
Namespace containing a series of customised math operations not found in the standard c++ library.
OUTPUT_TYPE
Definition: Misc.h:105
@ PATTERN3D_NOYARN
@ PATTERN3D_XYARN
@ PATTERN3D_YYARN
Struct for representing points in 2D space.
Definition: mymath.h:103
double x
Definition: mymath.h:104
double y
Definition: mymath.h:104
Struct for representing points in 3D space.
Definition: mymath.h:56
double z
Definition: mymath.h:57
double x
Definition: mymath.h:57