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

#include <EdgeSetTopologyAlgorithms.h>

forward declaration to avoid adding includes in .h More...

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

Detailed Description

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

forward declaration to avoid adding includes in .h

A class that provides geometry information on an EdgeSet.

Protected Attributes

bool initializedEdgeCubatureTables
 
Data< boolshowEdgeIndices
 Debug : view Edge indices. More...
 
Data< boold_drawEdges
 if true, draw the edges in the topology. More...
 
Data< RGBAColor_drawColor
 
NumericalIntegrationDescriptor< Real, 1 > edgeNumericalIntegration
 include cubature points More...
 
- Protected Attributes inherited from sofa::component::topology::PointSetGeometryAlgorithms< DataTypes >
sofa::core::behavior::MechanicalState< DataTypes > * object
 
sofa::core::topology::BaseMeshTopologym_topology
 
Data< floatd_showIndicesScale
 Debug : scale for view topology indices. More...
 
Data< boold_showPointIndices
 
Data< std::string > d_tagMechanics
 Tage of the Mechanical State associated with the vertex position. More...
 
SingleLink< PointSetGeometryAlgorithms< DataTypes >, sofa::core::topology::BaseMeshTopology, BaseLink::FLAG_STOREPATH|BaseLink::FLAG_STRONGLINKl_topology
 Link to be set to the topology container in the component graph. More...
 

Public Member Functions

 SOFA_CLASS (SOFA_TEMPLATE(EdgeSetGeometryAlgorithms, DataTypes), SOFA_TEMPLATE(PointSetGeometryAlgorithms, DataTypes))
 
void draw (const core::visual::VisualParams *vparams) override
 
Real computeEdgeLength (const EdgeID i) const
 computes the length of edge no i and returns it More...
 
void computeEdgeLength (BasicArrayInterface< Real > &ai) const
 computes the edge length of all edges and stores it in the array interface More...
 
Real computeRestEdgeLength (const EdgeID i) const
 computes the initial length of edge no i and returns it More...
 
Real computeRestSquareEdgeLength (const EdgeID i) const
 computes the initial square length of edge no i and returns it More...
 
void computeEdgeAABB (const EdgeID i, CPos &minCoord, CPos &maxCoord) const
 
Coord computeEdgeCenter (const EdgeID i) const
 
Coord computeEdgeDirection (const EdgeID i) const
 
Coord computeRestEdgeDirection (const EdgeID i) const
 
void getEdgeVertexCoordinates (const EdgeID i, Coord[2]) const
 
void getRestEdgeVertexCoordinates (const EdgeID i, Coord[2]) const
 
bool isPointOnEdge (const sofa::defaulttype::Vec< 3, double > &pt, const EdgeID ind_e) const
 
sofa::helper::vector< doublecompute2PointsBarycoefs (const sofa::defaulttype::Vec< 3, double > &p, PointID ind_p1, PointID ind_p2) const
 
sofa::helper::vector< doublecomputeRest2PointsBarycoefs (const sofa::defaulttype::Vec< 3, double > &p, PointID ind_p1, PointID ind_p2) const
 
sofa::helper::vector< doublecomputePointProjectionOnEdge (const EdgeID i, sofa::defaulttype::Vec< 3, double > coord_x, bool &intersected)
 Compute the projection coordinate of a point C on the edge i. Using compute2EdgesIntersection(). More...
 
Coord compute2EdgesIntersection (const Coord edge1[2], const Coord edge2[2], bool &intersected)
 Compute the intersection coordinate of the 2 input straight lines. Lines vector director are computed using coord given in input. More...
 
bool computeEdgePlaneIntersection (EdgeID edgeID, sofa::defaulttype::Vec< 3, Real > pointOnPlane, sofa::defaulttype::Vec< 3, Real > normalOfPlane, sofa::defaulttype::Vec< 3, Real > &intersection)
 
bool computeRestEdgePlaneIntersection (EdgeID edgeID, sofa::defaulttype::Vec< 3, Real > pointOnPlane, sofa::defaulttype::Vec< 3, Real > normalOfPlane, sofa::defaulttype::Vec< 3, Real > &intersection)
 
void writeMSHfile (const char *filename) const
 Write the current mesh into a msh file. More...
 
void computeLocalFrameEdgeWeights (helper::vector< EdgeID > &numEdges, helper::vector< Edge > &edges, helper::vector< Vec3d > &weights) const
 
