$treeview $search $mathjax
Palabos  Version 1.1
$projectbrief
$projectbrief
$searchbox

plb::TriangularSurfaceMesh< T > Class Template Reference

#include <triangularSurfaceMesh.h>

List of all members.

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< plintgetNeighborVertexIds (plint iVertex) const
 Get a list of the neighboring vertices of a given vertex.
std::vector< plintgetNeighborVertexIds (plint iVertex, plint jVertex) const
 Get a list of the neighboring vertices of a given edge.
std::vector< plintgetNeighborTriangleIds (plint iVertex) const
 Get a list of the neighboring triangles of a given vertex.
std::vector< plintgetAdjacentTriangleIds (plint iTriangle) const
std::vector< plintgetAdjacentTriangleIds (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
computeTriangleArea (plint iTriangle) const
 Compute the area of a given triangle.
computeTriangleArea (plint iVertex, plint jVertex, plint kVertex) const
computeEdgeArea (plint iVertex, plint jVertex) const
computeVertexArea (plint iVertex) const
computeEdgeLength (plint iVertex, plint jVertex) const
 Compute the length of a given edge.
computeDihedralAngle (plint iVertex, plint jVertex) const
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< LidcloseHoles ()
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

Detailed Description

template<typename T>
class plb::TriangularSurfaceMesh< T >

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


Constructor & Destructor Documentation

template<typename T>
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.


Member Function Documentation

template<typename T >
void plb::TriangularSurfaceMesh< T >::avoidIntegerPositions (  )  [inline]
template<typename T >
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().

template<typename T >
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().

template<typename T >
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().

template<typename T >
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().

template<typename T >
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().

template<typename T >
T plb::TriangularSurfaceMesh< T >::computeEdgeLength ( plint  iVertex,
plint  jVertex 
) const [inline]
template<typename T >
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().

template<typename T >
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().

template<typename T >
Array< T, 3 > plb::TriangularSurfaceMesh< T >::computeTriangleNormal ( plint  iVertex,
plint  jVertex,
plint  kVertex,
bool  isAreaWeighted = false 
) const [inline]
template<typename T >
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().

template<typename T >
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().

template<typename T >
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().

template<typename T >
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().

template<typename T >
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().

template<typename T >
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().

template<typename T >
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.

template<typename T >
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().

template<typename T >
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.

template<typename T>
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().

template<typename T >
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().

template<typename T >
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().

template<typename T >
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().

template<typename T >
Array< T, 3 > const & plb::TriangularSurfaceMesh< T >::getVertex ( plint  iTriangle,
int  localVertex 
) const [inline]
template<typename T >
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().

template<typename T >
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().

template<typename T >
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().

template<typename T >
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().

template<typename T >
bool plb::TriangularSurfaceMesh< T >::isValidVertex ( plint  iVertex  )  const [inline]
template<typename T >
bool plb::TriangularSurfaceMesh< T >::isValidVertex ( plint  iTriangle,
int  localVertex 
) const [inline]
template<typename T >
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().

template<typename T >
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().

template<typename T >
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().

template<typename T >
void plb::TriangularSurfaceMesh< T >::reverseOrientation (  )  [inline]
template<typename T >
void plb::TriangularSurfaceMesh< T >::rotate ( phi,
theta,
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.

template<typename T >
void plb::TriangularSurfaceMesh< T >::scale ( alpha  )  [inline]
template<typename T >
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().

template<typename T >
void plb::TriangularSurfaceMesh< T >::smooth ( plint  maxiter = 1,
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.

template<typename T >
void plb::TriangularSurfaceMesh< T >::translate ( Array< T, 3 > const &  vector  )  [inline]
template<typename T>
std::vector<Array<T,3> > const& plb::TriangularSurfaceMesh< T >::vertices (  )  const [inline]
template<typename T >
void plb::TriangularSurfaceMesh< T >::writeAsciiSTL ( std::string  fname  )  const [inline]
template<typename T >
void plb::TriangularSurfaceMesh< T >::writeBinarySTL ( std::string  fname  )  const [inline]

Member Data Documentation

template<typename T>
const T plb::TriangularSurfaceMesh< T >::eps1 [inline, static]
Initial value:
        (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().


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