All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | List of all members
SurgSim::Graphics::Mesh Class Reference

#include <SurgSim/Graphics/Mesh.h>

Inheritance diagram for SurgSim::Graphics::Mesh:
Inheritance graph
[legend]
Collaboration diagram for SurgSim::Graphics::Mesh:
Collaboration graph
[legend]

Public Member Functions

 Mesh ()
 Default constructor. More...
 
template<class VertexDataSource , class EdgeDataSource , class TriangleDataSource >
 Mesh (const TriangleMeshBase< VertexDataSource, EdgeDataSource, TriangleDataSource > &mesh)
 Copy constructor. More...
 
void initialize (const std::vector< SurgSim::Math::Vector3d > &vertices, const std::vector< SurgSim::Math::Vector4d > &colors, const std::vector< SurgSim::Math::Vector2d > &textures, const std::vector< size_t > &triangles)
 Utility function to initialize a mesh with plain data,. More...
 
- Public Member Functions inherited from SurgSim::DataStructures::TriangleMeshBase< VertexData, SurgSim::DataStructures::EmptyData, SurgSim::DataStructures::EmptyData >
 TriangleMeshBase ()
 Constructor. The mesh is initially empty (no vertices, no edges, no triangles). More...
 
 TriangleMeshBase (const TriangleMeshBase< VertexDataSource, EdgeDataSource, TriangleDataSource > &mesh)
 Copy constructor. More...
 
virtual ~TriangleMeshBase ()
 Destructor. More...
 
size_t addEdge (const EdgeType &edge)
 Adds an edge to the mesh. More...
 
size_t addTriangle (const TriangleType &triangle)
 Adds a triangle to the mesh. More...
 
size_t getNumEdges () const
 Get the number of edges. More...
 
size_t getNumTriangles () const
 Get the number of triangles. More...
 
const std::vector< EdgeType > & getEdges () const
 Retrieve all edges. More...
 
std::vector< EdgeType > & getEdges ()
 Retrieve all edges (non const version) More...
 
const std::vector< TriangleType > & getTriangles () const
 Retrieve all triangles. More...
 
std::vector< TriangleType > & getTriangles ()
 Retrieve all triangles (non const version) More...
 
const EdgeTypegetEdge (size_t id) const
 Retrieve a specific edge. More...
 
EdgeTypegetEdge (size_t id)
 Retrieve a specific edge (non const version) More...
 
const TriangleTypegetTriangle (size_t id) const
 Retrieve a specific triangle. More...
 
TriangleTypegetTriangle (size_t id)
 Retrieve a specific triangle (non const version) More...
 
void removeTriangle (size_t id)
 Marks a triangle as invalid, the triangle cannot be accessed via getTriangle anymore. More...
 
std::array
< SurgSim::Math::Vector3d, 3 > 
getTrianglePositions (size_t id) const
 Returns an array of the triangle's vertices' positions. More...
 
bool isValid () const
 Test if the TriangleMeshBase is valid (valid vertex Ids used in all MeshElements) More...
 
- Public Member Functions inherited from SurgSim::DataStructures::Vertices< VertexData >
 Vertices ()
 Constructor. The mesh is initially empty (no vertices). More...
 
virtual ~Vertices ()
 Destructor. More...
 
void clear ()
 Clear mesh to return to an empty state (no vertices). More...
 
void update ()
 Performs any updates that are required when the vertices are modified. More...
 
size_t addVertex (const VertexType &vertex)
 Adds a vertex to the mesh. More...
 
size_t getNumVertices () const
 Returns the number of vertices in this mesh. More...
 
const VertexTypegetVertex (size_t id) const
 Returns the specified vertex. More...
 
VertexTypegetVertex (size_t id)
 Returns the specified vertex (non const version). More...
 
const std::vector< VertexType > & getVertices () const
 Returns a vector containing the position of each vertex. More...
 
std::vector< VertexType > & getVertices ()
 Returns a vector containing the position of each vertex (non const version). More...
 
void setVertexPosition (size_t id, const SurgSim::Math::Vector3d &position)
 Sets the position of a vertex. More...
 
const SurgSim::Math::Vector3dgetVertexPosition (size_t id) const
 Returns the position of a vertex. More...
 
void setVertexPositions (const std::vector< SurgSim::Math::Vector3d > &positions, bool doUpdate=true)
 Sets the position of each vertex. More...
 
bool operator== (const Vertices &mesh) const
 Compares the mesh with another one (equality) More...
 
bool operator!= (const Vertices &mesh) const
 Compares the mesh with another one (inequality) More...
 

Additional Inherited Members

- Public Types inherited from SurgSim::DataStructures::TriangleMeshBase< VertexData, SurgSim::DataStructures::EmptyData, SurgSim::DataStructures::EmptyData >
typedef MeshElement
< 2, SurgSim::DataStructures::EmptyData
EdgeType
 Edge type for convenience (Ids of the 2 vertices) More...
 
typedef MeshElement
< 3, SurgSim::DataStructures::EmptyData
TriangleType
 Triangle type for convenience (Ids of the 3 vertices) More...
 
- Public Types inherited from SurgSim::DataStructures::Vertices< VertexData >
typedef Vertex< VertexData > VertexType
 Vertex type for convenience. More...
 
- Protected Member Functions inherited from SurgSim::DataStructures::TriangleMeshBase< VertexData, SurgSim::DataStructures::EmptyData, SurgSim::DataStructures::EmptyData >
virtual void doClearEdges ()
 Remove all edges from the mesh. More...
 
virtual void doClearTriangles ()
 Remove all triangles from the mesh. More...
 
virtual bool isEqual (const Vertices< VertexData > &mesh) const
 Internal comparison of meshes of the same type: returns true if equal, false if not equal. More...
 
- Protected Member Functions inherited from SurgSim::DataStructures::Vertices< VertexData >
virtual void doClearVertices ()
 Remove all vertices from the mesh. More...
 

Constructor & Destructor Documentation

SurgSim::Graphics::Mesh::Mesh ( )

Default constructor.

template<class VertexDataSource , class EdgeDataSource , class TriangleDataSource >
SurgSim::Graphics::Mesh::Mesh ( const TriangleMeshBase< VertexDataSource, EdgeDataSource, TriangleDataSource > &  mesh)
explicit

Copy constructor.

Template Parameters
VertexDataSourceType of extra data stored in each vertex
EdgeDataSourceType of extra data stored in each edge
TriangleDataSourceType of extra data stored in each triangle
Parameters
meshThe mesh to be copied from. Vertex, edge and triangle data will be emptied.
Note
: Data of the input mesh, i.e. VertexDataSource, EdgeDataSource and TrianleDataSource will not be copied.

Member Function Documentation

void SurgSim::Graphics::Mesh::initialize ( const std::vector< SurgSim::Math::Vector3d > &  vertices,
const std::vector< SurgSim::Math::Vector4d > &  colors,
const std::vector< SurgSim::Math::Vector2d > &  textures,
const std::vector< size_t > &  triangles 
)

Utility function to initialize a mesh with plain data,.

Parameters
verticesAn array of vertex coordinates.
colorsThe colors, the number of colors can be 0 or there have to be at least as many colors as vertices.
texturesThe textures coordinates, the number of coordinates can be 0 or there have to be at least as many texture coordinates as there are vertices.
trianglesThe triangles, a plain array of triplets of triangle indices, the indices should be points in the vertices array.

The documentation for this class was generated from the following files: