TexGen
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
TexGen::CDomainPlanes Class Reference

Domain implementation described using planes, the simplest of which would be a box. More...

#include <DomainPlanes.h>

Inheritance diagram for TexGen::CDomainPlanes:
Inheritance graph
[legend]

Public Member Functions

 CDomainPlanes ()
 
 CDomainPlanes (const vector< PLANE > &Planes)
 
 CDomainPlanes (const XYZ &Min, const XYZ &Max)
 
 CDomainPlanes (TiXmlElement &Element)
 
 ~CDomainPlanes (void)
 
CDomainCopy () const
 
void PopulateTiXmlElement (TiXmlElement &Element, OUTPUT_TYPE OutputType=OUTPUT_STANDARD) const
 Used for saving data to XML. More...
 
void ClipMeshToDomain (CMesh &Mesh, bool bFillGaps=true) const
 Clip the surface elements to the domain. More...
 
bool ClipMeshToDomain (CMesh &Mesh, vector< CMesh > &DomainMeshes, bool bFillGaps=true) const
 Clip the surface elements to the domain. More...
 
string GetType () const
 Derived class should return the class name. More...
 
void AddPlane (const PLANE &Plane)
 
const vector< PLANE > & GetPlanes () const
 Accessor method to get the planes making up this domain. More...
 
bool GetBoxLimits (XYZ &Min, XYZ &Max)
 If the limits describe a box return the minimum and maximum otherwise return false. More...
 
void Grow (double dDistance)
 Move all the planes by given distance along their normal. More...
 
void Rotate (WXYZ Rotation)
 Rotate the domain by given rotation quaternion. More...
 
void Translate (XYZ Vector)
 Translate the domain by given vector. More...
 
void Deform (CLinearTransformation Transformation)
 Deform the domain by given linear transformation. More...
 
int GetPlane (XYZ &Normal, PLANE &Plane)
 Get plane with given normal. Returns both the plane and its index. More...
 
void SetPlane (int index, PLANE &Plane)
 Set plane at given index. More...
 
bool PointInDomain (const XYZ &Point) const
 Check if a point lies within the domain. More...
 
vector< pair< int, int > > GetRepeatLimits (const CYarn &Yarn) const
 
vector< XYZGetTranslations (const CYarn &Yarn) const
 Get the translation vectors necessary to fully fill the domain. More...
 
const CMeshGetMesh () const
 Get the mesh representing the domain as a surface mesh. More...
 
virtual double GetVolume () const
 Get the volume of the domain. More...
 
CDomainPrismGetPrismDomain ()
 

Protected Member Functions

void BuildMesh ()
 Populate m_PlaneIntersections and m_Mesh, note this only works for closed domains. More...
 
pair< double, double > GetLimits (XYZ RepeatVector, const CMesh &Mesh) const
 Get the limits for a single given repeat vector and surface mesh. More...
 
bool MeshIntersectsDomain (const CMesh &Mesh) const
 Determine if a mesh intersects with the domain. More...
 

Static Protected Member Functions

static bool FillGaps (CMesh &Mesh, const PLANE &Plane, vector< int > &Polygon, bool bMeshGaps=true)
 
static vector< pair< int, int > > ConvertLimitsToInt (const vector< pair< double, double > > &RepeatLimits)
 

Protected Attributes

vector< PLANEm_Planes
 List of planes that define the limits of the cell. More...
 
vector< vector< pair< XYZ, XYZ > > > m_PlaneIntersections
 A list of lines for each plane representing the intersections between other planes. More...
 
CMesh m_Mesh
 A mesh representing the domain as a surface mesh. More...
 

Detailed Description

Domain implementation described using planes, the simplest of which would be a box.

The domain must describe an enclosed area in which the textile lies. If not enough planes are specified the domain may be infinite, in which case bad things may happen. A plane is described by a normal and a value that represents the shortest distance from the plane to the origin (0, 0, 0). The normal should point towards the inside of the domain.

Definition at line 36 of file DomainPlanes.h.

Constructor & Destructor Documentation

◆ CDomainPlanes() [1/4]

CDomainPlanes::CDomainPlanes ( )

Definition at line 37 of file DomainPlanes.cpp.

◆ CDomainPlanes() [2/4]

