31CDomainPlanes::CDomainPlanes(
const vector<PLANE> &Planes)
62 Plane.
Normal = valueify<XYZ>(pPlane->Attribute(
"Normal"));
63 pPlane->Attribute(
"d", &Plane.
d);
76 vector<PLANE>::const_iterator itPlane;
79 TiXmlElement Plane(
"Plane");
80 Plane.SetAttribute(
"Normal",
stringify(itPlane->Normal));
81 Plane.SetAttribute(
"d",
stringify(itPlane->d));
82 Element.InsertEndChild(Plane);
94 vector<PLANE>::iterator itPlane;
97 itPlane->d -= dDistance;
104 vector<PLANE>::iterator itPlane;
107 itPlane->Normal = Rotation * itPlane->Normal;
114 vector<PLANE>::iterator itPlane;
117 itPlane->d +=
DotProduct(Vector, itPlane->Normal);
124 vector<PLANE>::iterator itPlane;
129 Transformation.
GetInverse(NormalTransformation);
130 NormalTransformation = NormalTransformation.
GetTranspose();
133 P = itPlane->Normal * itPlane->d;
134 P = Transformation * P;
135 itPlane->Normal = NormalTransformation * itPlane->Normal;
149 bool bLimitsSet[6] = {
false,
false,
false,
false,
false,
false};
155 bLimitsSet[0] =
true;
160 bLimitsSet[1] =
true;
165 bLimitsSet[2] =
true;
170 bLimitsSet[3] =
true;
175 bLimitsSet[4] =
true;
180 bLimitsSet[5] =
true;
185 if (bLimitsSet[i] ==
false)
193 const double TOL = 1e-9;
197 vector<XYZ> NewTriangles;
198 vector<bool> NewTrianglesFlipped;
199 vector<XYZ>::iterator itXYZ;
200 vector<XYZ> NewQuads;
202 vector<PLANE>::const_iterator itPlane;
203 list<int>::iterator itStart;
204 list<int>::iterator itInt;
205 const XYZ *p1, *p2, *p3, *p4;
206 double d1, d2, d3, d4;
218 for (itInt = QuadIndices.begin(); itInt != QuadIndices.end(); )
222 p1 = &Mesh.
GetNode(*(itInt++));
223 p2 = &Mesh.
GetNode(*(itInt++));
224 p3 = &Mesh.
GetNode(*(itInt++));
225 p4 = &Mesh.
GetNode(*(itInt++));
227 d1 =
DotProduct(itPlane->Normal, *p1) - itPlane->d;
228 d2 =
DotProduct(itPlane->Normal, *p2) - itPlane->d;
229 d3 =
DotProduct(itPlane->Normal, *p3) - itPlane->d;
230 d4 =
DotProduct(itPlane->Normal, *p4) - itPlane->d;
234 itInt = QuadIndices.erase(itStart, itInt);
236 else if (d1 >= -
TOL && d2 >= -
TOL && d3 >= -
TOL && d4 >= -
TOL)
240 else if ( d1 <
TOL && d2 < TOL && d3 >
TOL && d4 >
TOL )
242 itInt = QuadIndices.erase(itStart, itInt);
244 NewQuads.push_back(*p4 + (*p1-*p4) * u);
246 NewQuads.push_back(*p3 + (*p2-*p3) * u);
247 NewQuads.push_back(*p3);
248 NewQuads.push_back(*p4);
250 else if ( d2 <
TOL && d3 < TOL && d4 >
TOL && d1 >
TOL )
252 itInt = QuadIndices.erase(itStart, itInt);
253 NewQuads.push_back(*p1);
255 NewQuads.push_back(*p1 + (*p2-*p1) * u);
257 NewQuads.push_back(*p4 + (*p3-*p4) * u);
258 NewQuads.push_back(*p4);
260 else if ( d3 <
TOL && d4 < TOL && d1 >
TOL && d2 >
TOL )
262 itInt = QuadIndices.erase(itStart, itInt);
263 NewQuads.push_back(*p1);
264 NewQuads.push_back(*p2);
266 NewQuads.push_back(*p2 + (*p3-*p2) * u);
268 NewQuads.push_back(*p1 + (*p4-*p1) * u);
270 else if ( d4 <
TOL && d1 < TOL && d2 >
TOL && d3 >
TOL )
272 itInt = QuadIndices.erase(itStart, itInt);
274 NewQuads.push_back(*p2 + (*p1-*p2) * u);
275 NewQuads.push_back(*p2);
276 NewQuads.push_back(*p3);
278 NewQuads.push_back(*p3 + (*p4-*p3) * u);
289 for (i = 0; i < int(NewQuads.size()/4); ++i)
292 QuadIndices.push_back(4*i+iLastNodeIndex);
293 QuadIndices.push_back(4*i+1+iLastNodeIndex);
294 QuadIndices.push_back(4*i+2+iLastNodeIndex);
295 QuadIndices.push_back(4*i+3+iLastNodeIndex);
297 for (itXYZ = NewQuads.begin(); itXYZ != NewQuads.end(); ++itXYZ)
304 for (itInt = TriIndices.begin(); itInt != TriIndices.end(); )
308 p1 = &Mesh.
GetNode(*(itInt++));
309 p2 = &Mesh.
GetNode(*(itInt++));
310 p3 = &Mesh.
GetNode(*(itInt++));
312 d1 =
DotProduct(itPlane->Normal, *p1) - itPlane->d;
313 d2 =
DotProduct(itPlane->Normal, *p2) - itPlane->d;
314 d3 =
DotProduct(itPlane->Normal, *p3) - itPlane->d;
318 itInt = TriIndices.erase(itStart, itInt);
320 else if (d1 >= -
TOL && d2 >= -
TOL && d3 >= -
TOL)
326 itInt = TriIndices.erase(itStart, itInt);
331 dTemp = d2; d2 = d1; d1 = dTemp;
332 pTemp = p2; p2 = p1; p1 = pTemp;
333 bFlipped = !bFlipped;
337 dTemp = d3; d3 = d2; d2 = dTemp;
338 pTemp = p3; p3 = p2; p2 = pTemp;
339 bFlipped = !bFlipped;
342 dTemp = d2; d2 = d1; d1 = dTemp;
343 pTemp = p2; p2 = p1; p1 = pTemp;
344 bFlipped = !bFlipped;
350 NewTriangles.push_back(*p1);
352 NewTriangles.push_back(*p1 + (*p2-*p1) * u);
354 NewTriangles.push_back(*p1 + (*p3-*p1) * u);
355 NewTrianglesFlipped.push_back(bFlipped);
359 NewTriangles.push_back(*p1);
360 NewTriangles.push_back(*p2);
362 NewTriangles.push_back(*p2 + (*p3-*p2) * u);
363 NewTrianglesFlipped.push_back(bFlipped);
365 NewTriangles.push_back(*p2 + (*p3-*p2) * u);
367 NewTriangles.push_back(*p1 + (*p3-*p1) * u);
368 NewTriangles.push_back(*p1);
369 NewTrianglesFlipped.push_back(bFlipped);
376 for (i = 0; i < int(NewTriangles.size()/3); ++i)
382 if (!NewTrianglesFlipped[i])
384 TriIndices.push_back(3*i+iLastNodeIndex);
385 TriIndices.push_back(3*i+1+iLastNodeIndex);
386 TriIndices.push_back(3*i+2+iLastNodeIndex);
390 TriIndices.push_back(3*i+iLastNodeIndex);
391 TriIndices.push_back(3*i+2+iLastNodeIndex);
392 TriIndices.push_back(3*i+1+iLastNodeIndex);
395 for (itXYZ = NewTriangles.begin(); itXYZ != NewTriangles.end(); ++itXYZ)
399 NewTriangles.clear();
400 NewTrianglesFlipped.clear();
402 vector<int> ClosedLoop;
404 FillGaps(Mesh, *itPlane, ClosedLoop);
410 vector<CMesh::ELEMENT_TYPE> VolumeElements;
411 vector<CMesh::ELEMENT_TYPE>::iterator itElementType;
419 for (itElementType = VolumeElements.begin(); itElementType != VolumeElements.end(); ++itElementType)
421 list<int> &Indices = Mesh.
GetIndices(*itElementType);
422 for (itInt = Indices.begin(); itInt != Indices.end(); )
428 for (i=0; i<iNumNodes; ++i)
430 Center += Mesh.
GetNode(*(itInt++));
434 d =
DotProduct(itPlane->Normal, Center) - itPlane->d;
436 itInt = Indices.erase(itStart, itInt);
444 list<int>::iterator itIndices;
445 int StartIndex, NewStartIndex;
446 bool bResetStart =
true;
447 list<int>::iterator itStartIndex;
450 for ( itIndices = Indices.begin(); itIndices != Indices.end(); )
453 StartIndex = NewStartIndex = (*(itIndices));
454 itStartIndex = itIndices;
455 vector<int> PolygonIndex;
458 int i = 0, iPoints = 0;
460 p = Mesh.
GetNode(*(itIndices));
461 d =
DotProduct(itPlane->Normal, p) - itPlane->d;
471 }
while ( (*itIndices) != StartIndex );
476 itIndices = Indices.erase( itStartIndex, itIndices );
492 const double TOL = 1e-9;
496 vector<XYZ> NewTriangles;
497 vector<bool> NewTrianglesFlipped;
498 vector<XYZ>::iterator itXYZ;
499 vector<XYZ> NewQuads;
501 vector<PLANE>::const_iterator itPlane;
502 list<int>::iterator itStart;
503 list<int>::iterator itInt;
504 const XYZ *p1, *p2, *p3, *p4;
505 double d1, d2, d3, d4;
512 vector<CMesh>::iterator itDomainMeshes;
513 bool bSaveDomainMeshes =
false;
514 if ( DomainMeshes.size() != 0 )
515 bSaveDomainMeshes =
true;
525 for (itInt = QuadIndices.begin(); itInt != QuadIndices.end(); )
529 p1 = &Mesh.
GetNode(*(itInt++));
530 p2 = &Mesh.
GetNode(*(itInt++));
531 p3 = &Mesh.
GetNode(*(itInt++));
532 p4 = &Mesh.
GetNode(*(itInt++));
534 d1 =
DotProduct(itPlane->Normal, *p1) - itPlane->d;
535 d2 =
DotProduct(itPlane->Normal, *p2) - itPlane->d;
536 d3 =
DotProduct(itPlane->Normal, *p3) - itPlane->d;
537 d4 =
DotProduct(itPlane->Normal, *p4) - itPlane->d;
541 itInt = QuadIndices.erase(itStart, itInt);
543 else if (d1 >= -
TOL && d2 >= -
TOL && d3 >= -
TOL && d4 >= -
TOL)
547 else if ( d1 <
TOL && d2 < TOL && d3 >
TOL && d4 >
TOL )
549 itInt = QuadIndices.erase(itStart, itInt);
551 NewQuads.push_back(*p4 + (*p1-*p4) * u);
553 NewQuads.push_back(*p3 + (*p2-*p3) * u);
554 NewQuads.push_back(*p3);
555 NewQuads.push_back(*p4);
557 else if ( d2 <
TOL && d3 < TOL && d4 >
TOL && d1 >
TOL )
559 itInt = QuadIndices.erase(itStart, itInt);
560 NewQuads.push_back(*p1);
562 NewQuads.push_back(*p1 + (*p2-*p1) * u);
564 NewQuads.push_back(*p4 + (*p3-*p4) * u);
565 NewQuads.push_back(*p4);
567 else if ( d3 <
TOL && d4 < TOL && d1 >
TOL && d2 >
TOL )
569 itInt = QuadIndices.erase(itStart, itInt);
570 NewQuads.push_back(*p1);
571 NewQuads.push_back(*p2);
573 NewQuads.push_back(*p2 + (*p3-*p2) * u);
575 NewQuads.push_back(*p1 + (*p4-*p1) * u);
577 else if ( d4 <
TOL && d1 < TOL && d2 >
TOL && d3 >
TOL )
579 itInt = QuadIndices.erase(itStart, itInt);
581 NewQuads.push_back(*p2 + (*p1-*p2) * u);
582 NewQuads.push_back(*p2);
583 NewQuads.push_back(*p3);
585 NewQuads.push_back(*p3 + (*p4-*p3) * u);
596 for (i = 0; i < int(NewQuads.size()/4); ++i)
599 QuadIndices.push_back(4*i+iLastNodeIndex);
600 QuadIndices.push_back(4*i+1+iLastNodeIndex);
601 QuadIndices.push_back(4*i+2+iLastNodeIndex);
602 QuadIndices.push_back(4*i+3+iLastNodeIndex);
604 for (itXYZ = NewQuads.begin(); itXYZ != NewQuads.end(); ++itXYZ)
611 for (itInt = TriIndices.begin(); itInt != TriIndices.end(); )
615 p1 = &Mesh.
GetNode(*(itInt++));
616 p2 = &Mesh.
GetNode(*(itInt++));
617 p3 = &Mesh.
GetNode(*(itInt++));
619 d1 =
DotProduct(itPlane->Normal, *p1) - itPlane->d;
620 d2 =
DotProduct(itPlane->Normal, *p2) - itPlane->d;
621 d3 =
DotProduct(itPlane->Normal, *p3) - itPlane->d;
625 itInt = TriIndices.erase(itStart, itInt);
627 else if (d1 >= -
TOL && d2 >= -
TOL && d3 >= -
TOL)
633 itInt = TriIndices.erase(itStart, itInt);
638 dTemp = d2; d2 = d1; d1 = dTemp;
639 pTemp = p2; p2 = p1; p1 = pTemp;
640 bFlipped = !bFlipped;
644 dTemp = d3; d3 = d2; d2 = dTemp;
645 pTemp = p3; p3 = p2; p2 = pTemp;
646 bFlipped = !bFlipped;
649 dTemp = d2; d2 = d1; d1 = dTemp;
650 pTemp = p2; p2 = p1; p1 = pTemp;
651 bFlipped = !bFlipped;
657 NewTriangles.push_back(*p1);
659 NewTriangles.push_back(*p1 + (*p2-*p1) * u);
661 NewTriangles.push_back(*p1 + (*p3-*p1) * u);
662 NewTrianglesFlipped.push_back(bFlipped);
666 NewTriangles.push_back(*p1);
667 NewTriangles.push_back(*p2);
669 NewTriangles.push_back(*p2 + (*p3-*p2) * u);
670 NewTrianglesFlipped.push_back(bFlipped);
672 NewTriangles.push_back(*p2 + (*p3-*p2) * u);
674 NewTriangles.push_back(*p1 + (*p3-*p1) * u);
675 NewTriangles.push_back(*p1);
676 NewTrianglesFlipped.push_back(bFlipped);
683 for (i = 0; i < int(NewTriangles.size()/3); ++i)
689 if (!NewTrianglesFlipped[i])
691 TriIndices.push_back(3*i+iLastNodeIndex);
692 TriIndices.push_back(3*i+1+iLastNodeIndex);
693 TriIndices.push_back(3*i+2+iLastNodeIndex);
697 TriIndices.push_back(3*i+iLastNodeIndex);
698 TriIndices.push_back(3*i+2+iLastNodeIndex);
699 TriIndices.push_back(3*i+1+iLastNodeIndex);
702 for (itXYZ = NewTriangles.begin(); itXYZ != NewTriangles.end(); ++itXYZ)
706 NewTriangles.clear();
707 NewTrianglesFlipped.clear();
709 vector<int> ClosedLoop;
712 if ( !
FillGaps(Mesh, *itPlane, ClosedLoop,
false) )
715 if ( bSaveDomainMeshes )
717 if ( ClosedLoop.size() > 0 )
719 for( itDomainMeshes = DomainMeshes.begin(); itDomainMeshes != DomainMeshes.end(); itDomainMeshes++ )
724 for(
int i = 0; i < 3; i++ )
726 Points[i] = (*itDomainMeshes).GetNode(i);
728 Normal =
CrossProduct( (Points[0]-Points[1]), Points[2]-Points[1] );
730 if ( fabs(
DotProduct( Mesh.
GetNode(ClosedLoop[0]), Normal )- dPlane) < 0.000001 )
732 int iIndex = (*itDomainMeshes).GetNumNodes();
733 int iPolyStart = iIndex;
734 vector<int>::iterator itClosedLoop;
736 int iStartInd = ClosedLoop[0];
737 for ( itClosedLoop = ClosedLoop.begin(); itClosedLoop != ClosedLoop.end(); itClosedLoop++ )
739 if ( *itClosedLoop == iStartInd && iIndex > iPolyStart )
741 Indices.push_back( iPolyStart );
745 Indices.push_back(iIndex++);
746 (*itDomainMeshes).AddNode( Mesh.
GetNode(*itClosedLoop) );
749 if ( ClosedLoop[ClosedLoop.size()-1] != iStartInd )
750 Indices.push_back(iPolyStart);
763 vector<CMesh::ELEMENT_TYPE> VolumeElements;
764 vector<CMesh::ELEMENT_TYPE>::iterator itElementType;
772 for (itElementType = VolumeElements.begin(); itElementType != VolumeElements.end(); ++itElementType)
774 list<int> &Indices = Mesh.
GetIndices(*itElementType);
775 for (itInt = Indices.begin(); itInt != Indices.end(); )
781 for (i=0; i<iNumNodes; ++i)
783 Center += Mesh.
GetNode(*(itInt++));
787 d =
DotProduct(itPlane->Normal, Center) - itPlane->d;
789 itInt = Indices.erase(itStart, itInt);
842 list<int>::iterator itIndices;
843 int StartIndex, NewStartIndex;
844 bool bResetStart =
true;
845 list<int>::iterator itStartIndex;
848 for ( itIndices = Indices.begin(); itIndices != Indices.end(); )
851 StartIndex = NewStartIndex = (*(itIndices));
852 itStartIndex = itIndices;
853 vector<int> PolygonIndex;
856 int i = 0, iPoints = 0;
858 p = Mesh.
GetNode(*(itIndices));
859 d =
DotProduct(itPlane->Normal, p) - itPlane->d;
869 }
while ( (*itIndices) != StartIndex );
874 itIndices = Indices.erase( itStartIndex, itIndices );
896 vector<PLANE>::const_iterator itPlane1;
897 vector<PLANE>::const_iterator itPlane2;
899 double N1dotN2, c1, c2;
901 for (itPlane1 =
m_Planes.begin(), i=0; itPlane1 !=
m_Planes.end(); ++itPlane1, ++i)
905 if (itPlane1 == itPlane2)
907 N1dotN2 =
DotProduct(itPlane1->Normal, itPlane2->Normal);
909 if (abs(dDeterminant) < 1e-6)
912 c1 = (itPlane1->d*
GetLengthSquared(itPlane2->Normal) - itPlane2->d*N1dotN2) / dDeterminant;
913 c2 = (itPlane2->d*
GetLengthSquared(itPlane1->Normal) - itPlane1->d*N1dotN2) / dDeterminant;
923 vector<PLANE>::const_iterator itPlane;
932 if (abs(dDenom) < 1e-6)
939 vector<XYZ>::iterator itPoint;
946 u =
DotProduct(*itPoint, itPlane->Normal) - itPlane->d;
962 const double TOL = 1e-9;
965 const XYZ *p1, *p2, *p3, *p4;
966 double d1, d2, d3, d4;
968 vector<pair<int, int> > Segments;
975 list<int>::iterator itInt;
978 for (itInt = QuadIndices.begin(); itInt != QuadIndices.end(); )
1004 if (d1 <=
TOL && d2 <=
TOL)
1006 Segments.push_back(pair<int, int>(i1, i2));
1008 if (d2 <=
TOL && d3 <=
TOL)
1010 Segments.push_back(pair<int, int>(i2, i3));
1012 if (d3 <=
TOL && d4 <=
TOL)
1014 Segments.push_back(pair<int, int>(i3, i4));
1016 if (d4 <=
TOL && d1 <=
TOL)
1018 Segments.push_back(pair<int, int>(i4, i1));
1023 for (itInt = TriIndices.begin(); itInt != TriIndices.end(); )
1045 if (d1 <=
TOL && d2 <=
TOL)
1047 Segments.push_back(pair<int, int>(i1, i2));
1049 if (d2 <=
TOL && d3 <=
TOL)
1051 Segments.push_back(pair<int, int>(i2, i3));
1053 if (d3 <=
TOL && d1 <=
TOL)
1055 Segments.push_back(pair<int, int>(i3, i1));
1059 vector<pair<int, int> >::iterator itSegment;
1062 int iIndex, iFirstIndex;
1070 map<int, int> Indices;
1071 map<int, int>::iterator itIndex;
1073 for (itSegment = Segments.begin(); itSegment != Segments.end(); ++itSegment)
1075 Indices[itSegment->first]++;
1076 Indices[itSegment->second]++;
1080 while(Segments.size())
1082 vector<int> ClosedLoop;
1086 iFirstIndex = iIndex = Segments.begin()->first;
1090 for (itSegment = Segments.begin(); itSegment != Segments.end(); ++itSegment)
1093 if (itSegment->second == iIndex)
1096 iIndex = itSegment->first;
1098 itSegment = Segments.erase(itSegment);
1115 ClosedLoop.push_back(iIndex);
1118 if (iFirstIndex == iIndex)
1130 TGERROR(
"Unable to fill gaps satisfactorily");
1134 TGLOG(
"Number of nodes: " << Indices.size());
1143 for (itIndex = Indices.begin(); itIndex != Indices.end(); ++itIndex)
1145 if (itIndex->second != 2)
1146 TGLOG(
"Node " << itIndex->first <<
" referenced " << itIndex->second <<
" times. (" << Mesh.
GetNode(itIndex->first) <<
")");
1156 vector<int>::iterator itCurrent = ClosedLoop.begin();
1157 vector<int>::iterator itNext = itCurrent+1;
1158 while(itNext != ClosedLoop.end() )
1160 if (*itCurrent == *itNext )
1162 itNext = ClosedLoop.erase(itNext);
1174 vector<int>::iterator itPrev = ClosedLoop.begin();
1175 itCurrent = itPrev+1;
1176 itNext = itCurrent+1;
1178 while( itNext != ClosedLoop.end() )
1180 if ( *itPrev == *itNext )
1182 ClosedLoop.erase(itCurrent, itNext+1);
1183 if ( itPrev != ClosedLoop.begin() )
1187 itNext = itCurrent+1;
1196 if (itPrev == ClosedLoop.end())
1197 itPrev = ClosedLoop.begin();
1201 Polygon.insert( Polygon.begin(), ClosedLoop.begin(), ClosedLoop.end() );
1213 const double TOL = 1e-9;
1214 vector<PLANE>::const_iterator itPlane;
1218 double d =
DotProduct(itPlane->Normal, Point) - itPlane->d;
1227 vector<PLANE>::iterator itPlane;
1230 for ( itPlane =
m_Planes.begin(),i = 0; itPlane !=
m_Planes.end(); ++itPlane, ++i )
1232 if ( itPlane->Normal == Normal )
#define TGLOGINDENT(MESSAGE)
Combines the TGLOG macro and TGLOGAUTOINDENT macro in one.
#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 representing the domain in which a textile cell may lie.
virtual void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType=OUTPUT_STANDARD) const
Used for saving data to XML.
CMesh m_Mesh
A mesh representing the domain as a surface mesh.
void BuildMesh()
Populate m_PlaneIntersections and m_Mesh, note this only works for closed domains.
vector< vector< pair< XYZ, XYZ > > > m_PlaneIntersections
A list of lines for each plane representing the intersections between other planes.
void Deform(CLinearTransformation Transformation)
Deform the domain by given linear transformation.
void SetPlane(int index, PLANE &Plane)
Set plane at given index.
static bool FillGaps(CMesh &Mesh, const PLANE &Plane, vector< int > &Polygon, bool bMeshGaps=true)
void ClipMeshToDomain(CMesh &Mesh, bool bFillGaps=true) const
Clip the surface elements to the domain.
void PopulateTiXmlElement(TiXmlElement &Element, OUTPUT_TYPE OutputType=OUTPUT_STANDARD) const
Used for saving data to XML.
void Translate(XYZ Vector)
Translate the domain by given vector.
void Grow(double dDistance)
Move all the planes by given distance along their normal.
int GetPlane(XYZ &Normal, PLANE &Plane)
Get plane with given normal. Returns both the plane and its index.
bool PointInDomain(const XYZ &Point) const
Check if a point lies within the domain.
bool GetBoxLimits(XYZ &Min, XYZ &Max)
If the limits describe a box return the minimum and maximum otherwise return false.
void Rotate(WXYZ Rotation)
Rotate the domain by given rotation quaternion.
void AddPlane(const PLANE &Plane)
vector< PLANE > m_Planes
List of planes that define the limits of the cell.
Class to represent a matrix and perform various operations on it.
double GetInverse(CMatrix &Inverse) const
Defines the nodes and elements of a surface or volume mesh.
int GetNumNodes() const
Return the number of nodes.
int MergeNodes(const double Tolerance=1e-8)
If any nodes share the same coordinates merge the nodes together and adjust indices accordingly.
void RemoveDegenerateTriangles()
Remove triangles which have two equal corner indices.
const vector< XYZ > & GetNodes() const
Get a const reference to the nodes.
const int AddNode(XYZ Node)
Append a node to the list of nodes, the integer returns the index of the node
const XYZ & GetNode(int iIndex) const
Get the node with given ID.
int RemoveUnreferencedNodes()
Remove nodes that are not referenced by any elements.
list< int >::iterator ConvertQuadtoTriangles(list< int >::iterator itQuad)
Convert a specific quad element to two triangles.
void MeshConvexHull()
Create a triangular convex hull of the nodes contained within the mesh.
static int GetNumNodes(ELEMENT_TYPE Type)
Get the number of nodes a particular element type contains.
const list< int > & GetIndices(ELEMENT_TYPE ElemType) const
Get the element indices of a given element type.
void MeshClosedLoop(const XYZ &Normal, const vector< int > &ClosedLoopVector, bool bQuality=false)
void Clear()
Empty mesh nodes and indices.
vector< XYZ >::iterator DeleteNode(vector< XYZ >::iterator it)
Delete a node given iterator.
Namespace containing a series of customised math operations not found in the standard c++ library.
double GetLengthSquared(const XYZ &Point1, const XYZ &Point2)
Get the length squared between two points.
double Max(XYZ &Vector)
Get maximum element of vector and return it.
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.
XYZ Min(const XYZ &P1, const XYZ &P2)
Given two points, return a new point who's coordinates are the smaller of the two.
WXYZ & Normalise(WXYZ &Quaternion)
Normalise the quaternion and return it.
double DotProduct(const XYZ &left, const XYZ &right)
Get the dot product of two vectors.
XYZ CrossProduct(const XYZ &left, const XYZ &right)
Get the cross product of two vectors.
Struct for representing a Plane.
Struct for representing a quaternion.
Struct for representing points in 3D space.