TexGen
|
Domain implementation described using planes, the simplest of which would be a box. More...
#include <DomainPlanes.h>
Public Member Functions | |
CDomainPlanes () | |
CDomainPlanes (const vector< PLANE > &Planes) | |
CDomainPlanes (const XYZ &Min, const XYZ &Max) | |
CDomainPlanes (TiXmlElement &Element) | |
~CDomainPlanes (void) | |
CDomain * | Copy () 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< XYZ > | GetTranslations (const CYarn &Yarn) const |
Get the translation vectors necessary to fully fill the domain. More... | |
const CMesh & | GetMesh () const |
Get the mesh representing the domain as a surface mesh. More... | |
virtual double | GetVolume () const |
Get the volume of the domain. More... | |
CDomainPrism * | GetPrismDomain () |
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< PLANE > | m_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... | |
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.
CDomainPlanes::CDomainPlanes | ( | ) |
Definition at line 37 of file DomainPlanes.cpp.
CDomainPlanes::CDomainPlanes | ( | const vector< PLANE > & | Planes | ) |
Definition at line 31 of file DomainPlanes.cpp.
References BuildMesh().
Definition at line 41 of file DomainPlanes.cpp.
References BuildMesh(), m_Planes, TexGen::Max(), TexGen::Min(), TexGen::XYZ::x, TexGen::XYZ::y, and TexGen::XYZ::z.
CDomainPlanes::CDomainPlanes | ( | TiXmlElement & | Element | ) |
Definition at line 56 of file DomainPlanes.cpp.
References BuildMesh(), TexGen::PLANE::d, FOR_EACH_TIXMLELEMENT, TexGen::CMesh::GetNumNodes(), TexGen::CDomain::m_Mesh, m_Planes, and TexGen::PLANE::Normal.
CDomainPlanes::~CDomainPlanes | ( | void | ) |
Definition at line 52 of file DomainPlanes.cpp.
void CDomainPlanes::AddPlane | ( | const PLANE & | Plane | ) |
Definition at line 86 of file DomainPlanes.cpp.
References BuildMesh(), and m_Planes.
Referenced by TexGen::CShearedTextileWeave2D::GetDefaultDomain().
|
protected |
Populate m_PlaneIntersections and m_Mesh, note this only works for closed domains.
Definition at line 890 of file DomainPlanes.cpp.
References TexGen::CMesh::AddNode(), TexGen::CMesh::Clear(), TexGen::CrossProduct(), TexGen::CMesh::DeleteNode(), TexGen::DotProduct(), TexGen::GetLengthSquared(), TexGen::CMesh::GetNodes(), TexGen::CDomain::m_Mesh, m_PlaneIntersections, m_Planes, and TexGen::CMesh::MeshConvexHull().
Referenced by AddPlane(), CDomainPlanes(), Deform(), Grow(), Rotate(), SetPlane(), and Translate().
|
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.
Mesh | The mesh instance to be clipped, this will be modified in place |
bFillGaps | If 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.
|
virtual |
Clip the surface elements to the domain.
Mesh | The mesh instance to be clipped, this will be modified in place |
DomainMeshes | One mesh for each plane which domain/mesh intersection polygons are added |
bFillGaps | If 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.
|
staticprotectedinherited |
Definition at line 59 of file Domain.cpp.
Referenced by TexGen::CDomain::GetRepeatLimits().
|
inlinevirtual |
Implements TexGen::CDomain.
Definition at line 45 of file DomainPlanes.h.
|
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().
|
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().
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().
|
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.
RepeatVector | The repeat vector to get limit for |
Mesh | The surface mesh that needs to lie behind the plane |
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().
|
inlineinherited |
Get the mesh representing the domain as a surface mesh.
Definition at line 73 of file Domain.h.
Referenced by TexGen::CRectangularVoxelMesh::CalculateVoxelSizes(), TexGen::CRotatedVoxelMesh::CalculateVoxelSizes(), TexGen::CShearedVoxelMesh::CalculateVoxelSizes(), TexGen::CExporter::ConvertDomain(), TexGen::CBasicVolumes::CreateBasicVolumes(), TexGen::CSimulationAbaqus::CreatePeriodicBoundaries(), TexGen::CGeometrySolver::CreateSystem(), TexGen::CShearedTextileWeave2D::CreateTopAndBottomMeshes(), TexGen::COctreeVoxelMesh::OutputPeriodicBoundaries(), TexGen::CStaggeredVoxelMesh::OutputPeriodicBoundaries(), TexGen::CVoxelMesh::OutputPeriodicBoundaries(), TexGen::CTexGenRenderer::RenderDomain(), TexGen::CTexGenRenderer::RenderDomainAxes(), TexGen::CTexGenRenderer::RenderGrid(), TexGen::CTexGenRenderer::SaveTextileToVTK(), TexGen::CMesher::SaveVolumeMeshToABAQUS(), and TexGen::COctreeVoxelMesh::SaveVoxelMesh().
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().
|
inline |
Accessor method to get the planes making up this domain.
Definition at line 56 of file DomainPlanes.h.
Referenced by TexGen::CExporter::ConvertDomain().
|
inherited |
Definition at line 54 of file Domain.cpp.
Referenced by TexGen::CPrismVoxelMesh::CalculateVoxelSizes(), and TexGen::CPrismVoxelMesh::GetElementMap().
|
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().
Get the translation vectors necessary to fully fill the domain.
Definition at line 83 of file Domain.cpp.
References TexGen::CYarn::AddAABBToMesh(), TexGen::CopyToRange(), TexGen::CDomain::GetRepeatLimits(), TexGen::CYarn::GetRepeats(), TexGen::CDomain::MeshIntersectsDomain(), and TexGen::CMesh::Translate().
Referenced by TexGen::CYarn::AddCentrePlaneToMesh(), TexGen::CYarn::AddSurfaceToMesh(), TexGen::CYarn::AddVolumeToMesh(), TexGen::CAdjustMeshInterference::AdjustSectionMeshes(), TexGen::CGeometrySolver::AssignFibreDirectionToElements(), TexGen::CTextileDeformer::DeformTextile(), TexGen::CMesher::FillYarnTangentsData(), and TexGen::CTextile::GetPointInformation().
|
inlinevirtual |
Derived class should return the class name.
Implements TexGen::CDomain.
Definition at line 51 of file DomainPlanes.h.
|
virtualinherited |
Get the volume of the domain.
Definition at line 70 of file Domain.cpp.
References TexGen::CMesh::CalculateVolume(), and TexGen::CDomain::m_Mesh.
|
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.
|
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().
|
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.
|
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().
|
virtual |
Rotate the domain by given rotation quaternion.
Implements TexGen::CDomain.
Definition at line 102 of file DomainPlanes.cpp.
References BuildMesh(), and m_Planes.
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().
|
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.
|
protectedinherited |
A mesh representing the domain as a surface mesh.
Definition at line 112 of file Domain.h.
Referenced by BuildMesh(), TexGen::CDomainPrism::BuildMesh(), TexGen::CDomain::CDomain(), CDomainPlanes(), TexGen::CDomainPrism::CDomainPrism(), TexGen::CDomainPrism::GeneratePlanes(), TexGen::CDomain::GetLimits(), TexGen::CDomainPrism::GetMeshWithPolygonEnd(), TexGen::CDomain::GetVolume(), TexGen::CDomain::MeshIntersectsDomain(), and TexGen::CDomain::PopulateTiXmlElement().
A list of lines for each plane representing the intersections between other planes.
Definition at line 89 of file DomainPlanes.h.
Referenced by BuildMesh().
|
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().