CDomainPlanes::CDomainPlanes ( const vector< PLANE > &  Planes)

Definition at line 31 of file DomainPlanes.cpp.

References BuildMesh().

◆ CDomainPlanes() [3/4]

CDomainPlanes::CDomainPlanes ( const XYZ Min,
const XYZ Max 
)

◆ CDomainPlanes() [4/4]

CDomainPlanes::CDomainPlanes ( TiXmlElement &  Element)

◆ ~CDomainPlanes()

CDomainPlanes::~CDomainPlanes ( void  )

Definition at line 52 of file DomainPlanes.cpp.

Member Function Documentation

◆ AddPlane()

void CDomainPlanes::AddPlane ( const PLANE Plane)

Definition at line 86 of file DomainPlanes.cpp.

References BuildMesh(), and m_Planes.

Referenced by TexGen::CShearedTextileWeave2D::GetDefaultDomain().

◆ BuildMesh()

void CDomainPlanes::BuildMesh ( )
protected

◆ ClipMeshToDomain() [1/2]

void CDomainPlanes::ClipMeshToDomain ( CMesh Mesh,
bool  bFillGaps = true 
) const
virtual

Clip the surface elements to the domain.

For surface elements (TRI and QUAD elements) the elements will be either kept, discarded or trimmed depending on their location relative to the domain. For volume elements (TET, HEX) the elements will be either kept or discarded. No trimming occurs in this case to avoid poorly shaped elements. The center of the element is used to determine whether the element should be kept or discarded. For certain finite element analyses simulations can be performed without any trimming.

Parameters
MeshThe mesh instance to be clipped, this will be modified in place
bFillGapsIf set to true the resulting holes will be filled with a triangulated mesh

Implements TexGen::CDomain.

Definition at line 191 of file DomainPlanes.cpp.

References TexGen::CMesh::AddNode(), TexGen::CMesh::ConvertQuadtoTriangles(), TexGen::DotProduct(), FillGaps(), TexGen::CMesh::GetIndices(), TexGen::CMesh::GetNode(), TexGen::CMesh::GetNumNodes(), TexGen::CMesh::HEX, m_Planes, TexGen::CMesh::POLYGON, TexGen::CMesh::PYRAMID, TexGen::CMesh::QUAD, TexGen::CMesh::QUADRATIC_TET, TexGen::CMesh::RemoveUnreferencedNodes(), TexGen::CMesh::TET, TGLOGINDENT, TOL, TexGen::CMesh::TRI, and TexGen::CMesh::WEDGE.

◆ ClipMeshToDomain() [2/2]

bool CDomainPlanes::ClipMeshToDomain ( CMesh Mesh,
vector< CMesh > &  DomainMeshes,
bool  bFillGaps = true 
) const
virtual

Clip the surface elements to the domain.

Parameters
MeshThe mesh instance to be clipped, this will be modified in place
DomainMeshesOne mesh for each plane which domain/mesh intersection polygons are added
bFillGapsIf set to true the resulting holes will be filled with a triangulated mesh

Implements TexGen::CDomain.

Definition at line 490 of file DomainPlanes.cpp.

References TexGen::CMesh::AddNode(), TexGen::CMesh::ConvertQuadtoTriangles(), TexGen::CrossProduct(), TexGen::DotProduct(), FillGaps(), TexGen::CMesh::GetIndices(), TexGen::CMesh::GetNode(), TexGen::CMesh::GetNumNodes(), TexGen::CMesh::HEX, m_Planes, TexGen::CMesh::POLYGON, TexGen::CMesh::PYRAMID, TexGen::CMesh::QUAD, TexGen::CMesh::QUADRATIC_TET, TexGen::CMesh::RemoveUnreferencedNodes(), TexGen::CMesh::TET, TGLOGINDENT, TOL, TexGen::CMesh::TRI, and TexGen::CMesh::WEDGE.

◆ ConvertLimitsToInt()

vector< pair< int, int > > CDomain::ConvertLimitsToInt ( const vector< pair< double, double > > &  RepeatLimits)
staticprotectedinherited

Definition at line 59 of file Domain.cpp.

Referenced by TexGen::CDomain::GetRepeatLimits().

◆ Copy()