void initPointAdded (PointID indice, const core::topology::PointAncestorElem &ancestorElem, const helper::vector< VecCoord * > &coordVecs, const helper::vector< VecDeriv * > &derivVecs) override
 Process the added point initialization according to the topology and local coordinates. More...
 
NumericalIntegrationDescriptor< Real, 1 > & getEdgeNumericalIntegrationDescriptor ()
 
- Public Member Functions inherited from sofa::component::topology::PointSetGeometryAlgorithms< DataTypes >
 SOFA_CLASS (SOFA_TEMPLATE(PointSetGeometryAlgorithms, DataTypes), core::topology::GeometryAlgorithms)
 
Angle computeAngle (PointID ind_p0, PointID ind_p1, PointID ind_p2) const
 
void init () override
 
void reinit () override
 
void draw (const core::visual::VisualParams *vparams) override
 
Coord getPointSetCenter () const
 
void getEnclosingSphere (Coord &center, Real &radius) const
 
void getAABB (Real bb[6]) const
 
void getAABB (CPos &minCoord, CPos &maxCoord) const
 Returns the axis aligned bounding box. More...
 
const CoordgetPointPosition (const PointID pointId) const
 
const CoordgetPointRestPosition (const PointID pointId) const
 
sofa::core::behavior::MechanicalState< DataTypes > * getDOF () const
 Returns the object where the mechanical DOFs are stored. More...
 
float getIndicesScale () const
 
void initPointsAdded (const helper::vector< sofa::defaulttype::index_type > &indices, const helper::vector< core::topology::PointAncestorElem > &ancestorElems, const helper::vector< core::VecCoordId > &coordVecs, const helper::vector< core::VecDerivId > &derivVecs) override
 Called by the MechanicalObject state change callback to initialize added points according to the topology (topology element & local coordinates) More...
 

Protected Member Functions

 EdgeSetGeometryAlgorithms ()
 
 ~EdgeSetGeometryAlgorithms () override
 
void defineEdgeCubaturePoints ()
 
- Protected Member Functions inherited from sofa::component::topology::PointSetGeometryAlgorithms< DataTypes >
 PointSetGeometryAlgorithms ()
 
 ~PointSetGeometryAlgorithms () override
 

Additional Inherited Members

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

Attribute details

template<class DataTypes>
Data<RGBAColor> sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::_drawColor
protected

RGB code color used to draw edges.

template<class DataTypes>
Data<bool> sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::d_drawEdges
protected

if true, draw the edges in the topology.

template<class DataTypes>
NumericalIntegrationDescriptor<Real,1> sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::edgeNumericalIntegration
protected

include cubature points

template<class DataTypes>
bool sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::initializedEdgeCubatureTables
protected
template<class DataTypes>
Data<bool> sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::showEdgeIndices
protected

Debug : view Edge indices.

Constructor details

template<class DataTypes>
sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::EdgeSetGeometryAlgorithms ( )
inlineprotected
template<class DataTypes>
sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::~EdgeSetGeometryAlgorithms ( )
inlineoverrideprotected

Function details

template<class DataTypes >
DataTypes::Coord sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::compute2EdgesIntersection ( const Coord  edge1[2],
const Coord  edge2[2],
bool intersected 
)

Compute the intersection coordinate of the 2 input straight lines. Lines vector director are computed using coord given in input.

Parameters
edge1tab Coord[2] from the 2 vertices composing first edge
edge2same for second edge
intersectedbool default value true, changed as false if no intersection is done.
Returns
Coord of intersection point, 0 if no intersection.
template<class DataTypes >
sofa::helper::vector< double > sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::compute2PointsBarycoefs ( const sofa::defaulttype::Vec< 3, double > &  p,
PointID  ind_p1,
PointID  ind_p2 
) const
template<class DataTypes >
void sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::computeEdgeAABB ( const EdgeID  i,
CPos minCoord,
CPos maxCoord 
) const
template<class DataTypes >
DataTypes::Coord sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::computeEdgeCenter ( const EdgeID  i) const
template<class DataTypes >
DataTypes::Coord sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::computeEdgeDirection ( const EdgeID  i) const
template<class DataTypes >
DataTypes::Real sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::computeEdgeLength ( const EdgeID  i) const

computes the length of edge no i and returns it

template<class DataTypes >
void sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::computeEdgeLength ( BasicArrayInterface< Real > &  ai) const

computes the edge length of all edges and stores it in the array interface

computes the edge length of all edges are store in the array interface

