3Depict
|
#include <mesh.h>
Public Member Functions | |
unsigned int | loadGmshMesh (const char *meshfile, unsigned int &curLine, bool allowBadMeshes=true) |
unsigned int | saveGmshMesh (const char *meshfile) const |
size_t | elementCount () const |
void | setTriangleMesh (const std::vector< float > &ptsA, const std::vector< float > &ptsB, const std::vector< float > &ptsC) |
void | reassignGroups (unsigned int i) |
reassign the physical groups to a single number More... | |
void | removeDuplicateTris () |
Remove exact duplicate triangles. More... | |
void | removeStrayTris () |
void | mergeDuplicateVertices (float tolerance) |
bool | isSane (bool output=false, std::ostream &outStream=std::cerr) const |
Perform various sanity tests on mesh. Should return true if your mesh is sane. More... | |
void | getBounds (BoundCube &b) const |
Get the Axis aligned bounding box for this mesh. More... | |
unsigned int | countTriNodes () const |
Count the number of unique nodes shared by triangles. More... | |
void | translate () |
Translate mesh around node centroid. More... | |
void | translate (const Point3f &origin) |
Translate mesh to specified position. More... | |
void | translate (const Point3D &origin) |
void | scale (const Point3f &origin, float scalefactor) |
Scale the mesh around a specified origin. More... | |
void | scale (const Point3D &origin, float scaleFactor) |
Scale the mesh around a specified origin. More... | |
void | scale (float scaleFactor) |
Scale the mesh around origin. More... | |
void | rotate (const Point3f &axis, const Point3f &origin, float angle) |
Rotate mesh. More... | |
float | getVolume () const |
Obtain the volume of the triangulated space. More... | |
void | resurface (unsigned int newPhys) |
place triangles over exposed tetrahedral faces More... | |
void | clear () |
Clear the mesh. More... | |
bool | isTetFullyConnected (unsigned int &badTet) const |
Check to see if the mesh is a single unit of tetrahedra. More... | |
void | refineTetrahedra (std::vector< size_t > &refineTets) |
Refine the selected tetrahedra using a midpoint division method. More... | |
void | getAttachedComponents (size_t tet, std::vector< size_t > &tris, std::vector< size_t > &l) const |
Get the line and triangle segments that are connected to a particular tetrahedron. More... | |
void | getContainedNodes (const BoundCube &b, std::vector< size_t > &nodes) const |
Return all the nodes that are contained within specified bounding box. More... | |
void | getIntersectingPrimitives (std::vector< size_t > &searchNodes, std::vector< size_t > &lines, std::vector< size_t > &triangles, std::vector< size_t > &tetrahedra) const |
Return all primitives that are WHOLLY contained withing bounding box. More... | |
unsigned int | divideMeshSurface (float divisionAngle, unsigned int newPhysGroupStart, const std::vector< size_t > &physGroupsToSplit) |
void | getCurPhysGroups (std::vector< std::pair< unsigned int, size_t > > &curPhys) const |
void | erasePhysGroup (unsigned int group, unsigned int typeMask) |
unsigned int | numDupVertices (float tolerance) const |
unsigned int | numDupTris () const |
void | print (std::ostream &o) const |
void | orientTriEdgesCoherently () |
bool | isOrientedCoherently () const |
void | killOrphanNodes () |
Kill specified orphan nodes within this dataset. More... | |
void | relax (size_t iterations, float relaxFactor) |
Perform vertex weighted relaxation. More... | |
void | pointsInside (const std::vector< Point3D > &p, std::vector< bool > &meshResults, std::ostream &msgs, bool wantProg) const |
size_t | getNearestTri (const Point3D &p, float &distance) const |
void | getTriNormal (size_t tri, Point3D &normal) const |
Public Attributes | |
std::vector< Point3D > | nodes |
Point storage for 3D Data (nodes/coords/vertices..) More... | |
std::vector< std::string > | physGroupNames |
Physical group storage. More... | |
std::vector< TETRAHEDRON > | tetrahedra |
Storage for node connectivity in tet. form. More... | |
std::vector< TRIANGLE > | triangles |
Storage for node connectivity in triangle form (take in groups of 3) More... | |
std::vector< LINE > | lines |
Storage for line segments. .size()%2 should always==0. More... | |
std::vector< unsigned long long > | points |
void Mesh::clear | ( | ) |
Clear the mesh.
References lines, nodes, physGroupNames, points, tetrahedra, and triangles.
Referenced by setTriangleMesh().
unsigned int Mesh::countTriNodes | ( | ) | const |
Count the number of unique nodes shared by triangles.
References triangles.
unsigned int Mesh::divideMeshSurface | ( | float | divisionAngle, |
unsigned int | newPhysGroupStart, | ||
const std::vector< size_t > & | physGroupsToSplit | ||
) |
References ASSERT, BoundCube::expand(), nodes, BoundCube::setBounds(), BoundCube::setInverseLimits(), and triangles.
size_t Mesh::elementCount | ( | ) | const |
References lines, points, tetrahedra, and triangles.
void Mesh::erasePhysGroup | ( | unsigned int | group, |
unsigned int | typeMask | ||
) |
References ELEMENT_LINE, ELEMENT_TETRAHEDRON, ELEMENT_TRIANGLE, tetrahedra, and triangles.
void Mesh::getAttachedComponents | ( | size_t | tet, |
std::vector< size_t > & | tris, | ||
std::vector< size_t > & | l | ||
) | const |
Get the line and triangle segments that are connected to a particular tetrahedron.
References Point3D::angle(), ASSERT, getTriNormal(), lines, tetrahedra, and triangles.
Referenced by isSane().
void Mesh::getBounds | ( | BoundCube & | b | ) | const |
Get the Axis aligned bounding box for this mesh.
References nodes, and BoundCube::setBounds().
void Mesh::getContainedNodes | ( | const BoundCube & | b, |
std::vector< size_t > & | nodes | ||
) | const |
Return all the nodes that are contained within specified bounding box.
References ASSERT, BoundCube::containsPt(), and nodes.
void Mesh::getCurPhysGroups | ( | std::vector< std::pair< unsigned int, size_t > > & | curPhys | ) | const |
void Mesh::getIntersectingPrimitives | ( | std::vector< size_t > & | searchNodes, |
std::vector< size_t > & | lines, | ||
std::vector< size_t > & | triangles, | ||
std::vector< size_t > & | tetrahedra | ||
) | const |
Return all primitives that are WHOLLY contained withing bounding box.
References ASSERT, lines, tetrahedra, and triangles.
size_t Mesh::getNearestTri | ( | const Point3D & | p, |
float & | distance | ||
) | const |
void Mesh::getTriNormal | ( | size_t | tri, |
Point3D & | normal | ||
) | const |
References ASSERT, Point3D::crossProd(), nodes, Point3D::normalise(), and triangles.
Referenced by getAttachedComponents().
float Mesh::getVolume | ( | ) | const |
Obtain the volume of the triangulated space.
References ASSERT, Point3D::crossProd(), Point3D::dotProd(), isSane(), nodes, TRIANGLE::p, and triangles.
Referenced by relax().
bool Mesh::isOrientedCoherently | ( | ) | const |
bool Mesh::isSane | ( | bool | output = false , |
std::ostream & | outStream = std::cerr |
||
) | const |
Perform various sanity tests on mesh. Should return true if your mesh is sane.
References ASSERT, getAttachedComponents(), lines, nodes, tetrahedra, and triangles.
Referenced by getVolume(), killOrphanNodes(), mergeDuplicateVertices(), numDupTris(), print(), relax(), removeDuplicateTris(), resurface(), saveGmshMesh(), and setTriangleMesh().
bool Mesh::isTetFullyConnected | ( | unsigned int & | badTet | ) | const |
Check to see if the mesh is a single unit of tetrahedra.
References ASSERT, nodes, and tetrahedra.
void Mesh::killOrphanNodes | ( | ) |
Kill specified orphan nodes within this dataset.
References ASSERT, isSane(), lines, nodes, points, tetrahedra, and triangles.
Referenced by mergeDuplicateVertices(), and print().
unsigned int Mesh::loadGmshMesh | ( | const char * | meshfile, |
unsigned int & | curLine, | ||
bool | allowBadMeshes = true |
||
) |
void Mesh::mergeDuplicateVertices | ( | float | tolerance | ) |
References ASSERT, findNearVerticies(), isSane(), killOrphanNodes(), lines, nodes, points, tetrahedra, and triangles.
unsigned int Mesh::numDupVertices | ( | float | tolerance | ) | const |
References nodes.
void Mesh::orientTriEdgesCoherently | ( | ) |
void Mesh::pointsInside | ( | const std::vector< Point3D > & | p, |
std::vector< bool > & | meshResults, | ||
std::ostream & | msgs, | ||
bool | wantProg | ||
) | const |
References ASSERT, BoundCube::containsPt(), intersect_RayTriangle(), nodes, PROGRESS_REDUCE, BoundCube::setBounds(), tetrahedra, and triangles.
void Mesh::print | ( | std::ostream & | o | ) | const |
References ASSERT, fourDeterminant(), isSane(), killOrphanNodes(), lines, nodes, TRIANGLE::p, points, BoundCube::setBounds(), tetrahedra, and triangles.
void Mesh::reassignGroups | ( | unsigned int | i | ) |
reassign the physical groups to a single number
References lines, tetrahedra, and triangles.
void Mesh::refineTetrahedra | ( | std::vector< size_t > & | refineTets | ) |
Refine the selected tetrahedra using a midpoint division method.
References ASSERT, nodes, TETRAHEDRON::p, tetrahedra, and triangles.
void Mesh::relax | ( | size_t | iterations, |
float | relaxFactor | ||
) |
Perform vertex weighted relaxation.
References ASSERT, getVolume(), isSane(), lines, M_PI, nodes, tetrahedra, and triangles.
void Mesh::removeDuplicateTris | ( | ) |
void Mesh::resurface | ( | unsigned int | newPhys | ) |
place triangles over exposed tetrahedral faces
References ASSERT, BoundCube::expand(), getCurPhysGroups(), isSane(), nodes, TRIANGLE::p, TRIANGLE::physGroup, BoundCube::setBounds(), BoundCube::setInverseLimits(), tetrahedra, and triangles.
unsigned int Mesh::saveGmshMesh | ( | const char * | meshfile | ) | const |
References ASSERT, ELEM_FOUR_NODE_TETRAHEDRON, ELEM_SINGLE_NODE_POINT, ELEM_THREE_NODE_TRIANGLE, ELEM_TWO_NODE_LINE, isSane(), lines, nodes, points, tetrahedra, and triangles.
void Mesh::scale | ( | const Point3f & | origin, |
float | scalefactor | ||
) |
Scale the mesh around a specified origin.
References Point3f::fx, Point3f::fy, Point3f::fz, and nodes.
void Mesh::scale | ( | const Point3D & | origin, |
float | scaleFactor | ||
) |
Scale the mesh around a specified origin.
References nodes.
void Mesh::scale | ( | float | scaleFactor | ) |
Scale the mesh around origin.
References nodes.
void Mesh::setTriangleMesh | ( | const std::vector< float > & | ptsA, |
const std::vector< float > & | ptsB, | ||
const std::vector< float > & | ptsC | ||
) |
References ASSERT, clear(), findNearVerticies(), isSane(), nodes, TRIANGLE::p, and triangles.
void Mesh::translate | ( | ) |
Translate mesh around node centroid.
References nodes.
void Mesh::translate | ( | const Point3f & | origin | ) |
Translate mesh to specified position.
References Point3f::fx, Point3f::fy, Point3f::fz, and nodes.
std::vector<LINE> Mesh::lines |
Storage for line segments. .size()%2 should always==0.
Referenced by clear(), elementCount(), getAttachedComponents(), getIntersectingPrimitives(), isSane(), killOrphanNodes(), mergeDuplicateVertices(), print(), reassignGroups(), relax(), and saveGmshMesh().
std::vector<Point3D> Mesh::nodes |
Point storage for 3D Data (nodes/coords/vertices..)
Referenced by clear(), divideMeshSurface(), getBounds(), getContainedNodes(), getTriNormal(), getVolume(), TRIANGLE::isSane(), isSane(), isTetFullyConnected(), killOrphanNodes(), mergeDuplicateVertices(), numDupTris(), numDupVertices(), pointsInside(), print(), refineTetrahedra(), relax(), removeDuplicateTris(), resurface(), saveGmshMesh(), scale(), setTriangleMesh(), and translate().
std::vector<std::string> Mesh::physGroupNames |
Physical group storage.
Referenced by clear().
std::vector<unsigned long long> Mesh::points |
Referenced by clear(), elementCount(), killOrphanNodes(), mergeDuplicateVertices(), print(), and saveGmshMesh().
std::vector<TETRAHEDRON> Mesh::tetrahedra |
Storage for node connectivity in tet. form.
Referenced by clear(), elementCount(), erasePhysGroup(), getAttachedComponents(), getIntersectingPrimitives(), isSane(), isTetFullyConnected(), killOrphanNodes(), mergeDuplicateVertices(), pointsInside(), print(), reassignGroups(), refineTetrahedra(), relax(), resurface(), and saveGmshMesh().
std::vector<TRIANGLE> Mesh::triangles |
Storage for node connectivity in triangle form (take in groups of 3)
Referenced by clear(), countTriNodes(), divideMeshSurface(), elementCount(), erasePhysGroup(), getAttachedComponents(), getCurPhysGroups(), getIntersectingPrimitives(), getTriNormal(), getVolume(), TRIANGLE::isSane(), isSane(), killOrphanNodes(), mergeDuplicateVertices(), numDupTris(), pointsInside(), print(), reassignGroups(), refineTetrahedra(), relax(), removeDuplicateTris(), removeStrayTris(), resurface(), saveGmshMesh(), and setTriangleMesh().