CDomain * TexGen::CDomainPlanes::Copy ( ) const
inlinevirtual

Implements TexGen::CDomain.

Definition at line 45 of file DomainPlanes.h.

◆ Deform()

void CDomainPlanes::Deform ( CLinearTransformation  Transformation)
virtual

Deform the domain by given linear transformation.

Implements TexGen::CDomain.

Definition at line 122 of file DomainPlanes.cpp.

References BuildMesh(), TexGen::DotProduct(), TexGen::CMatrix::GetInverse(), TexGen::CMatrix::GetTranspose(), m_Planes, and TexGen::Normalise().

◆ FillGaps()

bool CDomainPlanes::FillGaps ( CMesh Mesh,
const PLANE Plane,
vector< int > &  Polygon,
bool  bMeshGaps = true 
)
staticprotected

Given a mesh and a plane, the holes found in the plane will be filled with triangles Intersection of mesh and plane returned as closed loop

Definition at line 960 of file DomainPlanes.cpp.

References TexGen::PLANE::d, TexGen::DotProduct(), TexGen::CMesh::GetIndices(), TexGen::CMesh::GetNode(), TexGen::CMesh::MergeNodes(), TexGen::CMesh::MeshClosedLoop(), TexGen::PLANE::Normal, TexGen::CMesh::QUAD, TexGen::CMesh::RemoveDegenerateTriangles(), TGERROR, TGLOG, TOL, and TexGen::CMesh::TRI.

Referenced by ClipMeshToDomain().

◆ GetBoxLimits()

bool CDomainPlanes::GetBoxLimits ( XYZ Min,
XYZ Max 
)

If the limits describe a box return the minimum and maximum otherwise return false.

Definition at line 144 of file DomainPlanes.cpp.

References m_Planes, TexGen::Max(), TexGen::Min(), TexGen::XYZ::x, TexGen::XYZ::y, and TexGen::XYZ::z.

Referenced by TexGen::CExporter::ConvertDomain().

◆ GetLimits()

pair< double, double > CDomain::GetLimits ( XYZ  RepeatVector,
const CMesh Mesh 
) const
protectedinherited

Get the limits for a single given repeat vector and surface mesh.

The limits are the points where the whole surface mesh lies outside the domain The limit is represented as the factor multiplied by the repeat vector that represents the translation of the surface mesh to the limiting case.

Parameters
RepeatVectorThe repeat vector to get limit for
MeshThe surface mesh that needs to lie behind the plane
Returns
A pair of doubles representing the upper and lower limits

Definition at line 108 of file Domain.cpp.

References TexGen::DotProduct(), TexGen::GetLength(), TexGen::CMesh::GetNodes(), TexGen::CDomain::m_Mesh, TexGen::CMesh::NodesBegin(), and TexGen::CMesh::NodesEnd().

Referenced by TexGen::CDomain::GetRepeatLimits().

◆ GetMesh()

const CMesh & TexGen::CDomain::GetMesh ( ) const
inlineinherited

◆ GetPlane()

int CDomainPlanes::GetPlane ( XYZ Normal,
PLANE Plane 
)

Get plane with given normal. Returns both the plane and its index.

Definition at line 1225 of file DomainPlanes.cpp.

References m_Planes.

Referenced by TexGen::CTextileLayered::MaxNestLayers(), and TexGen::CTextileLayered::NestLayers().

◆ GetPlanes()

const vector< PLANE > & TexGen::CDomainPlanes::GetPlanes ( ) const
inline

Accessor method to get the planes making up this domain.

Definition at line 56 of file DomainPlanes.h.

Referenced by TexGen::CExporter::ConvertDomain().

◆ GetPrismDomain()

CDomainPrism * CDomain::GetPrismDomain ( )
inherited

◆ GetRepeatLimits()

vector< pair< int, int > > CDomain::GetRepeatLimits ( const CYarn Yarn) const
inherited

Get the limits associated with each repeat vector, that is the upper and lower bounds multiplied to the repeat vector for the entire yarn to lie just outside out of the domain

Definition at line 148 of file Domain.cpp.

References TexGen::CYarn::AddAABBToMesh(), TexGen::CDomain::ConvertLimitsToInt(), TexGen::CDomain::GetLimits(), TexGen::CYarn::GetRepeats(), and TGERROR.

