Public Member Functions | Public Attributes | Static Public Attributes | List of all members
shapes::Mesh Class Reference

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>

Inheritance diagram for shapes::Mesh:
Inheritance graph
[legend]

Public Member Functions

virtual Shapeclone () const
 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. 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)
 
virtual void print (std::ostream &out=std::cout) const
 Print information about this shape. More...
 
virtual void scaleAndPadd (double scale, double padd)
 Scale and padd this shape. More...
 
virtual ~Mesh ()
 
- 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 padding to this shape. More...
 
void scale (double scale)
 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...
 

Detailed Description

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 196 of file shapes.h.

Constructor & Destructor Documentation

shapes::Mesh::Mesh ( )

Definition at line 148 of file shapes.cpp.

shapes::Mesh::Mesh ( unsigned int  v_count,
unsigned int  t_count 
)

Definition at line 159 of file shapes.cpp.

shapes::Mesh::~Mesh ( )
virtual

Definition at line 170 of file shapes.cpp.

Member Function Documentation

Shape * shapes::Mesh::clone ( ) const
virtual

Create a copy of this shape.

Implements shapes::Shape.

Definition at line 227 of file shapes.cpp.

void shapes::Mesh::computeTriangleNormals ( )

Compute the normals of each triangle from its vertices via cross product.

Definition at line 421 of file shapes.cpp.

void shapes::Mesh::computeVertexNormals ( )

Compute vertex normals by averaging from adjacent triangle normals.

Calls computeTriangleNormals() if needed.

Definition at line 444 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 485 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 381 of file shapes.cpp.

void shapes::Mesh::scaleAndPadd ( double  scale,
double  padd 
)
virtual

Scale and padd this shape.

Implements shapes::Shape.

Definition at line 310 of file shapes.cpp.

Member Data Documentation

const std::string shapes::Mesh::STRING_NAME = "mesh"
static

The type of the shape, as a string.

Definition at line 204 of file shapes.h.

unsigned int shapes::Mesh::triangle_count

The number of triangles formed with the vertices.

Definition at line 229 of file shapes.h.

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()

Definition at line 237 of file shapes.h.

unsigned int* shapes::Mesh::triangles

The vertex indices for each triangle triangle k has vertices at index (3k, 3k+1, 3k+2) = (v1, v2, v3)

Definition at line 233 of file shapes.h.

unsigned int shapes::Mesh::vertex_count

The number of available vertices.

Definition at line 222 of file shapes.h.

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()

Definition at line 241 of file shapes.h.

double* shapes::Mesh::vertices

The position for each vertex vertex k has values at index (3k, 3k+1, 3k+2) = (x,y,z)

Definition at line 226 of file shapes.h.


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


geometric_shapes
Author(s): Ioan Sucan , Gil Jones
autogenerated on Fri Jun 7 2019 21:59:29