Go to the documentation of this file.
16 #ifndef SURGSIM_DATASTRUCTURES_TRIANGLEMESH_H
17 #define SURGSIM_DATASTRUCTURES_TRIANGLEMESH_H
31 namespace DataStructures
61 template <
class VertexData,
class EdgeData,
class TriangleData>
63 public std::enable_shared_from_this<TriangleMesh<VertexData, EdgeData, TriangleData>>
84 template <
class V,
class E,
class T>
137 const std::vector<EdgeType>&
getEdges()
const;
256 #endif // SURGSIM_DATASTRUCTURES_TRIANGLEMESH_H
TriangleMesh< VertexData, EdgeData, TriangleData > & operator=(const TriangleMesh< VertexData, EdgeData, TriangleData > &other)
Copy Assignment.
Definition: TriangleMesh-inl.h:322
Basic class for storing Triangle Meshes, handling basic vertex, edge, and triangle functionality.
Definition: TriangleMesh.h:64
static std::string m_className
Definition: TriangleMesh.h:224
bool doLoad(const std::string &fileName) override
Derived classes will overwrite this method to do actual loading.
Definition: TriangleMesh-inl.h:280
size_t getNumTriangles() const
Get the number of triangles.
Definition: TriangleMesh-inl.h:116
bool isValid() const
Test if the TriangleMesh is valid (valid vertex Ids used in all MeshElements)
Definition: TriangleMesh-inl.h:223
const std::vector< EdgeType > & getEdges() const
Retrieve all edges.
Definition: TriangleMesh-inl.h:123
size_t getNumEdges() const
Get the number of edges.
Definition: TriangleMesh-inl.h:110
Base class for mesh structures, handling basic vertex functionality.
Definition: Vertices.h:52
std::vector< TriangleType > m_triangles
Triangles.
Definition: TriangleMesh.h:235
void removeTriangle(size_t id)
Marks a triangle as invalid, the triangle cannot be accessed via getTriangle anymore.
Definition: TriangleMesh-inl.h:197
Element structure for meshes.
Definition: MeshElement.h:45
std::array< SurgSim::Math::Vector3d, 3 > getTrianglePositions(size_t id) const
Returns an array of the triangle's vertices' positions.
Definition: TriangleMesh-inl.h:209
size_t addTriangle(const TriangleType &triangle)
Adds a triangle to the mesh.
Definition: TriangleMesh-inl.h:88
const std::vector< TriangleType > & getTriangles() const
Retrieve all triangles.
Definition: TriangleMesh-inl.h:137
virtual void doClearEdges()
Remove all edges from the mesh.
Definition: TriangleMesh-inl.h:259
Definition: CompoundShapeToGraphics.cpp:30
Vertex structure for meshes.
Definition: Vertex.h:45
virtual ~TriangleMesh()
Destructor.
Definition: TriangleMesh-inl.h:69
MeshElement< 3, TriangleData > TriangleType
Triangle type for convenience (Ids of the 3 vertices)
Definition: TriangleMesh.h:69
void save(const std::string &fileName)
Save the triangle mesh in the ply format.
Definition: TriangleMesh-inl.h:346
const EdgeType & getEdge(size_t id) const
Retrieve a specific edge.
Definition: TriangleMesh-inl.h:151
virtual void doClearTriangles()
Remove all triangles from the mesh.
Definition: TriangleMesh-inl.h:265
std::vector< EdgeType > m_edges
Edges.
Definition: TriangleMesh.h:232
std::vector< size_t > m_freeTriangles
List of indices of deleted triangles, to be reused when another triangle is added.
Definition: TriangleMesh.h:238
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: TriangleMesh-inl.h:272
std::string getClassName() const override
Support serialization with a classname.
Definition: TriangleMesh-inl.h:74
virtual void doClear()
Clear mesh to return to an empty state (no vertices, no edges, no triangles).
Definition: TriangleMesh-inl.h:303
TriangleMesh()
Constructor. The mesh is initially empty (no vertices, no edges, no triangles).
Definition: TriangleMesh-inl.h:28
MeshElement< 2, EdgeData > EdgeType
Edge type for convenience (Ids of the 2 vertices)
Definition: TriangleMesh.h:67
This class is used to facilitate file loading.
Definition: Asset.h:40
string(TOUPPER ${DEVICE} DEVICE_UPPER_CASE) option(BUILD_DEVICE_$
Definition: CMakeLists.txt:38
const TriangleType & getTriangle(size_t id) const
Retrieve a specific triangle.
Definition: TriangleMesh-inl.h:179
std::array< SurgSim::Math::Vector3d, 2 > getEdgePositions(size_t id) const
Returns an array of the edge's vertices' positions.
Definition: TriangleMesh-inl.h:165
TriangleMesh< EmptyData, EmptyData, EmptyData > TriangleMeshPlain
Definition: TriangleMesh.h:249
size_t addEdge(const EdgeType &edge)
Adds an edge to the mesh.
Definition: TriangleMesh-inl.h:81