16 #ifndef SURGSIM_DATASTRUCTURES_TRIANGLEMESHBASE_H
17 #define SURGSIM_DATASTRUCTURES_TRIANGLEMESHBASE_H
26 namespace DataStructures
57 template <
class VertexData,
class EdgeData,
class TriangleData>
75 template <
class VertexDataSource,
class EdgeDataSource,
class TriangleDataSource>
88 size_t addEdge(
const EdgeType& edge);
111 const std::vector<EdgeType>&
getEdges()
const;
136 const EdgeType&
getEdge(
size_t id)
const;
211 #endif // SURGSIM_DATASTRUCTURES_TRIANGLEMESHBASE_H
Definition: DriveElementFromInputBehavior.cpp:27
bool isValid() const
Test if the TriangleMeshBase is valid (valid vertex Ids used in all MeshElements) ...
Definition: TriangleMeshBase-inl.h:194
size_t addEdge(const EdgeType &edge)
Adds an edge to the mesh.
Definition: TriangleMeshBase-inl.h:68
void removeTriangle(size_t id)
Marks a triangle as invalid, the triangle cannot be accessed via getTriangle anymore.
Definition: TriangleMeshBase-inl.h:169
std::vector< EdgeType > m_edges
Edges.
Definition: TriangleMeshBase.h:190
virtual void doClearEdges()
Remove all edges from the mesh.
Definition: TriangleMeshBase-inl.h:230
MeshElement< 3, TriangleData > TriangleType
Triangle type for convenience (Ids of the 3 vertices)
Definition: TriangleMeshBase.h:64
const std::vector< TriangleType > & getTriangles() const
Retrieve all triangles.
Definition: TriangleMeshBase-inl.h:124
Vertex structure for meshes.
Definition: Vertex.h:44
virtual ~TriangleMeshBase()
Destructor.
Definition: TriangleMeshBase-inl.h:63
size_t getNumEdges() const
Get the number of edges.
Definition: TriangleMeshBase-inl.h:97
std::vector< size_t > m_freeTriangles
List of indices of deleted triangles, to be reused when another triangle is added.
Definition: TriangleMeshBase.h:196
TriangleMeshBase()
Constructor. The mesh is initially empty (no vertices, no edges, no triangles).
Definition: TriangleMeshBase-inl.h:27
virtual bool isEqual(const Vertices< VertexData > &mesh) const
Internal comparison of meshes of the same type: returns true if equal, false if not equal...
Definition: TriangleMeshBase-inl.h:243
std::array< SurgSim::Math::Vector3d, 3 > getTrianglePositions(size_t id) const
Returns an array of the triangle's vertices' positions.
Definition: TriangleMeshBase-inl.h:179
const EdgeType & getEdge(size_t id) const
Retrieve a specific edge.
Definition: TriangleMeshBase-inl.h:138
Basic class for storing Triangle Meshes, handling basic vertex, edge, and triangle functionality...
Definition: TriangleMeshBase.h:58
size_t getNumTriangles() const
Get the number of triangles.
Definition: TriangleMeshBase-inl.h:103
virtual void doClearTriangles()
Remove all triangles from the mesh.
Definition: TriangleMeshBase-inl.h:236
virtual void doClear()
Clear mesh to return to an empty state (no vertices, no edges, no triangles).
Definition: TriangleMeshBase-inl.h:251
size_t addTriangle(const TriangleType &triangle)
Adds a triangle to the mesh.
Definition: TriangleMeshBase-inl.h:75
std::vector< TriangleType > m_triangles
Triangles.
Definition: TriangleMeshBase.h:193
Element structure for meshes.
Definition: MeshElement.h:44
const TriangleType & getTriangle(size_t id) const
Retrieve a specific triangle.
Definition: TriangleMeshBase-inl.h:152
MeshElement< 2, EdgeData > EdgeType
Edge type for convenience (Ids of the 2 vertices)
Definition: TriangleMeshBase.h:62
Base class for mesh structures, handling basic vertex functionality.
Definition: Vertices.h:50
const std::vector< EdgeType > & getEdges() const
Retrieve all edges.
Definition: TriangleMeshBase-inl.h:110