QUAOAR STUDIO // Mobius API
mobius::poly_Mesh< ElemTraits > Class Template Reference

#include <poly_Mesh.h>

Inheritance diagram for mobius::poly_Mesh< ElemTraits >:
Collaboration diagram for mobius::poly_Mesh< ElemTraits >:

Classes

class  EdgeIterator
 Iterator for edges. More...
 
class  QuadIterator
 Iterator for quads. More...
 
class  TriangleIterator
 Iterator for triangles. More...
 
class  VertexIterator
 Iterator for vertices. More...
 

Public Types

enum  PropsComputationDensity { OnePoint, ThreePoints }
 Precision of Gauss cubature formulas. More...
 
typedef std::map< poly_TriangleHandle, std::unordered_set< poly_TriangleHandle > > t_adjacencyMx
 Adjacency matrix for triangles.
 

Public Member Functions

 poly_Mesh (core_ProgressEntry progress=nullptr, core_PlotterEntry plotter=nullptr)
 Default ctor with optional diagnostic tools.
 
t_ptr< poly_Mesh<> > DeepCopyWithoutTraits ()
 
t_ptr< poly_MeshDeepCopy () const
 
t_ptr< poly_Mesh< ElemTraits > > ExtractRegion (const std::unordered_set< int > &tids) const
 
void Merge (const t_ptr< poly_Mesh< ElemTraits > > &other)
 
void GrowRegion (const poly_TriangleHandle th, const t_adjacencyMx &mx, std::unordered_set< poly_TriangleHandle > &region)
 
void GrowRegion (const poly_TriangleHandle th, std::unordered_set< poly_TriangleHandle > &region)
 
void ComputeCComponents (std::vector< std::unordered_set< poly_TriangleHandle > > &ccomps)
 
void SetSurfAdapter (const t_ptr< poly_SurfAdapter > &adt)
 
mobiusPoly_EXPORT bool AreSelfIntersecting (const int tag, const poly_EdgeHandle eh0, const poly_EdgeHandle eh1) const
 
mobiusPoly_EXPORT bool AreSelfIntersecting (const int tag, const std::vector< poly_EdgeHandle > &ehs0, const std::vector< poly_EdgeHandle > &ehs1) const
 
mobiusPoly_EXPORT bool AreSelfIntersecting (const std::unordered_set< int > &domain) const
 
void GetBounds (double &xMin, double &xMax, double &yMin, double &yMax, double &zMin, double &zMax) const
 
core_XYZ ComputeCenter () const
 
double ComputeArea (const poly_VertexHandle hv0, const poly_VertexHandle hv1, const poly_VertexHandle hv2) const
 
double ComputeArea (const poly_TriangleHandle ht) const
 
double ComputeArea ()
 
void ComputeProps (const PropsComputationDensity density, double &volume, core_XYZ &firstAxisOfInertia, core_XYZ &secondAxisOfInertia, core_XYZ &thirdAxisOfInertia) const
 
bool RefineByMidpoint (const poly_TriangleHandle ht, poly_TriangleHandle &ht0, poly_TriangleHandle &ht1, poly_TriangleHandle &ht2)
 
bool RefineByMidpoint (const poly_TriangleHandle ht)
 
bool RefineByMidedges (const poly_TriangleHandle ht, std::vector< poly_TriangleHandle > &hts)
 
bool RefineByMidedges (const poly_TriangleHandle ht)
 
poly_VertexHandle GetOppositeVertex (const poly_TriangleHandle ht, const poly_EdgeHandle he) const
 
bool ComputeNormal (const poly_VertexHandle hv0, const poly_VertexHandle hv1, const poly_VertexHandle hv2, t_xyz &norm) const
 
void ComputeCenter (const poly_VertexHandle hv0, const poly_VertexHandle hv1, const poly_VertexHandle hv2, t_xyz &center) const
 
bool ComputeNormal (const poly_TriangleHandle ht, t_xyz &norm) const
 
double ComputeScaledJacobian (const poly_TriangleHandle ht) const
 
double ComputeScaledJacobian (const t_xyz &v0, const t_xyz &v1, const t_xyz &v2) const
 
double ComputeMaxLen (const poly_TriangleHandle ht) const
 
bool IsDegenerated (const t_xyz &v0, const t_xyz &v1, const t_xyz &v2, const double prec) const
 
bool IsDegenerated (const poly_TriangleHandle ht, const double prec) const
 
bool Subdivide (const poly_TriangleHandle ht)
 
void ComputeEdges ()
 
void ClearEdges ()
 Cleans up the available edge info.
 
int CountTriangles (const poly_EdgeHandle he) const
 
bool GetTriangles (const poly_EdgeHandle he, std::vector< poly_TriangleHandle > &hts) const
 
bool GetTriangles (const poly_EdgeHandle he, std::unordered_set< poly_TriangleHandle > &hts) const
 
bool FindAdjacentByEdges (const poly_TriangleHandle ht, std::vector< poly_TriangleHandle > &hts) const
 
bool FindAdjacentByEdges (const poly_TriangleHandle ht, std::unordered_set< poly_TriangleHandle > &hts) const
 
void FindAdjacent (const poly_VertexHandle hv, std::unordered_set< poly_TriangleHandle > &hts, const std::unordered_set< int > &domain=std::unordered_set< int >()) const
 
void FindAdjacent (const poly_VertexHandle hv, std::unordered_set< poly_VertexHandle > &hvs, bool &isBoundary, std::unordered_set< int > &faceRefs, const std::unordered_set< int > &domain) const
 
bool FindAdjacent (const poly_EdgeHandle he, std::vector< poly_TriangleHandle > &hts) const
 