template<class DataTypes >
bool sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::computeEdgePlaneIntersection ( EdgeID  edgeID,
sofa::defaulttype::Vec< 3, Real pointOnPlane,
sofa::defaulttype::Vec< 3, Real normalOfPlane,
sofa::defaulttype::Vec< 3, Real > &  intersection 
)
template<class DataTypes >
void sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::computeLocalFrameEdgeWeights ( helper::vector< EdgeID > &  numEdges,
helper::vector< Edge > &  edges,
helper::vector< Vec3d > &  weights 
) const

Computes weights allowing to compute the deformation gradient (deformed basis) at each vertex during the simulation, for a volumetric object. For each vertex, computes the weights associated with each edge around the vertex, so that the weighted sum of the edges corresponds to the identity. The current configuration is taken as reference. During the simulation, the weights and edge indices can be used to compute rotated and deformed bases for each vertex

The output vectors contain the concatenation of the values for each vertex. The weights are computed using a pseudo-inverse of the edge matrix: w_i = Vt_i.(V.Vt)^{-1}.Id3

Parameters
numEdgesnumber of edges attached to a vertex
edgesattached to the vertices
weightsassociated with the edges. Each Vec3d represents the contribution of the associated edge to x,y and z of the deformed basis.
template<class DataTypes >
sofa::helper::vector< double > sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::computePointProjectionOnEdge ( const EdgeID  i,
sofa::defaulttype::Vec< 3, double coord_x,
bool intersected 
)

Compute the projection coordinate of a point C on the edge i. Using compute2EdgesIntersection().

Parameters
iedgeID on which point is projected.
coord_xcoordinate of point to project
intersectedbool default value true, changed as false if no intersection is done.
Returns
barycentric coefficient of the projection in edgeID i.
template<class DataTypes >
sofa::helper::vector< double > sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::computeRest2PointsBarycoefs ( const sofa::defaulttype::Vec< 3, double > &  p,
PointID  ind_p1,
PointID  ind_p2 
) const
template<class DataTypes >
DataTypes::Coord sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::computeRestEdgeDirection ( const EdgeID  i) const
template<class DataTypes >
DataTypes::Real sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::computeRestEdgeLength ( const EdgeID  i) const

computes the initial length of edge no i and returns it

template<class DataTypes >
bool sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::computeRestEdgePlaneIntersection ( EdgeID  edgeID,
sofa::defaulttype::Vec< 3, Real pointOnPlane,
sofa::defaulttype::Vec< 3, Real normalOfPlane,
sofa::defaulttype::Vec< 3, Real > &  intersection 
)
template<class DataTypes >
DataTypes::Real sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::computeRestSquareEdgeLength ( const EdgeID  i) const

computes the initial square length of edge no i and returns it

template<class DataTypes >
void sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::defineEdgeCubaturePoints ( )
protected
template<class DataTypes >
void sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::draw ( const core::visual::VisualParams vparams)
override
template<class DataTypes >
NumericalIntegrationDescriptor< typename EdgeSetGeometryAlgorithms< DataTypes >::Real, 1 > & sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::getEdgeNumericalIntegrationDescriptor ( )

return a pointer to the container of cubature points

template<class DataTypes >
void sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::getEdgeVertexCoordinates ( const EdgeID  i,
Coord  pnt[2] 
) const
template<class DataTypes >
void sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::getRestEdgeVertexCoordinates ( const EdgeID  i,
Coord  pnt[2] 
) const
template<class DataTypes >
void sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::initPointAdded ( PointID  indice,
const core::topology::PointAncestorElem ancestorElem,
const helper::vector< VecCoord * > &  coordVecs,
const helper::vector< VecDeriv * > &  derivVecs 
)
overridevirtual
template<class DataTypes >
bool sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::isPointOnEdge ( const sofa::defaulttype::Vec< 3, double > &  pt,
const EdgeID  ind_e 
) const
template<class DataTypes>
sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::SOFA_CLASS ( SOFA_TEMPLATE(EdgeSetGeometryAlgorithms< DataTypes >, DataTypes)  ,
SOFA_TEMPLATE(PointSetGeometryAlgorithms, DataTypes)   
)
template<typename DataTypes >
void sofa::component::topology::EdgeSetGeometryAlgorithms< DataTypes >::writeMSHfile ( const char *  filename) const

Write the current mesh into a msh file.

Enum details

template<class DataTypes>
anonymous enum
Enumerator
NC