SOFA API  c76874b7
Open source framework for multi-physics simuation
sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes > Class Template Reference

#include <TriangleSetTopologyAlgorithms.h>

Inheritance diagram for sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >:

Detailed Description

template<class DataTypes>
class sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >

A class that performs topology algorithms on an TriangleSet.

Protected Attributes

Data< sofa::helper::vector< TriangleID > > m_listTriRemove
 Debug : Remove a triangle or a list of triangles by using their indices (only while animate). More...
 
Data< sofa::helper::vector< Triangle > > m_listTriAdd
 Debug : Add a triangle or a list of triangles by using their indices (only while animate). More...
 

Public Member Functions

 SOFA_CLASS (SOFA_TEMPLATE(TriangleSetTopologyAlgorithms, DataTypes), SOFA_TEMPLATE(EdgeSetTopologyAlgorithms, DataTypes))
 
void init () override
 
void reinit () override
 
bool Suture2Points (TriangleID ind_ta, TriangleID ind_tb, PointID &ind1, PointID &ind2)
 Moves and fixes the two closest points of two triangles to their median point. More...
 
void RemoveAlongTrianglesList (const sofa::defaulttype::Vec< 3, double > &a, const sofa::defaulttype::Vec< 3, double > &b, const TriangleID ind_ta, const TriangleID ind_tb)
 Removes triangles along the list of points (ind_edge,coord) intersected by the vector from point a to point b and the triangular mesh. More...
 
void InciseAlongLinesList (const sofa::helper::vector< sofa::defaulttype::Vec< 3, double > > &input_points, const sofa::helper::vector< TriangleID > &input_triangles)
 Incises along the list of points (ind_edge,coord) intersected by the sequence of input segments (list of input points) and the triangular mesh. More...
 
virtual int InciseAlongEdge (EdgeID edge, int *createdPoints=nullptr)
 Duplicates the given edge. Only works if at least one of its points is adjacent to a border. More...
 
virtual int SplitAlongPath (PointID pa, Coord &a, PointID pb, Coord &b, sofa::helper::vector< sofa::core::topology::TopologyObjectType > &topoPath_list, sofa::helper::vector< ElemID > &indices_list, sofa::helper::vector< sofa::defaulttype::Vec< 3, double > > &coords_list, sofa::helper::vector< EdgeID > &new_edges, double epsilonSnapPath=0.0, double epsilonSnapBorder=0.0)
 Split triangles to create edges along a path given as a the list of existing edges and triangles crossed by it. Each end of the path is given either by an existing point or a point inside the first/last triangle. If the first/last triangle is (TriangleID)-1, it means that to path crosses the boundary of the surface. More...
 
void SnapAlongPath (sofa::helper::vector< sofa::core::topology::TopologyObjectType > &topoPath_list, sofa::helper::vector< ElemID > &indices_list, sofa::helper::vector< sofa::defaulttype::Vec< 3, double > > &coords_list, sofa::helper::vector< sofa::helper::vector< double > > &points2Snap, double epsilonSnapPath)
 
void SnapBorderPath (PointID pa, Coord &a, PointID pb, Coord &b, sofa::helper::vector< sofa::core::topology::TopologyObjectType > &topoPath_list, sofa::helper::vector< ElemID > &indices_list, sofa::helper::vector< sofa::defaulttype::Vec< 3, double > > &coords_list, sofa::helper::vector< sofa::helper::vector< double > > &points2Snap, double epsilonSnapBorder)
 
virtual bool InciseAlongEdgeList (const sofa::helper::vector< EdgeID > &edges, sofa::helper::vector< PointID > &new_points, sofa::helper::vector< PointID > &end_points, bool &reachBorder)
 Duplicates the given edges. Only works if at least the first or last point is adjacent to a border. More...
 
PointID getOtherPointInTriangle (const Triangle &t, PointID p1, PointID p2) const
 
template<>
SOFA_BASE_TOPOLOGY_API int SplitAlongPath (PointID pa, Coord &a, PointID pb, Coord &b, sofa::helper::vector< sofa::core::topology::TopologyObjectType > &topoPath_list, sofa::helper::vector< ElemID > &indices_list, sofa::helper::vector< sofa::defaulttype::Vec< 3, double > > &coords_list, sofa::helper::vector< EdgeID > &new_edges, double epsilonSnapPath, double epsilonSnapBorder)
 
template<>
SOFA_BASE_TOPOLOGY_API int SplitAlongPath (PointID pa, Coord &a, PointID pb, Coord &b, sofa::helper::vector< sofa::core::topology::TopologyObjectType > &topoPath_list, sofa::helper::vector< ElemID > &indices_list, sofa::helper::vector< sofa::defaulttype::Vec< 3, double > > &coords_list, sofa::helper::vector< EdgeID > &new_edges, double epsilonSnapPath, double epsilonSnapBorder)
 
template<>
int SplitAlongPath (PointID, Coord &, PointID, Coord &, sofa::helper::vector< sofa::core::topology::TopologyObjectType > &, sofa::helper::vector< ElemID > &, sofa::helper::vector< sofa::defaulttype::Vec< 3, double > > &, sofa::helper::vector< EdgeID > &, double, double)
 
template<>
int SplitAlongPath (PointID, Coord &, PointID, Coord &, sofa::helper::vector< sofa::core::topology::TopologyObjectType > &, sofa::helper::vector< ElemID > &, sofa::helper::vector< sofa::defaulttype::Vec< 3, double > > &, sofa::helper::vector< EdgeID > &, double, double)
 
- Public Member Functions inherited from sofa::component::topology::EdgeSetTopologyAlgorithms< DataTypes >
 SOFA_CLASS (SOFA_TEMPLATE(EdgeSetTopologyAlgorithms, DataTypes), SOFA_TEMPLATE(PointSetTopologyAlgorithms, DataTypes))
 
void init () override
 
- Public Member Functions inherited from sofa::component::topology::PointSetTopologyAlgorithms< DataTypes >
 SOFA_CLASS (SOFA_TEMPLATE(PointSetTopologyAlgorithms, DataTypes), core::topology::TopologyAlgorithms)
 
void init () override
 

Protected Member Functions

 TriangleSetTopologyAlgorithms ()
 
virtual ~TriangleSetTopologyAlgorithms ()
 
- Protected Member Functions inherited from sofa::component::topology::EdgeSetTopologyAlgorithms< DataTypes >
 EdgeSetTopologyAlgorithms ()
 
virtual ~EdgeSetTopologyAlgorithms ()
 
- Protected Member Functions inherited from sofa::component::topology::PointSetTopologyAlgorithms< DataTypes >
 PointSetTopologyAlgorithms ()
 
 ~PointSetTopologyAlgorithms () override
 

Additional Inherited Members

- Static Public Member Functions inherited from sofa::component::topology::PointSetTopologyAlgorithms< DataTypes >
template<class T >
static bool canCreate (T *&obj, core::objectmodel::BaseContext *context, core::objectmodel::BaseObjectDescription *arg)
 

Attribute details

template<class DataTypes >
Data< sofa::helper::vector< Triangle> > sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::m_listTriAdd
protected

Debug : Add a triangle or a list of triangles by using their indices (only while animate).

template<class DataTypes >
Data< sofa::helper::vector< TriangleID> > sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::m_listTriRemove
protected

Debug : Remove a triangle or a list of triangles by using their indices (only while animate).

Constructor details

template<class DataTypes >
sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::TriangleSetTopologyAlgorithms ( )
inlineprotected
template<class DataTypes >
virtual sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::~TriangleSetTopologyAlgorithms ( )
inlineprotectedvirtual

Function details

template<class DataTypes >
PointID sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::getOtherPointInTriangle ( const Triangle t,
PointID  p1,
PointID  p2 
) const
inline
template<class DataTypes >
int sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::InciseAlongEdge ( EdgeID  edge,
int createdPoints = nullptr 
)
virtual

Duplicates the given edge. Only works if at least one of its points is adjacent to a border.

Returns
the number of newly created points, or -1 if the incision failed.
template<class DataTypes >
bool sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::InciseAlongEdgeList ( const sofa::helper::vector< EdgeID > &  edges,
sofa::helper::vector< PointID > &  new_points,
sofa::helper::vector< PointID > &  end_points,
bool reachBorder 
)
virtual

Duplicates the given edges. Only works if at least the first or last point is adjacent to a border.

Returns
true if the incision succeeded.
template<class DataTypes >
void sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::InciseAlongLinesList ( const sofa::helper::vector< sofa::defaulttype::Vec< 3, double > > &  input_points,
const sofa::helper::vector< TriangleID > &  input_triangles 
)

Incises along the list of points (ind_edge,coord) intersected by the sequence of input segments (list of input points) and the triangular mesh.

template<class DataTypes >
void sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::init ( void  )
override
template<class DataTypes >
void sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::reinit ( )
override
template<class DataTypes >
void sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::RemoveAlongTrianglesList ( const sofa::defaulttype::Vec< 3, double > &  a,
const sofa::defaulttype::Vec< 3, double > &  b,
const TriangleID  ind_ta,
const TriangleID  ind_tb 
)

Removes triangles along the list of points (ind_edge,coord) intersected by the vector from point a to point b and the triangular mesh.

template<class DataTypes >
void sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::SnapAlongPath ( sofa::helper::vector< sofa::core::topology::TopologyObjectType > &  topoPath_list,
sofa::helper::vector< ElemID > &  indices_list,
sofa::helper::vector< sofa::defaulttype::Vec< 3, double > > &  coords_list,
sofa::helper::vector< sofa::helper::vector< double > > &  points2Snap,
double  epsilonSnapPath 
)
template<class DataTypes >
void sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::SnapBorderPath ( PointID  pa,
Coord a,
PointID  pb,
Coord b,
sofa::helper::vector< sofa::core::topology::TopologyObjectType > &  topoPath_list,
sofa::helper::vector< ElemID > &  indices_list,
sofa::helper::vector< sofa::defaulttype::Vec< 3, double > > &  coords_list,
sofa::helper::vector< sofa::helper::vector< double > > &  points2Snap,
double  epsilonSnapBorder 
)
template<class DataTypes >
sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::SOFA_CLASS ( SOFA_TEMPLATE(TriangleSetTopologyAlgorithms< DataTypes >, DataTypes)  ,
SOFA_TEMPLATE(EdgeSetTopologyAlgorithms, DataTypes)   
)
template<>
SOFA_BASE_TOPOLOGY_API int sofa::component::topology::TriangleSetTopologyAlgorithms< defaulttype::Vec2Types >::SplitAlongPath ( PointID  pa,
Coord a,
PointID  pb,
Coord b,
sofa::helper::vector< sofa::core::topology::TopologyObjectType > &  topoPath_list,
sofa::helper::vector< ElemID > &  indices_list,
sofa::helper::vector< sofa::defaulttype::Vec< 3, double > > &  coords_list,
sofa::helper::vector< EdgeID > &  new_edges,
double  epsilonSnapPath,
double  epsilonSnapBorder 
)
template<>
SOFA_BASE_TOPOLOGY_API int sofa::component::topology::TriangleSetTopologyAlgorithms< defaulttype::Vec1Types >::SplitAlongPath ( PointID  pa,
Coord a,
PointID  pb,
Coord b,
sofa::helper::vector< sofa::core::topology::TopologyObjectType > &  topoPath_list,
sofa::helper::vector< ElemID > &  indices_list,
sofa::helper::vector< sofa::defaulttype::Vec< 3, double > > &  coords_list,
sofa::helper::vector< EdgeID > &  new_edges,
double  epsilonSnapPath,
double  epsilonSnapBorder 
)
template<class DataTypes >
int sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::SplitAlongPath ( PointID  pa,
Coord a,
PointID  pb,
Coord b,
sofa::helper::vector< sofa::core::topology::TopologyObjectType > &  topoPath_list,
sofa::helper::vector< ElemID > &  indices_list,
sofa::helper::vector< sofa::defaulttype::Vec< 3, double > > &  coords_list,
sofa::helper::vector< EdgeID > &  new_edges,
double  epsilonSnapPath = 0.0,
double  epsilonSnapBorder = 0.0 
)
virtual

Split triangles to create edges along a path given as a the list of existing edges and triangles crossed by it. Each end of the path is given either by an existing point or a point inside the first/last triangle. If the first/last triangle is (TriangleID)-1, it means that to path crosses the boundary of the surface.

Returns
the indice of the end point, or -1 if the incision failed.
template<class DataTypes >
bool sofa::component::topology::TriangleSetTopologyAlgorithms< DataTypes >::Suture2Points ( TriangleID  ind_ta,
TriangleID  ind_tb,
PointID ind1,
PointID ind2 
)

Moves and fixes the two closest points of two triangles to their median point.