void FindAdjacentByVertices (const poly_TriangleHandle ht, std::unordered_set< poly_TriangleHandle > &hts) const
 
bool CanFlip (const poly_EdgeHandle he, const double normDevRad, const double planeDevRad, const bool checkJacobian, const bool checkWing, poly_TriangleHandle &ht0, poly_TriangleHandle &ht1, poly_VertexHandle &a, poly_VertexHandle &b, poly_VertexHandle &x, poly_VertexHandle &y, t_xyz &norm0, t_xyz &norm1) const
 
bool CanFlip (const poly_EdgeHandle he, const double normDevRad=1./180.*M_PI, const double planeDevRad=15./180.*M_PI, const bool checkJacobian=true, const bool checkWing=true) const
 
bool FlipEdge (const poly_EdgeHandle he, const double normDevRad=1./180.*M_PI, const double planeDevRad=15./180.*M_PI, const bool checkJacobian=true, const bool checkWing=true)
 
int FlipEdges (const double normDevRad=1./180.*M_PI, const double planeDevRad=15./180.*M_PI)
 
poly_EdgeHandle FindEdge (const poly_Edge &e) const
 
poly_EdgeHandle FindEdge (const poly_VertexHandle &hv0, const poly_VertexHandle &hv1) const
 
poly_EdgeHandle FindEdge (const poly_TriangleHandle ht0, const poly_TriangleHandle ht1) const
 
void FindBoundaryEdges (std::vector< poly_EdgeHandle > &bndEdges, std::vector< poly_TriangleHandle > &bndTris) const
 
void FindDomainEdges (const int domainId, std::vector< poly_EdgeHandle > &innerEdges, std::vector< poly_EdgeHandle > &bndEdges) const
 
poly_VertexHandle FindVertex (const poly_TriangleHandle ht, const poly_EdgeHandle he, int &vidx) const
 
bool CollapseEdge (const poly_EdgeHandle he, const bool checkBorderOn=true, const bool checkDegenOn=true, const double prec=core_Precision::Resolution3D(), const std::unordered_set< int > &domain=std::unordered_set< int >())
 
bool SplitEdge (const poly_EdgeHandle he)
 
void Smooth (const int iter, const int tag, const bool checkInter)
 
void Smooth (const int iter=1, const std::unordered_set< int > &domain=std::unordered_set< int >(), const bool checkInter=false)
 
bool GetVertex (const poly_VertexHandle h, poly_Vertex &vertex) const
 
bool GetVertex (const poly_VertexHandle h, t_xyz &vertex) const
 
poly_VertexChangeVertex (const poly_VertexHandle h)
 
bool GetEdge (const poly_EdgeHandle h, poly_Edge &edge) const
 
bool GetTriangle (const poly_TriangleHandle h, poly_Triangle< ElemTraits > &triangle) const
 
poly_Triangle< ElemTraits > & ChangeTriangle (const poly_TriangleHandle h)
 
bool GetQuad (const poly_QuadHandle h, poly_Quad &quad) const
 
poly_VertexHandle AddVertex ()
 
poly_VertexHandle AddVertex (const double x, const double y, const double z)
 
poly_VertexHandle AddVertex (const core_XYZ &coords)
 
poly_EdgeHandle AddEdge ()
 
poly_EdgeHandle AddEdge (const poly_VertexHandle hStartV, const poly_VertexHandle hFinishV)
 
poly_EdgeHandle AddEdge (const poly_Edge &edge)
 
bool RemoveEdge (const poly_EdgeHandle h)
 
poly_TriangleHandle AddTriangle ()
 
poly_TriangleHandle AddTriangle (const poly_VertexHandle hV0, const poly_VertexHandle hV1, const poly_VertexHandle hV2)
 
poly_TriangleHandle AddTriangle (const poly_VertexHandle hV0, const poly_VertexHandle hV1, const poly_VertexHandle hV2, const int ref)
 
bool RemoveTriangle (const poly_TriangleHandle h)
 
poly_QuadHandle AddQuad ()
 
poly_QuadHandle AddQuad (const poly_VertexHandle hV0, const poly_VertexHandle hV1, const poly_VertexHandle hV2, const poly_VertexHandle hV3)
 
int GetNumVertices () const
 
int GetNumEdges () const
 
int GetNumTriangles (const bool includeDeads=false) const
 
int GetNumQuads () const
 
- Public Member Functions inherited from mobius::core_IAlgorithm
core_ProgressEntryGetProgress () const
 
core_PlotterEntryGetPlotter () const
 
void SetStatusCode (const int status)
 
int GetStatusCode () const
 
void AddStatusCode (const int statBit)
 
bool HasStatusCode (const int statBit) const
 
- Public Member Functions inherited from mobius::core_OBJECT
mobiusCore_EXPORT void IncRef ()
 
mobiusCore_EXPORT void DecRef ()
 
mobiusCore_EXPORT int NbRefs () const
 
virtual mobiusCore_EXPORT void Dump (std::ostream *out) const
 
const mobiusCore_EXPORT std::string & GetName () const
 
mobiusCore_EXPORT void SetName (const std::string &name)
 
mobiusCore_EXPORT bool HasName () const
 

Public Attributes

std::vector< poly_Vertex__vertices
 List of vertices.
 
std::vector< poly_Edge__edges
 List of edges.
 
std::vector< poly_Triangle< ElemTraits > > __triangles
 List of triangles.
 
std::vector< poly_Quad__quads
 List of quads.
 
std::unordered_map< poly_EdgeHandle, std::vector< poly_TriangleHandle > > __links
 Edges-to-triangles map.
 
