SurgSim::DataStructures::MeshElement< N, Data > Struct Template Reference

Element structure for meshes. More...

`#include <SurgSim/DataStructures/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. More...
Data | data
| Extra element data. More...
bool | isValid
| Is this a valid element. More...

## 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

  N | Number of vertices in the element
  Data | Type of extra data stored in the element (void for no data)

See also
  Vertices

## Member Typedef Documentation

## IdType

template<size_t N, class Data>

typedef std::array<size_t, N> SurgSim::DataStructures::MeshElement< N, Data >::IdType

## 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

  verticesId | IDs of the N element vertices
  data | Extra 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 | ) |

inline explicit

Constructor where the Data is constructed by its default constructor.

Parameters

  verticesId | IDs 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 | ) |

inline explicit

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

Template Parameters

  T | type of data stored in the other MeshElement

Parameters

  other | the 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

  element | The 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

  element | The MeshElement to compare it to

Returns
  True if the two MeshElements are equals, False otherwise

## Member Data Documentation

## data

template<size_t N, class Data>

Data SurgSim::DataStructures::MeshElement< N, Data >::data

Extra element data.

## isValid

template<size_t N, class Data>

bool SurgSim::DataStructures::MeshElement< N, Data >::isValid

Is this a valid element.

## verticesId

template<size_t N, class Data>

IdType SurgSim::DataStructures::MeshElement< N, Data >::verticesId

Element vertices.

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

- SurgSim/DataStructures/MeshElement.h