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. Padding is not applied to vertices plainly coordinatewise, but instead the padding value is added to the length of the direction vector between centroid and each vertex. More...
#include <shapes.h>
Public Member Functions  
Mesh *  clone () const override 
Create a copy of this shape. More...  
void  computeTriangleNormals () 
Compute the normals of each triangle from its vertices via cross product. More...  
void  computeVertexNormals () 
Compute vertex normals by averaging from adjacent triangle normals, weighted using magnitude of angles formed by adjacent triangles at the vertex. More...  
void  mergeVertices (double threshold) 
Merge vertices that are very close to each other, up to a threshold. More...  
Mesh ()  
Mesh (unsigned int v_count, unsigned int t_count)  
void  padd (double padding) 
Add uniform padding to this shape. More...  
void  padd (double paddX, double paddY, double paddZ) 
Add nonuniform padding to this shape. More...  
void  print (std::ostream &out=std::cout) const override 
Print information about this shape. More...  
void  scale (double scale) 
Uniformly scale this shape by a factor. More...  
void  scale (double scaleX, double scaleY, double scaleZ) 
Scale this shape by a nonuniform factor. More...  
void  scaleAndPadd (double scale, double padd) override 
Uniformly scale and padd this shape. More...  
void  scaleAndPadd (double scaleX, double scaleY, double scaleZ, double paddX, double paddY, double paddZ) 
Scale this shape by a nonuniform factor and then add nonuniform padding. More...  
~Mesh () override  
Public Member Functions inherited from shapes::Shape  
virtual bool  isFixed () const 
Return a flag indicating whether this shape can be scaled and/or padded. More...  
void  padd (double padding) 
Add uniform padding to this shape. More...  
void  scale (double scale) 
Uniformly scale this shape by a factor. More...  
Shape ()  
virtual  ~Shape () 
Public Attributes  
unsigned int  triangle_count 
The number of triangles formed with the vertices. More...  
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() More...  
unsigned int *  triangles 
The vertex indices for each triangle triangle k has vertices at index (3k, 3k+1, 3k+2) = (v1, v2, v3) More...  
unsigned int  vertex_count 
The number of available vertices. More...  
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() More...  
double *  vertices 
The position for each vertex vertex k has values at index (3k, 3k+1, 3k+2) = (x,y,z) More...  
Public Attributes inherited from shapes::Shape  
ShapeType  type 
The type of the shape. More...  
Static Public Attributes  
static const std::string  STRING_NAME = "mesh" 
The type of the shape, as a string. More...  
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. Padding is not applied to vertices plainly coordinatewise, but instead the padding value is added to the length of the direction vector between centroid and each vertex.
shapes::Mesh::Mesh  (  ) 
Definition at line 188 of file shapes.cpp.
shapes::Mesh::Mesh  (  unsigned int  v_count, 
unsigned int  t_count  
) 
Definition at line 199 of file shapes.cpp.

override 
Definition at line 210 of file shapes.cpp.

overridevirtual 
void shapes::Mesh::computeTriangleNormals  (  ) 
Compute the normals of each triangle from its vertices via cross product.
Definition at line 526 of file shapes.cpp.
void shapes::Mesh::computeVertexNormals  (  ) 
Compute vertex normals by averaging from adjacent triangle normals, weighted using magnitude of angles formed by adjacent triangles at the vertex.
Calls computeTriangleNormals() if needed.
Definition at line 549 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 600 of file shapes.cpp.
void shapes::Shape::padd 
Add uniform padding to this shape.
Definition at line 320 of file shapes.cpp.
void shapes::Mesh::padd  (  double  paddX, 
double  paddY,  
double  paddZ  
) 
Add nonuniform padding to this shape.
paddX  Padding in xdimension (in meters). 
paddY  Padding in ydimension (in meters). 
paddZ  Padding in zdimension (in meters). 
Definition at line 451 of file shapes.cpp.

overridevirtual 
Print information about this shape.
Reimplemented from shapes::Shape.
Definition at line 486 of file shapes.cpp.
void shapes::Shape::scale 
Uniformly scale this shape by a factor.
Definition at line 315 of file shapes.cpp.
void shapes::Mesh::scale  (  double  scaleX, 
double  scaleY,  
double  scaleZ  
) 
Scale this shape by a nonuniform factor.
scaleX  Scale in xdimension. 
scaleY  Scale in ydimension. 
scaleZ  Scale in zdimension. 
Definition at line 446 of file shapes.cpp.

overridevirtual 
Uniformly scale and padd this shape.
Implements shapes::Shape.
Definition at line 456 of file shapes.cpp.
void shapes::Mesh::scaleAndPadd  (  double  scaleX, 
double  scaleY,  
double  scaleZ,  
double  paddX,  
double  paddY,  
double  paddZ  
) 
Scale this shape by a nonuniform factor and then add nonuniform padding.
scaleX  Scale in xdimension. 
scaleY  Scale in ydimension. 
scaleZ  Scale in zdimension. 
paddX  Padding in xdimension (in meters). 
paddY  Padding in ydimension (in meters). 
paddZ  Padding in zdimension (in meters). 
Definition at line 410 of file shapes.cpp.

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 