t_ptr< poly_SurfAdapter__surfAdt
 CAD surface adapter.
 

Protected Member Functions

void updateLink (const poly_EdgeHandle he, const poly_TriangleHandle htOld, const poly_TriangleHandle htNew)
 Updates the existing link by exchanging htOld with htNew.
 
- Protected Member Functions inherited from mobius::core_IAlgorithm
mobiusCore_EXPORT core_IAlgorithm (core_ProgressEntry progress, core_PlotterEntry plotter)
 

Additional Inherited Members

- Protected Attributes inherited from mobius::core_IAlgorithm
core_ProgressEntry m_progress
 Progress Notifier.
 
core_PlotterEntry m_plotter
 Imperative Plotter.
 
int m_iStatusCode
 

Detailed Description

template<typename ElemTraits = poly_Traits>
class mobius::poly_Mesh< ElemTraits >

Data structure representing surface triangulation.

See also
mobius::poly_ReadSTL

Member Enumeration Documentation

◆ PropsComputationDensity

template<typename ElemTraits = poly_Traits>
enum mobius::poly_Mesh::PropsComputationDensity

Precision of Gauss cubature formulas.

Enumerator
OnePoint 

Values of volume and center of mass are exact for mesh, while moments of inertia might have errors, depending of element size.

ThreePoints 

Values of volume and center of mass are exact for mesh, expressions for moments are polynomials of second order.

Member Function Documentation

◆ AddEdge() [1/3]

template<typename ElemTraits = poly_Traits>
poly_EdgeHandle mobius::poly_Mesh< ElemTraits >::AddEdge ( )
inline

Creates a new invalid edge.

Returns
handle of the just added edge.

◆ AddEdge() [2/3]

template<typename ElemTraits = poly_Traits>
poly_EdgeHandle mobius::poly_Mesh< ElemTraits >::AddEdge ( const poly_Edge edge)
inline

Adds the passed edge to the mesh.

Returns
handle of the just added edge.

◆ AddEdge() [3/3]

template<typename ElemTraits = poly_Traits>
poly_EdgeHandle mobius::poly_Mesh< ElemTraits >::AddEdge ( const poly_VertexHandle  hStartV,
const poly_VertexHandle  hFinishV 
)
inline

Creates a new edge between the passed two vertices.

Parameters
[in]hStartVstart vertex.
[in]hFinishVfinish vertex.
Returns
handle of the just added edge.

◆ AddQuad() [1/2]

template<typename ElemTraits = poly_Traits>
poly_QuadHandle mobius::poly_Mesh< ElemTraits >::AddQuad ( )
inline

Creates a new invalid quad.

Returns
handle of the just added quad.

◆ AddQuad() [2/2]

template<typename ElemTraits = poly_Traits>
poly_QuadHandle mobius::poly_Mesh< ElemTraits >::AddQuad ( const poly_VertexHandle  hV0,
const poly_VertexHandle  hV1,
const poly_VertexHandle  hV2,
const poly_VertexHandle  hV3 
)
inline

Creates a new quad.

Parameters
[in]hV01-st vertex.
[in]hV12-nd vertex.
[in]hV23-rd vertex.
[in]hV34-th vertex.
Returns
handle of the just added quad.

◆ AddTriangle() [1/3]

template<typename ElemTraits = poly_Traits>
poly_TriangleHandle mobius::poly_Mesh< ElemTraits >::AddTriangle ( )
inline

Creates a new invalid triangle.

Returns
handle of the just added triangle.

◆ AddTriangle() [2/3]

template<typename ElemTraits = poly_Traits>
poly_TriangleHandle mobius::poly_Mesh< ElemTraits >::AddTriangle ( const poly_VertexHandle  hV0,
const poly_VertexHandle  hV1,
const poly_VertexHandle  hV2 
)
inline

Creates a new triangle.

Parameters
[in]hV01-st vertex.
[in]hV12-nd vertex.
[in]hV23-rd vertex.
Returns
handle of the just added triangle.

◆ AddTriangle() [3/3]

template<typename ElemTraits = poly_Traits>
poly_TriangleHandle mobius::poly_Mesh< ElemTraits >::AddTriangle ( const poly_VertexHandle  hV0,
const poly_VertexHandle  hV1,
const poly_VertexHandle  hV2,
const int  ref 
)
inline

Creates a new triangle with a back reference to a CAD face.

Parameters
[in]hV01-st vertex.
[in]hV12-nd vertex.
[in]hV23-rd vertex.
[in]refback-reference index.
Returns
handle of the just added triangle.

◆ AddVertex() [1/3]

template<typename ElemTraits = poly_Traits>
poly_VertexHandle mobius::poly_Mesh< ElemTraits >::AddVertex ( )
inline

Creates a new vertex and returns its handle.

Returns
handle of the just added vertex.

◆ AddVertex() [2/3]

template<typename ElemTraits = poly_Traits>
poly_VertexHandle mobius::poly_Mesh< ElemTraits >::AddVertex ( const core_XYZ coords)
inline

Creates a new vertex and returns its handle.

Parameters
[in]coordscoordinates of the vertex.
Returns
handle of the just added vertex.

◆ AddVertex() [3/3]

template<typename ElemTraits = poly_Traits>
poly_VertexHandle mobius::poly_Mesh< ElemTraits >::AddVertex ( const double  x,
const double  y,
const double  z 
)
inline

Creates a new vertex with the given coordinates and returns its handle.

Parameters
[in]xcoordinate x of the vertex.
[in]ycoordinate y of the vertex.
[in]zcoordinate z of the vertex.
Returns
handle of the just added vertex.

