opensurgsim
Public Types | Public Member Functions | Public Attributes | List of all members
SurgSim::DataStructures::MeshElement< N, Data > Struct Template Reference

Element structure for meshes. More...

#include <MeshElement.h>

Public Types

typedef std::array< size_t, N > IdType
 

Public Member Functions

 MeshElement (const std::array< size_t, N > &verticesId, const Data &data)
 Constructor. More...
 
 MeshElement (const std::array< size_t, N > &verticesId)
 Constructor where the Data is constructed by its default constructor. More...
 
template<class T >
 MeshElement (const MeshElement< N, T > &other)
 Copy constructor when the template data is a different type In this case, no data will be copied. More...
 
bool operator== (const MeshElement< N, Data > &element) const
 Compare the element with another one (equality) More...
 
bool operator!= (const MeshElement< N, Data > &element) const
 Compare the element with another one (inequality) More...
 

Public Attributes

IdType verticesId
 Element vertices.
 
Data data
 Extra element data.
 
bool isValid
 Is this a valid element.
 

Detailed Description

template<size_t N, class Data>
struct SurgSim::DataStructures::MeshElement< N, Data >

Element structure for meshes.

MeshElement combines Vertices to form the structure of a mesh and can store extra per-element data.

MeshElement is to be used purely as a data structure and not provide implementation of algorithms. For example, a physics FEM's elements are not subclasses of MeshElement if they provide code that is part of the FEM algorithm, but they may used with a Mesh to store the structure of the FEM.

The extra Data is left up to the particular use of Mesh to specify. For example, for use collision detection, a vertex may need a normal and adjacent triangle information, which could be stored in a struct.

If no extra Data is needed, a specialization exists for void, in which case the constructor takes no data.

Template Parameters
NNumber of vertices in the element
DataType of extra data stored in the element (void for no data)
See also
Vertices

Constructor & Destructor Documentation

§ MeshElement() [1/3]

template<size_t N, class Data>
SurgSim::DataStructures::MeshElement< N, Data >::MeshElement ( const std::array< size_t, N > &  verticesId,
const Data &  data 
)
inline

Constructor.

Parameters
verticesIdIDs of the N element vertices
dataExtra data to be stored with the element

§ MeshElement() [2/3]

template<size_t N, class Data>
SurgSim::DataStructures::MeshElement< N, Data >::MeshElement ( const std::array< size_t, N > &  verticesId)
inlineexplicit

Constructor where the Data is constructed by its default constructor.

Parameters
verticesIdIDs of the N element vertices

§ MeshElement() [3/3]

template<size_t N, class Data>
template<class T >
SurgSim::DataStructures::MeshElement< N, Data >::MeshElement ( const MeshElement< N, T > &  other)
inlineexplicit

Copy constructor when the template data is a different type In this case, no data will be copied.

Template Parameters
Ttype of data stored in the other MeshElement
Parameters
otherthe MeshElement to copy from

Member Function Documentation

§ operator!=()

template<size_t N, class Data>
bool SurgSim::DataStructures::MeshElement< N, Data >::operator!= ( const MeshElement< N, Data > &  element) const
inline

Compare the element with another one (inequality)

Parameters
elementThe MeshElement to compare it to
Returns
False if the two MeshElements are equals, True otherwise

§ operator==()

template<size_t N, class Data>
bool SurgSim::DataStructures::MeshElement< N, Data >::operator== ( const MeshElement< N, Data > &  element) const
inline

Compare the element with another one (equality)

Parameters
elementThe MeshElement to compare it to
Returns
True if the two MeshElements are equals, False otherwise

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