SOFA API  f37305c1
Open source framework for multi-physics simuation
sofa::component::topology::container::dynamic::TriangleSubdivider Class Reference

#include <TriangleSubdividers.h>

Detailed Description

This class store all info to be able to split a Triangle into a given configuration. Depending on the configuration, 2 or 3 new triangle will be computed as well as new points. All info to create the new elements are computed and will be generated using a TriangleSetModifier component.

Protected Attributes

TriangleID m_triangleId
 Index of this triangle in the Topology Container. More...
 
sofa::core::topology::BaseMeshTopology::Triangle m_triangle
 Triangle fixed array of the 3 vertex indices. More...
 
type::vector< std::shared_ptr< PointToAdd > > m_points
 Vector of new point to be added while subdividing this Triangle. More...
 
type::vector< std::shared_ptr< PointToAdd > > m_snappedPoints
 Vector of new point to be snapped while subdividing this Triangle. More...
 
type::vector< TriangleToAdd * > m_trianglesToAdd
 Vector of triangle to be added while subdividing this Triangle. More...
 

Public Member Functions

 TriangleSubdivider (TriangleID triangleId, const Triangle &triangle)
 
 ~TriangleSubdivider ()
 
virtual bool subdivide (const sofa::type::fixed_array< sofa::type::Vec3, 3 > &triCoords)
 
void addPoint (std::shared_ptr< PointToAdd > pTA)
 Method to add a new. More...
 
TriangleID getTriangleIdToSplit ()
 Return the index of the triangle, in the TopologyContainer, to split. More...
 
const type::vector< TriangleToAdd * > & getTrianglesToAdd ()
 Getter to the list of new. More...
 
const type::vector< std::shared_ptr< PointToAdd > > & getPointsToAdd ()
 Getter to the list of new. More...
 

Protected Member Functions

PointID localVertexId (PointID vertexIndex)
 
sofa::type::Vec3 computePointCoordinates (const PointToAdd *PTA, const sofa::type::fixed_array< sofa::type::Vec3, 3 > &triCoords)
 
bool subdivide_1Node (const sofa::type::fixed_array< sofa::type::Vec3, 3 > &triCoords)
 
bool subdivide_1Edge (const sofa::type::fixed_array< sofa::type::Vec3, 3 > &triCoords)
 
bool subdivide_2Edge (const sofa::type::fixed_array< sofa::type::Vec3, 3 > &triCoords)
 
bool subdivide_3Edge (const sofa::type::fixed_array< sofa::type::Vec3, 3 > &triCoords)
 
bool subdivide_2Node (const sofa::type::fixed_array< sofa::type::Vec3, 3 > &triCoords)
 

Attribute details

◆ m_points

type::vector<std::shared_ptr<PointToAdd> > sofa::component::topology::container::dynamic::TriangleSubdivider::m_points
protected

Vector of new point to be added while subdividing this Triangle.

◆ m_snappedPoints

type::vector<std::shared_ptr<PointToAdd> > sofa::component::topology::container::dynamic::TriangleSubdivider::m_snappedPoints
protected

Vector of new point to be snapped while subdividing this Triangle.

◆ m_triangle

sofa::core::topology::BaseMeshTopology::Triangle sofa::component::topology::container::dynamic::TriangleSubdivider::m_triangle
protected

Triangle fixed array of the 3 vertex indices.

◆ m_triangleId

TriangleID sofa::component::topology::container::dynamic::TriangleSubdivider::m_triangleId
protected

Index of this triangle in the Topology Container.

◆ m_trianglesToAdd

type::vector<TriangleToAdd*> sofa::component::topology::container::dynamic::TriangleSubdivider::m_trianglesToAdd
protected

Vector of triangle to be added while subdividing this Triangle.

Constructor details

◆ TriangleSubdivider()

sofa::component::topology::container::dynamic::TriangleSubdivider::TriangleSubdivider ( TriangleID  triangleId,
const Triangle triangle 
)
explicit