◆ AreSelfIntersecting() [1/3]

template<typename ElemTraits = poly_Traits>
mobiusPoly_EXPORT bool mobius::poly_Mesh< ElemTraits >::AreSelfIntersecting ( const int  tag,
const poly_EdgeHandle  eh0,
const poly_EdgeHandle  eh1 
) const

Checks if the passed edges intersect in the parametric domain of the corresponding surface.

Parameters
[in]tagthe domain ID.
[in]eh0the first edge to check.
[in]eh1the second edge to check.
Returns
true if the edges intersect, false – otherwise.

◆ AreSelfIntersecting() [2/3]

template<typename ElemTraits = poly_Traits>
mobiusPoly_EXPORT bool mobius::poly_Mesh< ElemTraits >::AreSelfIntersecting ( const int  tag,
const std::vector< poly_EdgeHandle > &  ehs0,
const std::vector< poly_EdgeHandle > &  ehs1 
) const

Checks if the passed edges intersect in the parametric domain of the corresponding surface.

Parameters
[in]tagthe domain ID.
[in]ehs0the first group of edges to check.
[in]ehs1the second group of edges to check.
Returns
true if the edges intersect, false – otherwise.

◆ AreSelfIntersecting() [3/3]

template<typename ElemTraits = poly_Traits>
mobiusPoly_EXPORT bool mobius::poly_Mesh< ElemTraits >::AreSelfIntersecting ( const std::unordered_set< int > &  domain) const

Checks if the boundary and inner edges intersect in the passed domain.

Parameters
[in]domainthe domain to check.
Returns
true if the edges intersect, false – otherwise.

