Definition of a triangle mesh By convention the "center" of the shape is at the origin. For a mesh this implies that the AABB of the mesh is centered at the origin. Some methods may not work with arbitrary meshes whose AABB is not centered at the origin. More...
#include <shapes.h>
Public Member Functions | |
virtual Shape * | clone () const |
Create a copy of this shape. | |
void | computeTriangleNormals () |
The normals to each triangle can be computed from the vertices using cross products. This function performs this computation and allocates memory for normals if needed. | |
void | computeVertexNormals () |
The normals to each vertex, averaged from the triangle normals. computeTriangleNormals() is automatically called if needed. | |
void | mergeVertices (double threshold) |
Merge vertices that are very close to each other, up to a threshold. | |
Mesh () | |
Mesh (unsigned int v_count, unsigned int t_count) | |
virtual void | print (std::ostream &out=std::cout) const |
Print information about this shape. | |
virtual void | scaleAndPadd (double scale, double padd) |
Scale and padd this shape. | |
virtual | ~Mesh () |
Public Attributes | |
unsigned int | triangle_count |
The number of triangles formed with the vertices. | |
double * | triangle_normals |
The normal to each triangle; unit vector represented as (x,y,z); If missing from the mesh, these vectors can be computed using computeTriangleNormals() | |
unsigned int * | triangles |
The vertex indices for each triangle triangle k has vertices at index (3k, 3k+1, 3k+2) = (v1, v2, v3) | |
unsigned int | vertex_count |
The number of available vertices. | |
double * | vertex_normals |
The normal to each vertex; unit vector represented as (x,y,z); If missing from the mesh, these vectors can be computed using computeVertexNormals() | |
double * | vertices |
The position for each vertex vertex k has values at index (3k, 3k+1, 3k+2) = (x,y,z) | |
Static Public Attributes | |
static const std::string | STRING_NAME = "mesh" |
The type of the shape, as a string. |
Definition of a triangle mesh By convention the "center" of the shape is at the origin. For a mesh this implies that the AABB of the mesh is centered at the origin. Some methods may not work with arbitrary meshes whose AABB is not centered at the origin.
Definition at line 111 of file shapes.cpp.
shapes::Mesh::Mesh | ( | unsigned int | v_count, |
unsigned int | t_count | ||
) |
Definition at line 122 of file shapes.cpp.
shapes::Mesh::~Mesh | ( | ) | [virtual] |
Definition at line 133 of file shapes.cpp.
shapes::Shape * shapes::Mesh::clone | ( | ) | const [virtual] |
void shapes::Mesh::computeTriangleNormals | ( | ) |
The normals to each triangle can be computed from the vertices using cross products. This function performs this computation and allocates memory for normals if needed.
Definition at line 381 of file shapes.cpp.
void shapes::Mesh::computeVertexNormals | ( | ) |
The normals to each vertex, averaged from the triangle normals. computeTriangleNormals() is automatically called if needed.
Definition at line 404 of file shapes.cpp.
void shapes::Mesh::mergeVertices | ( | double | threshold | ) |
Merge vertices that are very close to each other, up to a threshold.
Definition at line 445 of file shapes.cpp.
void shapes::Mesh::print | ( | std::ostream & | out = std::cout | ) | const [virtual] |
Print information about this shape.
Reimplemented from shapes::Shape.
Definition at line 341 of file shapes.cpp.
void shapes::Mesh::scaleAndPadd | ( | double | scale, |
double | padd | ||
) | [virtual] |
const std::string shapes::Mesh::STRING_NAME = "mesh" [static] |
unsigned int shapes::Mesh::triangle_count |
double* shapes::Mesh::triangle_normals |
The normal to each triangle; unit vector represented as (x,y,z); If missing from the mesh, these vectors can be computed using computeTriangleNormals()
unsigned int* shapes::Mesh::triangles |
unsigned int shapes::Mesh::vertex_count |
double* shapes::Mesh::vertex_normals |
The normal to each vertex; unit vector represented as (x,y,z); If missing from the mesh, these vectors can be computed using computeVertexNormals()
double* shapes::Mesh::vertices |