◆ ~TriangleSubdivider()

sofa::component::topology::container::dynamic::TriangleSubdivider::~TriangleSubdivider ( )

Function details

◆ addPoint()

void sofa::component::topology::container::dynamic::TriangleSubdivider::addPoint ( std::shared_ptr< PointToAdd pTA)

Method to add a new.

See also
PointToAdd into this Triangle Subdivider

◆ computePointCoordinates()

sofa::type::Vec3 sofa::component::topology::container::dynamic::TriangleSubdivider::computePointCoordinates ( const PointToAdd PTA,
const sofa::type::fixed_array< sofa::type::Vec3, 3 > &  triCoords 
)
protected

◆ getPointsToAdd()

const type::vector< std::shared_ptr<PointToAdd> >& sofa::component::topology::container::dynamic::TriangleSubdivider::getPointsToAdd ( )
inline

Getter to the list of new.

See also
PointToAdd* created by this Triangle subdivider

◆ getTriangleIdToSplit()

TriangleID sofa::component::topology::container::dynamic::TriangleSubdivider::getTriangleIdToSplit ( )
inline

Return the index of the triangle, in the TopologyContainer, to split.

◆ getTrianglesToAdd()

const type::vector<TriangleToAdd*>& sofa::component::topology::container::dynamic::TriangleSubdivider::getTrianglesToAdd ( )
inline

Getter to the list of new.

See also
TriangleToAdd* created by this Triangle subdivider

◆ localVertexId()

PointID sofa::component::topology::container::dynamic::TriangleSubdivider::localVertexId ( PointID  vertexIndex)
protected

◆ subdivide()

bool sofa::component::topology::container::dynamic::TriangleSubdivider::subdivide ( const sofa::type::fixed_array< sofa::type::Vec3, 3 > &  triCoords)
virtual

◆ subdivide_1Edge()

bool sofa::component::topology::container::dynamic::TriangleSubdivider::subdivide_1Edge ( const sofa::type::fixed_array< sofa::type::Vec3, 3 > &  triCoords)
protected

Triangle subdivision configuration where 1 Node is added on one edge of the Triangle. In this case 2 new Triangles and 1 Point will be created.. Called internally by

See also
subdivide

◆ subdivide_1Node()

bool sofa::component::topology::container::dynamic::TriangleSubdivider::subdivide_1Node ( const sofa::type::fixed_array< sofa::type::Vec3, 3 > &  triCoords)
protected

Triangle subdivision configuration where 1 Node is added in inside of the Triangle. In this case 3 new Triangles and 1 Point will be created. Called internally by

See also
subdivide

◆ subdivide_2Edge()

bool sofa::component::topology::container::dynamic::TriangleSubdivider::subdivide_2Edge ( const sofa::type::fixed_array< sofa::type::Vec3, 3 > &  triCoords)
protected

Triangle subdivision configuration where 2 Nodes are added on 2 different edges of the Triangle. In this case 3 new Triangles and 2 Points will be created. Called internally by

See also
subdivide

◆ subdivide_2Node()

bool sofa::component::topology::container::dynamic::TriangleSubdivider::subdivide_2Node ( const sofa::type::fixed_array< sofa::type::Vec3, 3 > &  triCoords)
protected

Triangle subdivision configuration where 2 Nodes are added, 1 on edge and 1 inside of the Triangle. In this case 4 new Triangles and 2 Points will be created. Called internally by

See also
subdivide

◆ subdivide_3Edge()

bool sofa::component::topology::container::dynamic::TriangleSubdivider::subdivide_3Edge ( const sofa::type::fixed_array< sofa::type::Vec3, 3 > &  triCoords)
protected

Triangle subdivision configuration where 3 Nodes are added on 3 different edges of the Triangle. In this case 4 new Triangles and 3 Points will be created. Called internally by

See also
subdivide