$treeview $search $mathjax
|
Palabos
Version 1.1
$projectbrief
|
$projectbrief
|
$searchbox |
#include <triangularSurfaceMesh.h>
Classes | |
| struct | Edge |
| Holds one of the three edges of a triangle. More... | |
| struct | Lid |
Public Member Functions | |
| TriangularSurfaceMesh (std::vector< Array< T, 3 > > &vertexList_, std::vector< plint > &emanatingEdgeList_, std::vector< Edge > &edgeList_, plint numVertices_=-1) | |
| plint | getNumTriangles () const |
| plint | getNumVertices () const |
| void | replaceVertex (plint iVertex, Array< T, 3 > const &newPosition) |
| Reset the position of a vertex to a new value;. | |
| void | resetVertices (Array< T, 3 > const &defaultVertex) |
| Reset all vertices of a mesh to a default value. | |
| Array< T, 3 > const & | getVertex (plint iTriangle, int localVertex) const |
| Array< T, 3 > const & | getVertex (plint iVertex) const |
| Get the coordinates of one of the vertices by providing its global index. | |
| bool | isValidVertex (plint iTriangle, int localVertex) const |
| bool | isValidVertex (plint iVertex) const |
| void | computeBoundingBox (Array< T, 2 > &xRange, Array< T, 2 > &yRange, Array< T, 2 > &zRange) const |
| Compute the minimum and maximum vertex positions in every direction. | |
| void | translate (Array< T, 3 > const &vector) |
| Translate the surface mesh. | |
| void | scale (T alpha) |
| Scale the surface mesh. | |
| void | rotate (T phi, T theta, T psi) |
| void | smooth (plint maxiter=1, T relax=1.0, bool isMeasureWeighted=false) |
| plint | getVertexId (plint iTriangle, plint localVertex) const |
| Get the global vertex index of a specific vertex local to a triangle. | |
| std::vector< plint > | getNeighborVertexIds (plint iVertex) const |
| Get a list of the neighboring vertices of a given vertex. | |
| std::vector< plint > | getNeighborVertexIds (plint iVertex, plint jVertex) const |
| Get a list of the neighboring vertices of a given edge. | |
| std::vector< plint > | getNeighborTriangleIds (plint iVertex) const |
| Get a list of the neighboring triangles of a given vertex. | |
| std::vector< plint > | getAdjacentTriangleIds (plint iTriangle) const |
| std::vector< plint > | getAdjacentTriangleIds (plint iVertex, plint jVertex) const |
| Array< T, 3 > | computeTriangleNormal (plint iTriangle, bool isAreaWeighted=false) const |
| Array< T, 3 > | computeTriangleNormal (plint iVertex, plint jVertex, plint kVertex, bool isAreaWeighted=false) const |
| Array< T, 3 > | computeEdgeNormal (plint iVertex, plint jVertex, bool isAreaWeighted=false) const |
| Array< T, 3 > | computeVertexNormal (plint iVertex, bool isAreaWeighted=false) const |
| Array< T, 3 > | computeContinuousNormal (Array< T, 3 > const &p, plint iTriangle, bool isAreaWeighted=false) const |
| T | computeTriangleArea (plint iTriangle) const |
| Compute the area of a given triangle. | |
| T | computeTriangleArea (plint iVertex, plint jVertex, plint kVertex) const |
| T | computeEdgeArea (plint iVertex, plint jVertex) const |
| T | computeVertexArea (plint iVertex) const |
| T | computeEdgeLength (plint iVertex, plint jVertex) const |
| Compute the length of a given edge. | |
| T | computeDihedralAngle (plint iVertex, plint jVertex) const |
| T | computeEdgeTileSpan (plint iVertex, plint jVertex) const |
| void | writeAsciiSTL (std::string fname) const |
| Export the surface mesh as an ASCII STL file. | |
| void | writeBinarySTL (std::string fname) const |
| Export the surface mesh as an binary STL file. | |
| bool | isBoundaryVertex (plint iVertex) const |
| bool | isInteriorVertex (plint iVertex) const |
| bool | isBoundaryEdge (plint iVertex, plint jVertex) const |
| bool | isInteriorEdge (plint iVertex, plint jVertex) const |
| int | pointOnTriangle (Array< T, 3 > const &point1, Array< T, 3 > const &point2, int flag, plint iTriangle, Array< T, 3 > &intersection, Array< T, 3 > &normal, T &distance) const |
| bool | segmentIntersectsTriangle (Array< T, 3 > const &point1, Array< T, 3 > const &point2, plint iTriangle) const |
| void | distanceToEdgeLine (Array< T, 3 > const &point, plint iTriangle, plint whichEdge, T &distance, bool &intersectionIsInside) const |
| void | distanceToTrianglePlane (Array< T, 3 > const &point, plint iTriangle, T &distance, bool &intersectionIsInside, bool &pointIsBehind) const |
| void | distanceToTriangle (Array< T, 3 > const &point, plint iTriangle, T &distance, bool &pointIsBehind) const |
| void | reverseOrientation () |
| Function to reverse the orientation of the given surface mesh. | |
| std::vector< Lid > | closeHoles () |
| std::vector< std::vector< plint > > | detectHoles () |
| Returns, for each detected hole, a list of vertices. | |
| void | avoidIntegerPositions () |
| void | avoidIntegerPosition (plint iVertex) |
| void | inflate (T amount=1.e-3) |
| std::vector< Array< T, 3 > > const & | vertices () const |
| Get a handle to the vertices. | |
| std::vector< plint > const & | emanatingEdges () const |
| Get a handle to the emanating edges. | |
| std::vector< Edge > const & | edges () const |
| Get a handle to the edges. | |
| Array< T, 3 > & | getVertex (plint iTriangle, int localVertex) |
| Array< T, 3 > & | getVertex (plint iVertex) |
| Get the coordinates of one of the vertices by providing its global index (non-const). | |
Static Public Attributes | |
| static const T | eps0 = std::numeric_limits<T>::epsilon() |
| static const T | eps1 |
Represent a surface mesh, made up of adjacent triangles, in a directed-edge format. This format conveniently provides access to the surface topology through triangles and vertices, but is less convenient for accessing it directly through edges.
The triangles are numbered continuously from 0 to getNumTriangles()-1, and the vertices from 0 to getNumVertices()-1.
Once the mesh is constructed, you can change the position of its vertices, but you should not change its topology, which is static. One exception: the method closeHoles changes the topology.
For more information on the directed-edges format, check the paper "Directed edges - A scalable representation for triangle meshes", Journal of Graphics Tools (3), 1998, pp 1 - 11
| plb::TriangularSurfaceMesh< T >::TriangularSurfaceMesh | ( | std::vector< Array< T, 3 > > & | vertexList_, | |
| std::vector< plint > & | emanatingEdgeList_, | |||
| std::vector< Edge > & | edgeList_, | |||
| plint | numVertices_ = -1 | |||
| ) |
The ownership over the parameters vertexList, emanatingEdgeList, and edgeList is not taken by the class TriangularSurfaceMesh, and they are not being copied. They must be managed from outside and kept alive up to the usage time of the TriangularSurfaceMesh instance. The user may choose to disregard vertices at the end of vertexList, and to only use a selected amount at the beginning: do this through the parameter numVertices. A negative value for numVertices means: use all vertices in vertexList.
| void plb::TriangularSurfaceMesh< T >::avoidIntegerPosition | ( | plint | iVertex | ) | [inline] |
| void plb::TriangularSurfaceMesh< T >::avoidIntegerPositions | ( | ) | [inline] |
| std::vector< typename TriangularSurfaceMesh< T >::Lid > plb::TriangularSurfaceMesh< T >::closeHoles | ( | ) | [inline] |
Detect holes in the mesh and fill each of them by creating a lid, i.e. a collection of triangles created by adding a single new vertex at the barycenter of the hole, and connecting it radially with each boundary vertex of the hole. Returns a Lid structure for each created lid.
References plb::TriangularSurfaceMesh< T >::detectHoles().
| void plb::TriangularSurfaceMesh< T >::computeBoundingBox | ( | Array< T, 2 > & | xRange, | |
| Array< T, 2 > & | yRange, | |||
| Array< T, 2 > & | zRange | |||
| ) | const [inline] |
Compute the minimum and maximum vertex positions in every direction.
References plb::TriangularSurfaceMesh< T >::getNumVertices(), and plb::TriangularSurfaceMesh< T >::getVertex().
Referenced by plb::toLatticeUnits(), and plb::voxelize().
| Array< T, 3 > plb::TriangularSurfaceMesh< T >::computeContinuousNormal | ( | Array< T, 3 > const & | p, | |
| plint | iTriangle, | |||
| bool | isAreaWeighted = false | |||
| ) | const [inline] |
Compute a "continuous" normal at a point "p" which belongs to the triangle with index "iTriangle". The computed normal vector is normalized (has length equal to one) and is continuous as its base point moves across the triangles. The point "p" must belong to the interior or to the boundary of the triangle with index "iTriangle". The currently implemented algorithm uses a barycentric coordinate representation of the normal with respect to the three vertex normals of the given triangle. If "isAreaWeighted" is true, then the vertex normals used in the barycentric representation are area weighted.
References plb::TriangularSurfaceMesh< T >::computeTriangleArea(), plb::TriangularSurfaceMesh< T >::computeVertexNormal(), plb::crossProduct(), plb::TriangularSurfaceMesh< T >::getVertex(), plb::TriangularSurfaceMesh< T >::getVertexId(), and plb::norm().
| T plb::TriangularSurfaceMesh< T >::computeDihedralAngle | ( | plint | iVertex, | |
| plint | jVertex | |||
| ) | const [inline] |
Compute the dihedral angle of an edge (in radians). By convention, if the edge is a boundary edge, the dihedral angle returned by the function is 0.
References plb::angleBetweenVectors(), plb::TriangularSurfaceMesh< T >::computeTriangleNormal(), and plb::TriangularSurfaceMesh< T >::getAdjacentTriangleIds().
| T plb::TriangularSurfaceMesh< T >::computeEdgeArea | ( | plint | iVertex, | |
| plint | jVertex | |||
| ) | const [inline] |
Compute the one third of the sum of the areas of the triangles that share the specific edge.
References plb::TriangularSurfaceMesh< T >::computeTriangleArea(), and plb::TriangularSurfaceMesh< T >::getAdjacentTriangleIds().
| T plb::TriangularSurfaceMesh< T >::computeEdgeLength | ( | plint | iVertex, | |
| plint | jVertex | |||
| ) | const [inline] |
Compute the length of a given edge.
References plb::TriangularSurfaceMesh< T >::getNeighborVertexIds(), plb::TriangularSurfaceMesh< T >::getVertex(), plb::norm(), and PLB_ASSERT.
Referenced by plb::computeInnerRadius(), and plb::computeOuterRadius().
| Array< T, 3 > plb::TriangularSurfaceMesh< T >::computeEdgeNormal | ( | plint | iVertex, | |
| plint | jVertex, | |||
| bool | isAreaWeighted = false | |||
| ) | const [inline] |
Compute the normal vector at a given edge. If "isAreaWeighted" is true, then the triangle normals used in the computation are area weighted.
References plb::TriangularSurfaceMesh< T >::computeTriangleNormal(), plb::TriangularSurfaceMesh< T >::getAdjacentTriangleIds(), plb::norm(), and plb::Array< T, 3 >::resetToZero().
Referenced by plb::TriangularSurfaceMesh< T >::pointOnTriangle().
| T plb::TriangularSurfaceMesh< T >::computeEdgeTileSpan | ( | plint | iVertex, | |
| plint | jVertex | |||
| ) | const [inline] |
Compute the one sixth of the sum of the heights of the two triangles incident to the specific edge.
References plb::angleBetweenVectors(), plb::TriangularSurfaceMesh< T >::getNeighborVertexIds(), plb::TriangularSurfaceMesh< T >::getVertex(), and plb::norm().
| T plb::TriangularSurfaceMesh< T >::computeTriangleArea | ( | plint | iVertex, | |
| plint | jVertex, | |||
| plint | kVertex | |||
| ) | const [inline] |
| T plb::TriangularSurfaceMesh< T >::computeTriangleArea | ( | plint | iTriangle | ) | const [inline] |
Compute the area of a given triangle.
References plb::crossProduct(), plb::TriangularSurfaceMesh< T >::getVertex(), and plb::norm().
Referenced by plb::computeArea(), plb::TriangularSurfaceMesh< T >::computeContinuousNormal(), plb::TriangularSurfaceMesh< T >::computeEdgeArea(), plb::TriangularSurfaceMesh< T >::computeTriangleArea(), and plb::TriangularSurfaceMesh< T >::computeVertexArea().
| Array< T, 3 > plb::TriangularSurfaceMesh< T >::computeTriangleNormal | ( | plint | iVertex, | |
| plint | jVertex, | |||
| plint | kVertex, | |||
| bool | isAreaWeighted = false | |||
| ) | const [inline] |
| Array< T, 3 > plb::TriangularSurfaceMesh< T >::computeTriangleNormal | ( | plint | iTriangle, | |
| bool | isAreaWeighted = false | |||
| ) | const [inline] |
Compute the normal vector for a given triangle. If "isAreaWeighted" is false, then the normal has length equal to one. If "isAreaWeighted" is true, then the normal has length equal to twice the area of the triangle.
References plb::crossProduct(), plb::TriangularSurfaceMesh< T >::getVertex(), plb::norm(), and PLB_ASSERT.
Referenced by plb::TriangularSurfaceMesh< T >::computeDihedralAngle(), plb::TriangularSurfaceMesh< T >::computeEdgeNormal(), plb::TriangularSurfaceMesh< T >::computeVertexNormal(), plb::TriangularSurfaceMesh< T >::distanceToTrianglePlane(), plb::TriangularSurfaceMesh< T >::writeAsciiSTL(), and plb::TriangularSurfaceMesh< T >::writeBinarySTL().
| T plb::TriangularSurfaceMesh< T >::computeVertexArea | ( | plint | iVertex | ) | const [inline] |
Compute the one third of the sum of the areas of all triangles that share the given vertex.
References plb::TriangularSurfaceMesh< T >::computeTriangleArea(), and plb::TriangularSurfaceMesh< T >::getNeighborTriangleIds().
| Array< T, 3 > plb::TriangularSurfaceMesh< T >::computeVertexNormal | ( | plint | iVertex, | |
| bool | isAreaWeighted = false | |||
| ) | const [inline] |
Compute the normal vector at a given vertex. If "isAreaWeighted" is false, then the vertex normal is calculated as the simple normalized sum of the individual unit normals of the triangles which share the specific vertex. If "isAreaWeighted" is true, then the vertex normal is calculated as the normalized sum of the individual area weighted normals of the triangles which share the vertex under consideration.
References plb::TriangularSurfaceMesh< T >::computeTriangleNormal(), plb::TriangularSurfaceMesh< T >::getNeighborTriangleIds(), plb::norm(), and plb::Array< T, 3 >::resetToZero().
Referenced by plb::TriangularSurfaceMesh< T >::avoidIntegerPosition(), plb::TriangularSurfaceMesh< T >::computeContinuousNormal(), plb::computeNormal(), plb::TriangularSurfaceMesh< T >::inflate(), and plb::TriangularSurfaceMesh< T >::pointOnTriangle().
| std::vector< std::vector< plint > > plb::TriangularSurfaceMesh< T >::detectHoles | ( | ) | [inline] |
Returns, for each detected hole, a list of vertices.
References plb::TriangularSurfaceMesh< T >::edges(), plb::TriangularSurfaceMesh< T >::emanatingEdges(), plb::TriangularSurfaceMesh< T >::getNumVertices(), plb::TriangularSurfaceMesh< T >::isBoundaryVertex(), and plb::TriangularSurfaceMesh< T >::Edge::pv.
Referenced by plb::TriangularSurfaceMesh< T >::closeHoles().
| void plb::TriangularSurfaceMesh< T >::distanceToEdgeLine | ( | Array< T, 3 > const & | point, | |
| plint | iTriangle, | |||
| plint | whichEdge, | |||
| T & | distance, | |||
| bool & | intersectionIsInside | |||
| ) | const [inline] |
Compute the distance between a point and a line which goes through a given edge. Returns also a flag indicating whether the location on the line which is closest to the point is inside the edge or not.
References plb::dot(), plb::TriangularSurfaceMesh< T >::edges(), plb::TriangularSurfaceMesh< T >::eps1, plb::util::fpequal_abs(), plb::TriangularSurfaceMesh< T >::getVertex(), plb::norm(), and PLB_ASSERT.
Referenced by plb::TriangularSurfaceMesh< T >::distanceToTriangle().
| void plb::TriangularSurfaceMesh< T >::distanceToTriangle | ( | Array< T, 3 > const & | point, | |
| plint | iTriangle, | |||
| T & | distance, | |||
| bool & | pointIsBehind | |||
| ) | const [inline] |
Compute the distance between the point and a triangle. The location on the triangle the distance to which is being computed is chosen as follows. The point is first projected on the plane defined by the triangle. If the obtained location is inside the triangle it is being selected. Otherwise, it is projected on the three lines defined by the edges, and the nearest one is picked out. If it is inside the edge it is being selected. Otherwise, the answer consists of the shortest distance between the point and the three vertices. Note that none of the three cases (plane, edge, vertex) is degenerate: there exists an infinity of points in space for which the nearest distance to the triangle is on a vertex.
References plb::TriangularSurfaceMesh< T >::distanceToEdgeLine(), plb::TriangularSurfaceMesh< T >::distanceToTrianglePlane(), plb::TriangularSurfaceMesh< T >::getVertex(), and plb::normSqr().
| void plb::TriangularSurfaceMesh< T >::distanceToTrianglePlane | ( | Array< T, 3 > const & | point, | |
| plint | iTriangle, | |||
| T & | distance, | |||
| bool & | intersectionIsInside, | |||
| bool & | pointIsBehind | |||
| ) | const [inline] |
Compute the distance between a point and a plane which goes through a given triangle. Returns two flags. The first indicates whether the location on the plane which is closest to the point is inside the triangle or not. The second indicates whether the point is "behind" the plane, i.e. on the side which is opposed to the triangle normal.
References plb::TriangularSurfaceMesh< T >::computeTriangleNormal(), plb::dot(), plb::TriangularSurfaceMesh< T >::eps1, plb::util::fpequal_abs(), and plb::TriangularSurfaceMesh< T >::pointOnTriangle().
Referenced by plb::TriangularSurfaceMesh< T >::distanceToTriangle().
| std::vector<Edge> const& plb::TriangularSurfaceMesh< T >::edges | ( | ) | const [inline] |
Get a handle to the edges.
References PLB_PRECONDITION.
Referenced by plb::computeGeometricCenter(), plb::computeGeometricRadius(), plb::TriangularSurfaceMesh< T >::detectHoles(), plb::TriangularSurfaceMesh< T >::distanceToEdgeLine(), plb::TriangularSurfaceMesh< T >::getAdjacentTriangleIds(), plb::TriangularSurfaceMesh< T >::getNeighborTriangleIds(), plb::TriangularSurfaceMesh< T >::getNeighborVertexIds(), plb::TriangularSurfaceMesh< T >::getVertex(), plb::TriangularSurfaceMesh< T >::getVertexId(), plb::TriangularSurfaceMesh< T >::isBoundaryVertex(), plb::TriangularSurfaceMesh< T >::isInteriorVertex(), plb::TriangularSurfaceMesh< T >::isValidVertex(), and plb::TriangularSurfaceMesh< T >::reverseOrientation().
| std::vector<plint> const& plb::TriangularSurfaceMesh< T >::emanatingEdges | ( | ) | const [inline] |
Get a handle to the emanating edges.
References PLB_PRECONDITION.
Referenced by plb::computeGeometricCenter(), plb::computeGeometricRadius(), plb::TriangularSurfaceMesh< T >::detectHoles(), plb::TriangularSurfaceMesh< T >::getNeighborTriangleIds(), plb::TriangularSurfaceMesh< T >::getNeighborVertexIds(), plb::TriangularSurfaceMesh< T >::isBoundaryVertex(), plb::TriangularSurfaceMesh< T >::isInteriorVertex(), and plb::TriangularSurfaceMesh< T >::reverseOrientation().
| std::vector< plint > plb::TriangularSurfaceMesh< T >::getAdjacentTriangleIds | ( | plint | iVertex, | |
| plint | jVertex | |||
| ) | const [inline] |
Get a list of the adjacent triangles of a given edge. The adjacent triangles to a specific edge are defined as those that have the specific edge common.
References plb::TriangularSurfaceMesh< T >::getNeighborTriangleIds(), plb::TriangularSurfaceMesh< T >::getNeighborVertexIds(), plb::TriangularSurfaceMesh< T >::getVertexId(), and PLB_ASSERT.
| std::vector< plint > plb::TriangularSurfaceMesh< T >::getAdjacentTriangleIds | ( | plint | iTriangle | ) | const [inline] |
Get a list of the adjacent triangles of a given triangle. The adjacent triangles to a specific triangle are defined as those that have common edges with the given triangle.
References plb::TriangularSurfaceMesh< T >::edges(), and PLB_ASSERT.
Referenced by plb::TriangularSurfaceMesh< T >::computeDihedralAngle(), plb::TriangularSurfaceMesh< T >::computeEdgeArea(), plb::TriangularSurfaceMesh< T >::computeEdgeNormal(), plb::TriangularSurfaceMesh< T >::getNeighborVertexIds(), and plb::TriangularSurfaceMesh< T >::isBoundaryEdge().
| std::vector< plint > plb::TriangularSurfaceMesh< T >::getNeighborTriangleIds | ( | plint | iVertex | ) | const [inline] |
Get a list of the neighboring triangles of a given vertex.
References plb::TriangularSurfaceMesh< T >::edges(), plb::TriangularSurfaceMesh< T >::emanatingEdges(), and PLB_ASSERT.
Referenced by plb::TriangularSurfaceMesh< T >::computeVertexArea(), plb::TriangularSurfaceMesh< T >::computeVertexNormal(), plb::TriangularSurfaceMesh< T >::getAdjacentTriangleIds(), and plb::TriangleHash< T >::reAssignTriangles().
| std::vector< plint > plb::TriangularSurfaceMesh< T >::getNeighborVertexIds | ( | plint | iVertex, | |
| plint | jVertex | |||
| ) | const [inline] |
Get a list of the neighboring vertices of a given edge.
References plb::TriangularSurfaceMesh< T >::getAdjacentTriangleIds(), plb::TriangularSurfaceMesh< T >::getVertexId(), and PLB_ASSERT.
| std::vector< plint > plb::TriangularSurfaceMesh< T >::getNeighborVertexIds | ( | plint | iVertex | ) | const [inline] |
Get a list of the neighboring vertices of a given vertex.
References plb::TriangularSurfaceMesh< T >::edges(), plb::TriangularSurfaceMesh< T >::emanatingEdges(), and PLB_ASSERT.
Referenced by plb::TriangularSurfaceMesh< T >::computeEdgeLength(), plb::TriangularSurfaceMesh< T >::computeEdgeTileSpan(), plb::TriangularSurfaceMesh< T >::computeTriangleArea(), plb::TriangularSurfaceMesh< T >::computeTriangleNormal(), plb::TriangularSurfaceMesh< T >::getAdjacentTriangleIds(), and plb::TriangularSurfaceMesh< T >::smooth().
| plint plb::TriangularSurfaceMesh< T >::getNumTriangles | ( | ) | const [inline] |
Return number of triangles on the surface (they are numbered continuously from 0 to getNumTriangles() -1.
Referenced by plb::TriangleHash< T >::assignTriangles(), and plb::TriangleHash< T >::bruteReAssignTriangles().
| plint plb::TriangularSurfaceMesh< T >::getNumVertices | ( | ) | const [inline] |
Return number of vertices on the surface (they are numbered continuously from 0 to getNumVertices() -1.
Referenced by plb::TriangularSurfaceMesh< T >::avoidIntegerPositions(), plb::TriangularSurfaceMesh< T >::computeBoundingBox(), plb::TriangularSurfaceMesh< T >::detectHoles(), plb::TriangularSurfaceMesh< T >::inflate(), plb::TriangularSurfaceMesh< T >::replaceVertex(), and plb::TriangularSurfaceMesh< T >::resetVertices().
| Array< T, 3 > & plb::TriangularSurfaceMesh< T >::getVertex | ( | plint | iVertex | ) | [inline] |
Get the coordinates of one of the vertices by providing its global index (non-const).
References PLB_ASSERT, and plb::TriangularSurfaceMesh< T >::vertices().
| Array< T, 3 > & plb::TriangularSurfaceMesh< T >::getVertex | ( | plint | iTriangle, | |
| int | localVertex | |||
| ) | [inline] |
Get one of the three vertices of a given triangle (non-const). "localVertex" must be 0, 1 or 2.
References plb::TriangularSurfaceMesh< T >::edges(), PLB_ASSERT, and plb::TriangularSurfaceMesh< T >::vertices().
| Array< T, 3 > const & plb::TriangularSurfaceMesh< T >::getVertex | ( | plint | iVertex | ) | const [inline] |
Get the coordinates of one of the vertices by providing its global index.
References PLB_ASSERT, and plb::TriangularSurfaceMesh< T >::vertices().
| Array< T, 3 > const & plb::TriangularSurfaceMesh< T >::getVertex | ( | plint | iTriangle, | |
| int | localVertex | |||
| ) | const [inline] |
Get one of the three vertices of a given triangle. "localVertex" must be 0, 1 or 2.
References plb::TriangularSurfaceMesh< T >::edges(), PLB_ASSERT, and plb::TriangularSurfaceMesh< T >::vertices().
Referenced by plb::TriangleHash< T >::assignTriangles(), plb::TriangularSurfaceMesh< T >::avoidIntegerPosition(), plb::TriangleHash< T >::bruteReAssignTriangles(), plb::computeBaryCenter(), plb::computeBoundingBox(), plb::TriangularSurfaceMesh< T >::computeBoundingBox(), plb::TriangularSurfaceMesh< T >::computeContinuousNormal(), plb::TriangularSurfaceMesh< T >::computeEdgeLength(), plb::TriangularSurfaceMesh< T >::computeEdgeTileSpan(), plb::computeGeometricCenter(), plb::computeGeometricRadius(), plb::TriangularSurfaceMesh< T >::computeTriangleArea(), plb::TriangularSurfaceMesh< T >::computeTriangleNormal(), plb::TriangularSurfaceMesh< T >::distanceToEdgeLine(), plb::TriangularSurfaceMesh< T >::distanceToTriangle(), plb::TriangularSurfaceMesh< T >::inflate(), plb::TriangularSurfaceMesh< T >::pointOnTriangle(), plb::TriangleHash< T >::reAssignTriangles(), plb::TriangularSurfaceMesh< T >::rotate(), plb::TriangularSurfaceMesh< T >::scale(), plb::TriangularSurfaceMesh< T >::segmentIntersectsTriangle(), plb::TriangularSurfaceMesh< T >::translate(), plb::TriangularSurfaceMesh< T >::writeAsciiSTL(), and plb::TriangularSurfaceMesh< T >::writeBinarySTL().
| plint plb::TriangularSurfaceMesh< T >::getVertexId | ( | plint | iTriangle, | |
| plint | localVertex | |||
| ) | const [inline] |
Get the global vertex index of a specific vertex local to a triangle.
References plb::TriangularSurfaceMesh< T >::edges(), and PLB_ASSERT.
Referenced by plb::TriangularSurfaceMesh< T >::computeContinuousNormal(), plb::TriangularSurfaceMesh< T >::getAdjacentTriangleIds(), plb::TriangularSurfaceMesh< T >::getNeighborVertexIds(), plb::TriangularSurfaceMesh< T >::pointOnTriangle(), and plb::TriangularSurfaceMesh< T >::reverseOrientation().
| void plb::TriangularSurfaceMesh< T >::inflate | ( | T | amount = 1.e-3 |
) | [inline] |
| bool plb::TriangularSurfaceMesh< T >::isBoundaryEdge | ( | plint | iVertex, | |
| plint | jVertex | |||
| ) | const [inline] |
Return true if the edge belongs to the boundary or false if the edge belongs to the interior of the mesh.
References plb::TriangularSurfaceMesh< T >::getAdjacentTriangleIds().
Referenced by plb::TriangularSurfaceMesh< T >::isInteriorEdge(), and plb::TriangularSurfaceMesh< T >::smooth().
| bool plb::TriangularSurfaceMesh< T >::isBoundaryVertex | ( | plint | iVertex | ) | const [inline] |
Return true if the vertex belongs to the boundary or false if the vertex belongs to the interior of the mesh.
References plb::TriangularSurfaceMesh< T >::edges(), plb::TriangularSurfaceMesh< T >::emanatingEdges(), and PLB_ASSERT.
Referenced by plb::TriangularSurfaceMesh< T >::detectHoles(), and plb::TriangularSurfaceMesh< T >::smooth().
| bool plb::TriangularSurfaceMesh< T >::isInteriorEdge | ( | plint | iVertex, | |
| plint | jVertex | |||
| ) | const [inline] |
Return true if the edge belongs to the interior or false if the edge belongs to the boundary of the mesh.
References plb::TriangularSurfaceMesh< T >::isBoundaryEdge().
| bool plb::TriangularSurfaceMesh< T >::isInteriorVertex | ( | plint | iVertex | ) | const [inline] |
Return true if the vertex belongs to the interior or false if the vertex belongs to the boundary of the mesh.
References plb::TriangularSurfaceMesh< T >::edges(), plb::TriangularSurfaceMesh< T >::emanatingEdges(), and PLB_ASSERT.
Referenced by plb::TriangularSurfaceMesh< T >::reverseOrientation(), and plb::TriangularSurfaceMesh< T >::smooth().
| bool plb::TriangularSurfaceMesh< T >::isValidVertex | ( | plint | iVertex | ) | const [inline] |
References plb::global::IOpolicy(), PLB_ASSERT, and plb::TriangularSurfaceMesh< T >::vertices().
| bool plb::TriangularSurfaceMesh< T >::isValidVertex | ( | plint | iTriangle, | |
| int | localVertex | |||
| ) | const [inline] |
| int plb::TriangularSurfaceMesh< T >::pointOnTriangle | ( | Array< T, 3 > const & | point1, | |
| Array< T, 3 > const & | point2, | |||
| int | flag, | |||
| plint | iTriangle, | |||
| Array< T, 3 > & | intersection, | |||
| Array< T, 3 > & | normal, | |||
| T & | distance | |||
| ) | const [inline] |
Function to compute the intersection between a triangle and a line segment between points "point1" and "point2" (if flag = 0), or between a triangle and a half-line starting at "point1" and containing "point2" (if flag = 1), or between a triangle and a whole line containing both "point1" and "point2" (if flag = 2). "intersection", "normal" and "distance" are objects whose states are changed by this function. These states are undefined, and cannot be used by the caller function, when the return value of this function is not 1. Returns 1 if an intersection is found and the intersection is inside the triangle, 0 if there is no intersection or the intersection is outside the triangle, and -1 is the line is parallel to the triangle and intersects with an infinity of points.
References plb::TriangularSurfaceMesh< T >::computeEdgeNormal(), plb::TriangularSurfaceMesh< T >::computeVertexNormal(), plb::crossProduct(), plb::dot(), plb::TriangularSurfaceMesh< T >::eps1, plb::util::fpequal_abs(), plb::TriangularSurfaceMesh< T >::getVertex(), plb::TriangularSurfaceMesh< T >::getVertexId(), plb::norm(), plb::pcout, and PLB_ASSERT.
Referenced by plb::TriangularSurfaceMesh< T >::distanceToTrianglePlane().
| void plb::TriangularSurfaceMesh< T >::replaceVertex | ( | plint | iVertex, | |
| Array< T, 3 > const & | newPosition | |||
| ) | [inline] |
Reset the position of a vertex to a new value;.
References plb::TriangularSurfaceMesh< T >::getNumVertices(), and PLB_PRECONDITION.
Referenced by plb::reCenter().
| void plb::TriangularSurfaceMesh< T >::resetVertices | ( | Array< T, 3 > const & | defaultVertex | ) | [inline] |
Reset all vertices of a mesh to a default value.
This function is used when debugging programs in which the access to the mesh is parallelized. Default values can be used to point out undefined state. In debug mode, vertices are identified to be invalid if all three coordinates are distinctly less than -1.
References plb::TriangularSurfaceMesh< T >::getNumVertices(), and plb::TriangularSurfaceMesh< T >::vertices().
| void plb::TriangularSurfaceMesh< T >::reverseOrientation | ( | ) | [inline] |
Function to reverse the orientation of the given surface mesh.
References plb::TriangularSurfaceMesh< T >::edges(), plb::TriangularSurfaceMesh< T >::emanatingEdges(), plb::TriangularSurfaceMesh< T >::getVertexId(), and plb::TriangularSurfaceMesh< T >::isInteriorVertex().
| void plb::TriangularSurfaceMesh< T >::rotate | ( | T | phi, | |
| T | theta, | |||
| T | psi | |||
| ) | [inline] |
Rotate the surface mesh. The arguments of this function are the Euler angles in radians. The so-called "x-convention" is used, in which the rotation is given by the three angles (phi, theta, psi), where: 1.] The first rotation is by an angle phi about the z-axis, 2.] The second rotation is by an angle theta in [0, pi] about the new x-axis, 3.] The third rotation is by an angle psi about the new z-axis.
References plb::TriangularSurfaceMesh< T >::eps0, plb::util::fpequal(), plb::TriangularSurfaceMesh< T >::getVertex(), and PLB_ASSERT.
| void plb::TriangularSurfaceMesh< T >::scale | ( | T | alpha | ) | [inline] |
Scale the surface mesh.
References plb::TriangularSurfaceMesh< T >::eps0, plb::util::fpequal(), plb::TriangularSurfaceMesh< T >::getVertex(), and PLB_ASSERT.
Referenced by plb::toLatticeUnits().
| bool plb::TriangularSurfaceMesh< T >::segmentIntersectsTriangle | ( | Array< T, 3 > const & | point1, | |
| Array< T, 3 > const & | point2, | |||
| plint | iTriangle | |||
| ) | const [inline] |
The following function is a specialized version of the previous one. It simply checks if a line segment between points "point1" and "point2" intersects a triangle. This function is written for optimization purposes, and returns "true" if an intersection is found and the intersection is inside the triangle, or "false" if there is no intersection or the intersection is outside the triangle or if the line segment belongs to the triangle and intersects with an infinity of points.
References plb::TriangularSurfaceMesh< T >::eps1, FPEQUAL_ABS, plb::TriangularSurfaceMesh< T >::getVertex(), PLB_ASSERT, plb::util::sqr(), and plb::Array< T, 3 >::to_cArray().
| void plb::TriangularSurfaceMesh< T >::smooth | ( | plint | maxiter = 1, |
|
| T | relax = 1.0, |
|||
| bool | isMeasureWeighted = false | |||
| ) | [inline] |
Smooth the surface mesh. The triangular surface mesh is smoothed by using a spatial averaging algorithm. Interior vertices are treated differently than boundary ones. The mesh is smoothed as many times as the integer argument "maxiter" indicates. If "isMeasureWeighted" is true, then triangle areas and edge lengths are used in the spatial averaging procedure. The smoothing method uses a relaxation algorithm with a relaxation parameter 0 <= relax <= 1.
References plb::global::counter(), plb::crossProduct(), plb::TriangularSurfaceMesh< T >::eps0, plb::TriangularSurfaceMesh< T >::getNeighborVertexIds(), plb::TriangularSurfaceMesh< T >::isBoundaryEdge(), plb::TriangularSurfaceMesh< T >::isBoundaryVertex(), plb::TriangularSurfaceMesh< T >::isInteriorVertex(), plb::norm(), and PLB_ASSERT.
| void plb::TriangularSurfaceMesh< T >::translate | ( | Array< T, 3 > const & | vector | ) | [inline] |
Translate the surface mesh.
References plb::TriangularSurfaceMesh< T >::eps0, plb::util::fpequal(), plb::TriangularSurfaceMesh< T >::getVertex(), and plb::norm().
Referenced by plb::toLatticeUnits().
| std::vector<Array<T,3> > const& plb::TriangularSurfaceMesh< T >::vertices | ( | ) | const [inline] |
Get a handle to the vertices.
References PLB_PRECONDITION.
Referenced by plb::TriangularSurfaceMesh< T >::getVertex(), plb::TriangularSurfaceMesh< T >::isValidVertex(), and plb::TriangularSurfaceMesh< T >::resetVertices().
| void plb::TriangularSurfaceMesh< T >::writeAsciiSTL | ( | std::string | fname | ) | const [inline] |
Export the surface mesh as an ASCII STL file.
References plb::TriangularSurfaceMesh< T >::computeTriangleNormal(), plb::TriangularSurfaceMesh< T >::getVertex(), plb::global::mpi(), and PLB_ASSERT.
| void plb::TriangularSurfaceMesh< T >::writeBinarySTL | ( | std::string | fname | ) | const [inline] |
Export the surface mesh as an binary STL file.
References plb::TriangularSurfaceMesh< T >::computeTriangleNormal(), plb::TriangularSurfaceMesh< T >::getVertex(), plb::global::mpi(), and PLB_ASSERT.
const T plb::TriangularSurfaceMesh< T >::eps0 = std::numeric_limits<T>::epsilon() [inline, static] |
const T plb::TriangularSurfaceMesh< T >::eps1 [inline, static] |
(sizeof(T) == sizeof(float)) ?
std::numeric_limits<float>::epsilon() :
100.0 * std::numeric_limits<T>::epsilon()
Referenced by plb::TriangularSurfaceMesh< T >::distanceToEdgeLine(), plb::TriangularSurfaceMesh< T >::distanceToTrianglePlane(), plb::TriangularSurfaceMesh< T >::pointOnTriangle(), and plb::TriangularSurfaceMesh< T >::segmentIntersectsTriangle().
1.6.3
1.6.3