◆ CanFlip() [1/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::CanFlip ( const poly_EdgeHandle  he,
const double  normDevRad,
const double  planeDevRad,
const bool  checkJacobian,
const bool  checkWing,
poly_TriangleHandle ht0,
poly_TriangleHandle ht1,
poly_VertexHandle a,
poly_VertexHandle b,
poly_VertexHandle x,
poly_VertexHandle y,
t_xyz norm0,
t_xyz norm1 
) const
inline

Checks if the passed edge can be flipped and returns the pair of triangles to flip. The links should have been computed before you call this method.

Parameters
[in]hethe edge to check.
[in]normDevRadthe allowed absolute normal deviation (radians).
[in]planeDevRadthe allowed in-plane deviation (radians).
[in]checkJacobianthe Boolean flag determining whether to check mesh quality metric (scaled Jacobian) on edge flip to ensure that flipping does not make the mesh worse.
[in]checkWingthe Boolean flag indicating whether to check the projection of the neighbor links to the edge supposed for flipping. If the dot product is negative, that's a "wing-like" shape that should not undergo edge flipping to avoid overlappings.
[out]ht0the first triangle.
[out]ht1the second triangle.
[out]athe opposite vertex on the first triangle.
[out]bthe opposite vertex on the second triangle.
[out]xthe first vertex on the edge to flip.
[out]ythe second vertex on the edge to flip.
[out]norm0the normal vector for the first triangle.
[out]norm1the normal vector for the second triangle.
Returns
true/false.

◆ CanFlip() [2/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::CanFlip ( const poly_EdgeHandle  he,
const double  normDevRad = 1./180.*M_PI,
const double  planeDevRad = 15./180.*M_PI,
const bool  checkJacobian = true,
const bool  checkWing = true 
) const
inline

Checks if the passed edge can be flipped. The links should have been computed before you call this method.

Parameters
[in]hethe edge to check.
[in]normDevRadthe allowed absolute normal deviation (radians).
[in]planeDevRadthe allowed in-plane deviation (radians).
[in]checkJacobianthe Boolean flag determining whether to check mesh quality metric (scaled Jacobian) on edge flip to ensure that flipping does not make the mesh worse.
[in]checkWingthe Boolean flag indicating whether to check the projection of the neighbor links to the edge supposed for flipping. If the dot product is negative, that's a "wing-like" shape that should not undergo edge flipping to avoid overlappings.
Returns
true/false.

◆ ChangeTriangle()

template<typename ElemTraits = poly_Traits>
poly_Triangle<ElemTraits>& mobius::poly_Mesh< ElemTraits >::ChangeTriangle ( const poly_TriangleHandle  h)
inline

Returns non-const reference to a triangle by its handle. You have to be sure that such a triangle exists.

Parameters
[in]hhandle of a triangle to access.
Returns
non-const reference that you can use to edit.

◆ ChangeVertex()

template<typename ElemTraits = poly_Traits>
poly_Vertex& mobius::poly_Mesh< ElemTraits >::ChangeVertex ( const poly_VertexHandle  h)
inline

Returns non-const reference to a vertex by its handle. You have to be sure that such a vertex exists.

Parameters
[in]hhandle of a vertex to access.
Returns
non-const reference that you can use to edit.

◆ CollapseEdge()

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::CollapseEdge ( const poly_EdgeHandle  he,
const bool  checkBorderOn = true,
const bool  checkDegenOn = true,
const double  prec = core_Precision::Resolution3D(),
const std::unordered_set< int > &  domain = std::unordered_set<int>() 
)
inline

Collapses the passed edge.

Parameters
[in]hethe edge to collapse.
[in]checkBorderOnthe Boolean flag indicating whether to check borders on edge collapse.
[in]checkDegenOnthe Boolean flag indicating whether to check degeneracy of the resulting triangles.
[in]precthe precision to use for the degenracy check, if it is enabled.
[in]domainthe optional CAD domain (a set of face IDs) to restrict edge collapse in.
Returns
true in case of success, false – otherwise.

◆ ComputeArea() [1/3]

template<typename ElemTraits = poly_Traits>
double mobius::poly_Mesh< ElemTraits >::ComputeArea ( )
inline

Calculates area.

Returns
the computed area.

◆ ComputeArea() [2/3]

template<typename ElemTraits = poly_Traits>
double mobius::poly_Mesh< ElemTraits >::ComputeArea ( const poly_TriangleHandle  ht) const
inline

Computes area for the passed triangle.

Parameters
[in]hthandle of the triangle to compute the area for.
Returns
the computed area.

◆ ComputeArea() [3/3]

template<typename ElemTraits = poly_Traits>
double mobius::poly_Mesh< ElemTraits >::ComputeArea ( const poly_VertexHandle  hv0,
const poly_VertexHandle  hv1,
const poly_VertexHandle  hv2 
) const
inline

Computes area for the passed triangle.

Parameters
[in]hv0the first vertex handle.
[in]hv1the second vertex handle.
[in]hv2the third vertex handle.
Returns
the computed area.

◆ ComputeCComponents()

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::ComputeCComponents ( std::vector< std::unordered_set< poly_TriangleHandle > > &  ccomps)
inline

Computes connected components for the mesh.

Parameters
[out]ccompsthe computed connected components as a vector of regions.

◆ ComputeCenter() [1/2]

template<typename ElemTraits = poly_Traits>
core_XYZ mobius::poly_Mesh< ElemTraits >::ComputeCenter ( ) const
inline

Calculates barycenter.

Returns
the computed point.

◆ ComputeCenter() [2/2]

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::ComputeCenter ( const poly_VertexHandle  hv0,
const poly_VertexHandle  hv1,
const poly_VertexHandle  hv2,
t_xyz center 
) const
inline

Computes center for the passed triple of vertices.

Parameters
[in]hv0the first vertex handle.
[in]hv1the second vertex handle.
[in]hv2the third vertex handle.
[out]centerthe computed center point.

◆ ComputeEdges()

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::ComputeEdges ( )
inline

Computes connectivity information as a set of mesh links married to the elements they share.

◆ ComputeMaxLen()

template<typename ElemTraits = poly_Traits>
double mobius::poly_Mesh< ElemTraits >::ComputeMaxLen ( const poly_TriangleHandle  ht) const
inline

Computes the max length for the edges of the passed triangle.

Parameters
[in]hthandle of the triangle to compute the max length for.
Returns
the computed max length.

◆ ComputeNormal() [1/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::ComputeNormal ( const poly_TriangleHandle  ht,
t_xyz norm 
) const
inline

Computes normal vector for the triangle in question.

Parameters
[in]hthandle of the triangle in question.
[out]normcomputed normal vector.
Returns
true if the normal vector was computed successfully, false – otherwise.

◆ ComputeNormal() [2/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::ComputeNormal ( const poly_VertexHandle  hv0,
const poly_VertexHandle  hv1,
const poly_VertexHandle  hv2,
t_xyz norm 
) const
inline

Computes normal vector for the passed triple of vertices.

Parameters
[in]hv0the first vertex handle.
[in]hv1the second vertex handle.
[in]hv2the third vertex handle.
[out]normthe computed normal vector.
Returns
true if the normal vector was computed successfully, false – otherwise.

◆ ComputeProps()

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::ComputeProps ( const PropsComputationDensity  density,
double &  volume,
core_XYZ firstAxisOfInertia,
core_XYZ secondAxisOfInertia,
core_XYZ thirdAxisOfInertia 
) const
inline

Computes general properties (volume and axes of inertia) for the mesh. Calculation of volume properties is performed by numerical integration over triangle surfaces using Gauss cubature formulas.

Parameters
[in]densitythe precision of calculations.
[out]volumethe computed volume.
[out]firstAxisOfInertiathe first axis of inertia.
[out]secondAxisOfInertiathe second axis of inertia.
[out]thirdAxisOfInertiathe third axis of inertia.

◆ ComputeScaledJacobian() [1/2]

template<typename ElemTraits = poly_Traits>
double mobius::poly_Mesh< ElemTraits >::ComputeScaledJacobian ( const poly_TriangleHandle  ht) const
inline

Computes the min scaled Jacobian for the passed triangle.

Parameters
[in]hthandle of the triangle to compute the metric for.
Returns
the computed scaled Jacobian.

◆ ComputeScaledJacobian() [2/2]

template<typename ElemTraits = poly_Traits>
double mobius::poly_Mesh< ElemTraits >::ComputeScaledJacobian ( const t_xyz v0,
const t_xyz v1,
const t_xyz v2 
) const
inline

Computes the min scaled Jacobian for the passed triangle nodes.

Parameters
[in]v0the 0-th vertex coordinates.
[in]v1the 1-st vertex coordinates.
[in]v2the 2-nd vertex coordinates.
Returns
the computed scaled Jacobian.

◆ CountTriangles()

template<typename ElemTraits = poly_Traits>
int mobius::poly_Mesh< ElemTraits >::CountTriangles ( const poly_EdgeHandle  he) const
inline

Returns the number of triangles sharing the passed edge.

Parameters
[in]hethe edge handle to check.
Returns
the number of triangles.

◆ DeepCopy()

template<typename ElemTraits = poly_Traits>
t_ptr<poly_Mesh> mobius::poly_Mesh< ElemTraits >::DeepCopy ( ) const
inline

Creates a deep copy of this mesh.

Returns
the mesh copy.

◆ DeepCopyWithoutTraits()

template<typename ElemTraits = poly_Traits>
t_ptr<poly_Mesh<> > mobius::poly_Mesh< ElemTraits >::DeepCopyWithoutTraits ( )
inline

Creates a deep copy of this mesh without traits.

Returns
the mesh copy.

◆ ExtractRegion()

template<typename ElemTraits = poly_Traits>
t_ptr< poly_Mesh<ElemTraits> > mobius::poly_Mesh< ElemTraits >::ExtractRegion ( const std::unordered_set< int > &  tids) const
inline

Extracts a mesh region for the given triangle IDs tids. Use this method to get a submesh of the existing mesh. The constructed submesh is a deep copy.

Parameters
[in]tidsthe IDs of the triangles to copy into the region mesh being constructed.
Returns
the extracted region.

◆ FindAdjacent() [1/3]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::FindAdjacent ( const poly_EdgeHandle  he,
std::vector< poly_TriangleHandle > &  hts 
) const
inline

Finds adjacent triangles for the given edge.

Parameters
[in]hethe edge in question.
[out]htsthe output triangles.
Returns
false if adjacency information is not available or if the passed edge handle is invalid.

◆ FindAdjacent() [2/3]

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::FindAdjacent ( const poly_VertexHandle  hv,
std::unordered_set< poly_TriangleHandle > &  hts,
const std::unordered_set< int > &  domain = std::unordered_set<int>() 
) const
inline

Finds all triangles sharing the given vertex.

Parameters
[in]hvthe vertex in question.
[out]htsthe found triangles.
[in]domainthe optional domain to keep only the faces of interest.

◆ FindAdjacent() [3/3]

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::FindAdjacent ( const poly_VertexHandle  hv,
std::unordered_set< poly_VertexHandle > &  hvs,
bool &  isBoundary,
std::unordered_set< int > &  faceRefs,
const std::unordered_set< int > &  domain 
) const
inline

Finds all vertices adjacent to the given vertex.

Parameters
[in]hvthe vertex in question.
[out]hvsthe found neighbor vertices.
[out]isBoundarythe Boolean flag indicating whether the passed hv vertex is found to be the boundary one.
[out]faceRefsthe surrounding face refs.
[in]domainthe optional domain to keep only the faces of interest.

◆ FindAdjacentByEdges() [1/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::FindAdjacentByEdges ( const poly_TriangleHandle  ht,
std::unordered_set< poly_TriangleHandle > &  hts 
) const
inline

Finds adjacent triangles for the given one.

Parameters
[in]htthe triangle in question.
[out]htsthe output triangles.
Returns
false if the links were not computed or there is no triangle with such a handle.

◆ FindAdjacentByEdges() [2/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::FindAdjacentByEdges ( const poly_TriangleHandle  ht,
std::vector< poly_TriangleHandle > &  hts 
) const
inline

Finds adjacent triangles for the given one.

Parameters
[in]htthe triangle in question.
[out]htsthe output triangles.
Returns
false if the links were not computed or there is no triangle with such a handle.

◆ FindAdjacentByVertices()

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::FindAdjacentByVertices ( const poly_TriangleHandle  ht,
std::unordered_set< poly_TriangleHandle > &  hts 
) const
inline

Finds adjacent triangles for the given one.

Parameters
[in]htthe triangle in question.
[out]htsthe output triangles.

◆ FindBoundaryEdges()

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::FindBoundaryEdges ( std::vector< poly_EdgeHandle > &  bndEdges,
std::vector< poly_TriangleHandle > &  bndTris 
) const
inline

Finds all boundary edges in the mesh. A boundary edge is an edge where the triangles with different face IDs meet or an edge not having exactly two owner triangles.

Parameters
[out]bndEdgesthe extracted boundary edges.
[out]bndTristhe extracted boundary triangles.

◆ FindDomainEdges()

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::FindDomainEdges ( const int  domainId,
std::vector< poly_EdgeHandle > &  innerEdges,
std::vector< poly_EdgeHandle > &  bndEdges 
) const
inline

Returns all edges that belong to the specified domain.

Parameters
[in]domainIdthe domain of interest.
[out]innerEdgesthe extracted inner edges.
[out]bndEdgesthe extracted boundary edges.

◆ FindEdge() [1/3]

template<typename ElemTraits = poly_Traits>
poly_EdgeHandle mobius::poly_Mesh< ElemTraits >::FindEdge ( const poly_Edge e) const
inline

Finds the given edge in the collection of precomputed links.

Parameters
[in]ethe edge to find.
Returns
the edge handle.

◆ FindEdge() [2/3]

template<typename ElemTraits = poly_Traits>
poly_EdgeHandle mobius::poly_Mesh< ElemTraits >::FindEdge ( const poly_TriangleHandle  ht0,
const poly_TriangleHandle  ht1 
) const
inline

Returns the common edge for the passed pair of triangles.

Parameters
[in]ht0the first triangle.
[in]ht1the second triangle.
Returns
the handle for the common edge or invalid handle if there is no common edge.

◆ FindEdge() [3/3]

template<typename ElemTraits = poly_Traits>
poly_EdgeHandle mobius::poly_Mesh< ElemTraits >::FindEdge ( const poly_VertexHandle hv0,
const poly_VertexHandle hv1 
) const
inline

Finds an edge defined by the passed vertex handles (order does not matter) in the collection of precomputed links.

Parameters
[in]hv0the first vertex of the edge to find.
[in]hv1the second vertex of the edge to find.
Returns
the edge handle.

◆ FindVertex()

template<typename ElemTraits = poly_Traits>
poly_VertexHandle mobius::poly_Mesh< ElemTraits >::FindVertex ( const poly_TriangleHandle  ht,
const poly_EdgeHandle  he,
int &  vidx 
) const
inline

Finds the vertex shared between the passed triangle and the given (presumably dangling) edge.

Parameters
[in]htthe triangle in question.
[in]hethe edge that presumably shares a single vertex the triangle ht.
[out]vidxthe index of the common vertex in range [0,2].
Returns
the shared vertex or an invalid handle if there is no such a vertex.

◆ FlipEdge()

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::FlipEdge ( const poly_EdgeHandle  he,
const double  normDevRad = 1./180.*M_PI,
const double  planeDevRad = 15./180.*M_PI,
const bool  checkJacobian = true,
const bool  checkWing = true 
)
inline

Flips the passed edge if it allows flipping.

Parameters
[in]hethe edge to flip.
[in]normDevRadthe allowed absolute normal deviation (radians).
[in]planeDevRadthe allowed in-plane deviation (radians).
[in]checkJacobianthe Boolean flag determining whether to check mesh quality metric (scaled Jacobian) on edge flip to ensure that flipping does not make the mesh worse.
[in]checkWingthe Boolean flag indicating whether to check the projection of the neighbor links to the edge supposed for flipping. If the dot product is negative, that's a "wing-like" shape that should not undergo edge flipping to avoid overlappings.
Returns
true if the edge was flipped, false – otherwise.

◆ FlipEdges()

template<typename ElemTraits = poly_Traits>
int mobius::poly_Mesh< ElemTraits >::FlipEdges ( const double  normDevRad = 1./180.*M_PI,
const double  planeDevRad = 15./180.*M_PI 
)
inline

Flips all edges that allow flipping.

Parameters
[in]normDevRadthe allowed absolute normal deviation (radians).
[in]planeDevRadthe allowed in-plane deviation (radians).
Returns
the number of flips done.

◆ GetBounds()

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::GetBounds ( double &  xMin,
double &  xMax,
double &  yMin,
double &  yMax,
double &  zMin,
double &  zMax 
) const
inline

Calculates axis-aligned boundary box for the mesh.

Parameters
[out]xMinmin X.
[out]xMaxmax X.
[out]yMinmin Y.
[out]yMaxmax Y.
[out]zMinmin Z.
[out]zMaxmax Z.

◆ GetEdge()

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::GetEdge ( const poly_EdgeHandle  h,
poly_Edge edge 
) const
inline

Returns edge by its handle.

Parameters
[in]hhandle of an edge to access.
[out]edgeedge.
Returns
false if there is no such edge.

◆ GetNumEdges()

template<typename ElemTraits = poly_Traits>
int mobius::poly_Mesh< ElemTraits >::GetNumEdges ( ) const
inline
Returns
number of edges.

◆ GetNumQuads()

template<typename ElemTraits = poly_Traits>
int mobius::poly_Mesh< ElemTraits >::GetNumQuads ( ) const
inline
Returns
number of quads.

◆ GetNumTriangles()

template<typename ElemTraits = poly_Traits>
int mobius::poly_Mesh< ElemTraits >::GetNumTriangles ( const bool  includeDeads = false) const
inline

Returns the number of triangles.

Parameters
[in]includeDeadswhether to include dead ones.
Returns
number of triangles.

◆ GetNumVertices()

template<typename ElemTraits = poly_Traits>
int mobius::poly_Mesh< ElemTraits >::GetNumVertices ( ) const
inline
Returns
number of vertices.

◆ GetOppositeVertex()

template<typename ElemTraits = poly_Traits>
poly_VertexHandle mobius::poly_Mesh< ElemTraits >::GetOppositeVertex ( const poly_TriangleHandle  ht,
const poly_EdgeHandle  he 
) const
inline

Returns the opposite vertex for the given edge on the passed triangle.

Parameters
[in]httriangle handle.
[in]heedge handle.
Returns
the opposite vertex.

◆ GetQuad()

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::GetQuad ( const poly_QuadHandle  h,
poly_Quad quad 
) const
inline

Returns quad by its handle.

Parameters
[in]hhandle of a quad to access.
[out]quadquad.
Returns
false if there is no such quad.

◆ GetTriangle()

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::GetTriangle ( const poly_TriangleHandle  h,
poly_Triangle< ElemTraits > &  triangle 
) const
inline

Returns triangle by its handle.

Parameters
[in]hhandle of a triangle to access.
[out]triangletriangle.
Returns
false if there is no such triangle.

◆ GetTriangles() [1/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::GetTriangles ( const poly_EdgeHandle  he,
std::unordered_set< poly_TriangleHandle > &  hts 
) const
inline

Returns handles of the triangles sharing the passed edge.

Parameters
[in]hethe edge handle to check.
[out]htsthe output triangles.
Returns
false if the links were not computed or there is no edge with such a handle.

◆ GetTriangles() [2/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::GetTriangles ( const poly_EdgeHandle  he,
std::vector< poly_TriangleHandle > &  hts 
) const
inline

Returns handles of the triangles sharing the passed edge.

Parameters
[in]hethe edge handle to check.
[out]htsthe output triangles.
Returns
false if the links were not computed or there is no edge with such a handle.

◆ GetVertex() [1/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::GetVertex ( const poly_VertexHandle  h,
poly_Vertex vertex 
) const
inline

Returns vertex by its handle.

Parameters
[in]hhandle of a vertex to access.
[out]vertexvertex.
Returns
false if there is no such vertex.

◆ GetVertex() [2/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::GetVertex ( const poly_VertexHandle  h,
t_xyz vertex 
) const
inline

Returns vertex by its handle as a coordinate triple.

Parameters
[in]hhandle of a vertex to access.
[out]vertexvertex.
Returns
false if there is no such vertex.

◆ GrowRegion() [1/2]

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::GrowRegion ( const poly_TriangleHandle  th,
const t_adjacencyMx mx,
std::unordered_set< poly_TriangleHandle > &  region 
)
inline

Grows a mesh region by connectivity starting from the passed triangle handle th.

Parameters
[in]ththe seed triangle handle.
[in]mxthe precomputed adjacency matrix.
[out]regionthe collected region.

◆ GrowRegion() [2/2]

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::GrowRegion ( const poly_TriangleHandle  th,
std::unordered_set< poly_TriangleHandle > &  region 
)
inline

Grows a mesh region by connectivity starting from the passed triangle handle th.

Parameters
[in]ththe seed triangle handle.
[out]regionthe collected region.

◆ IsDegenerated() [1/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::IsDegenerated ( const poly_TriangleHandle  ht,
const double  prec 
) const
inline

Checks if the passed triangle is degenerated w.r.t. the given precision value.

Parameters
[in]htthe triangle to check.
[in]precthe precision to use.
Returns
true/false.

◆ IsDegenerated() [2/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::IsDegenerated ( const t_xyz v0,
const t_xyz v1,
const t_xyz v2,
const double  prec 
) const
inline

Checks if the passed triangle is degenerated w.r.t. the given precision value.

Parameters
[in]v0the 0-th vertex of the triangle to check.
[in]v1the 1-st vertex of the triangle to check.
[in]v2the 2-nd vertex of the triangle to check.
[in]precthe precision to use.
Returns
true/false.

◆ Merge()

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::Merge ( const t_ptr< poly_Mesh< ElemTraits > > &  other)
inline

Copies other mesh into this.

Parameters
[in]otherthe mesh to copy into this mesh

◆ RefineByMidedges() [1/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::RefineByMidedges ( const poly_TriangleHandle  ht)
inline

Refines the passed triangle by midedge subdivision.

Parameters
[in]hthandle of the triangle to refine.
Returns
true in case of success, false – otherwise.

◆ RefineByMidedges() [2/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::RefineByMidedges ( const poly_TriangleHandle  ht,
std::vector< poly_TriangleHandle > &  hts 
)
inline

Refines the passed triangle by midedge subdivision.

Parameters
[in]hthandle of the triangle to refine.
[out]htsnewly constructed triangles.
Returns
true in case of success, false – otherwise.

◆ RefineByMidpoint() [1/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::RefineByMidpoint ( const poly_TriangleHandle  ht)
inline

Refines the triangle of interest by its midpoint.

Parameters
[in]hthandle of the triangle to refine.
Returns
true in case of success, false – otherwise.

◆ RefineByMidpoint() [2/2]

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::RefineByMidpoint ( const poly_TriangleHandle  ht,
poly_TriangleHandle ht0,
poly_TriangleHandle ht1,
poly_TriangleHandle ht2 
)
inline

Refines the triangle of interest by its midpoint.

Parameters
[in]hthandle of the triangle to refine.
[out]ht0handle of the first created triangle.
[out]ht1handle of the second created triangle.
[out]ht2handle of the third created triangle.
Returns
true in case of success, false – otherwise.

◆ RemoveEdge()

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::RemoveEdge ( const poly_EdgeHandle  h)
inline

Removes the edge with the given handle.

Parameters
[in]hhandle of the edge to remove.
Returns
true in case of success, false – otherwise.

◆ RemoveTriangle()

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::RemoveTriangle ( const poly_TriangleHandle  h)
inline

Removes the triangle with the given handle.

Parameters
[in]hhandle of the triangle to remove.
Returns
true in case of success, false – otherwise.

◆ SetSurfAdapter()

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::SetSurfAdapter ( const t_ptr< poly_SurfAdapter > &  adt)
inline

Sets CAD surface adapter to establish a reference from the discrete surface to the smooth analytical surface (if any).

Parameters
[in]adtthe adapter to set.

◆ Smooth() [1/2]

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::Smooth ( const int  iter,
const int  tag,
const bool  checkInter 
)
inline

Applies Laplacian smoothing to the mesh vertices.

Parameters
[in]iterthe number of smoothing steps.
[in]tagthe subdomain ID to smooth.
[in]checkInterthe Boolean flag indicating whether to check for self-intersecting links.

◆ Smooth() [2/2]

template<typename ElemTraits = poly_Traits>
void mobius::poly_Mesh< ElemTraits >::Smooth ( const int  iter = 1,
const std::unordered_set< int > &  domain = std::unordered_set<int>(),
const bool  checkInter = false 
)
inline

Applies Laplacian smoothing to the mesh vertices.

Parameters
[in]iterthe number of smoothing steps.
[in]domainthe optional face IDs to smooth.
[in]checkInterthe Boolean flag indicating whether to check for self-intersecting links.

◆ SplitEdge()

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::SplitEdge ( const poly_EdgeHandle  he)
inline

Splits the passed edge and refines its owner triangles.

Parameters
[in]hethe edge to split.
Returns
true in the case of success, false – otherwise.

◆ Subdivide()

template<typename ElemTraits = poly_Traits>
bool mobius::poly_Mesh< ElemTraits >::Subdivide ( const poly_TriangleHandle  ht)
inline

Creates a submesh for the given triangle by subdividing it at the center points. WARNING: the resulting mesh is not conformal!

Parameters
[in]htthe triangle to subdivide.
Returns
true in case of success, false – otherwise.

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