Referenced by TexGen::CExporter::ConvertYarn(), and TexGen::CDomain::GetTranslations().

◆ GetTranslations()

vector< XYZ > CDomain::GetTranslations ( const CYarn Yarn) const
inherited

◆ GetType()

string TexGen::CDomainPlanes::GetType ( ) const
inlinevirtual

Derived class should return the class name.

Implements TexGen::CDomain.

Definition at line 51 of file DomainPlanes.h.

◆ GetVolume()

double CDomain::GetVolume ( ) const
virtualinherited

Get the volume of the domain.

Definition at line 70 of file Domain.cpp.

References TexGen::CMesh::CalculateVolume(), and TexGen::CDomain::m_Mesh.

◆ Grow()

void CDomainPlanes::Grow ( double  dDistance)
virtual

Move all the planes by given distance along their normal.

Implements TexGen::CDomain.

Definition at line 92 of file DomainPlanes.cpp.

References BuildMesh(), and m_Planes.

◆ MeshIntersectsDomain()

bool CDomain::MeshIntersectsDomain ( const CMesh Mesh) const
protectedinherited

Determine if a mesh intersects with the domain.

This is a very crude approximation of whether a mesh intersects the domain or not. It is based soley on the axis aligned bounding boxes of the two regions.

Definition at line 75 of file Domain.cpp.

References TexGen::BoundingBoxIntersect(), TexGen::CMesh::GetAABB(), and TexGen::CDomain::m_Mesh.

Referenced by TexGen::CDomain::GetTranslations().

◆ PointInDomain()

bool CDomainPlanes::PointInDomain ( const XYZ Point) const
virtual

Check if a point lies within the domain.

Implements TexGen::CDomain.

Definition at line 1211 of file DomainPlanes.cpp.

References TexGen::DotProduct(), m_Planes, and TOL.

◆ PopulateTiXmlElement()

void CDomainPlanes::PopulateTiXmlElement ( TiXmlElement &  Element,
OUTPUT_TYPE  OutputType = OUTPUT_STANDARD 
) const
virtual

Used for saving data to XML.

Reimplemented from TexGen::CDomain.

Definition at line 73 of file DomainPlanes.cpp.

References m_Planes, TexGen::CDomain::PopulateTiXmlElement(), and TexGen::stringify().

◆ Rotate()

void CDomainPlanes::Rotate ( WXYZ  Rotation)
virtual

Rotate the domain by given rotation quaternion.

Implements TexGen::CDomain.

Definition at line 102 of file DomainPlanes.cpp.

References BuildMesh(), and m_Planes.

◆ SetPlane()

void CDomainPlanes::SetPlane ( int  index,
PLANE Plane 
)

Set plane at given index.

Definition at line 1241 of file DomainPlanes.cpp.

References BuildMesh(), and m_Planes.

Referenced by TexGen::CTextileLayered::MaxNestLayers(), and TexGen::CTextileLayered::NestLayers().

◆ Translate()

void CDomainPlanes::Translate ( XYZ  Vector)
virtual

Translate the domain by given vector.

Implements TexGen::CDomain.

Definition at line 112 of file DomainPlanes.cpp.

References BuildMesh(), TexGen::DotProduct(), and m_Planes.

Member Data Documentation

◆ m_Mesh

CMesh TexGen::CDomain::m_Mesh
protectedinherited

◆ m_PlaneIntersections

vector<vector<pair<XYZ, XYZ> > > TexGen::CDomainPlanes::m_PlaneIntersections
protected

A list of lines for each plane representing the intersections between other planes.

Definition at line 89 of file DomainPlanes.h.

Referenced by BuildMesh().

◆ m_Planes

vector<PLANE> TexGen::CDomainPlanes::m_Planes
protected

List of planes that define the limits of the cell.

Definition at line 86 of file DomainPlanes.h.

Referenced by AddPlane(), BuildMesh(), CDomainPlanes(), ClipMeshToDomain(), Deform(), GetBoxLimits(), GetPlane(), Grow(), PointInDomain(), PopulateTiXmlElement(), Rotate(), SetPlane(), and Translate().


The documentation for this class was generated from the following files: