CTriangleMesh Class Reference

A class to deine a triangle mesh with some attributes. More...

#include <mia/mesh/triangularMesh.hh>

Inheritance diagram for CTriangleMesh:
[legend]
Collaboration diagram for CTriangleMesh:
[legend]

Public Types

enum  EData {
  ed_none = 0, ed_vertex = 1, ed_normal = 2, ed_color = 4,
  ed_scale = 8
}
 these are some flags to indicate, which data is actually available More...
 
typedef std::shared_ptr< CTriangleMeshPointer
 
typedef CTriangleMesh type
 

Public Member Functions

CTriangleMeshclone () const __attribute__((warn_unused_result))
 
CTriangleMesh clone_connectivity () const
 
const color_type & color_at (unsigned int i) const
 
 CTriangleMesh ()
 Standart constructor creates an empty mesh. More...
 
 CTriangleMesh (const CTriangleMesh &orig)
 
 CTriangleMesh (int n_triangles, int n_vertices)
 
 CTriangleMesh (PTrianglefield triangles, PVertexfield vertices, PNormalfield normals, PColorfield colors, PScalefield scales)
 
 CTriangleMesh (PTrianglefield triangles, PVertexfield vertices)
 
void evaluate_normals ()
 
int get_available_data () const
 
const void * get_color_pointer () const
 
const void * get_normal_pointer () const
 
const std::string & get_sourceformat () const
 
const void * get_triangle_pointer () const
 
const void * get_vertex_pointer () const
 
const normal_type & normal_at (unsigned int i) const
 
const scale_type & scale_at (unsigned int i) const
 
void set_sourceformat (const std::string &fmt)
 
const triangle_type & triangle_at (unsigned int i) const
 
unsigned int triangle_size () const
 
const vertex_type & vertex_at (unsigned int i) const
 
unsigned int vertices_size () const
 
 ~CTriangleMesh ()
 Destructor - it releases all the data. More...
 
- Public Member Functions inherited from CIOData
const std::string & get_source_format () const
 
void set_source_format (const std::string &format)
 

Static Public Member Functions

static const std::string get_type_description ()
 

Static Public Attributes

static const char * data_descr
 

Detailed Description

A class to deine a triangle mesh with some attributes.

This class defines the representation of a triangle-mesh.

Definition at line 61 of file triangularMesh.hh.

Member Typedef Documentation

typedef std::shared_ptr<CTriangleMesh> CTriangleMesh::Pointer

Definition at line 71 of file triangularMesh.hh.

Definition at line 68 of file triangularMesh.hh.

Constructor & Destructor Documentation

CTriangleMesh::CTriangleMesh ( )

Standart constructor creates an empty mesh.

CTriangleMesh::CTriangleMesh ( const CTriangleMesh orig)

copy constructor makes a shallow copy of the mesh, i.e. the storage for triangles, vertices, normals, textur-coordinates, colors and the deformation-scale is shared between original and copy

Parameters
origthe mesh to be copied
CTriangleMesh::CTriangleMesh ( int  n_triangles,
int  n_vertices 
)

contruct an mesh with uninitialized data

Parameters
n_trianglesnumber of triangles
n_verticesnumber of vertices
CTriangleMesh::CTriangleMesh ( PTrianglefield  triangles,
PVertexfield  vertices,
PNormalfield  normals,
PColorfield  colors,
PScalefield  scales 
)

creates a new mesh from given input data

Parameters
trianglesthe triangle data (required)
verticesthe vertex data (required)
normalsper vertex normals - can be NULL, in this case then the normals are calculated
colorsper vertex color
scales
CTriangleMesh::CTriangleMesh ( PTrianglefield  triangles,
PVertexfield  vertices 
)

creates a new mesh from given input data

Parameters
trianglesthe triangle data (required)
verticesthe vertex data (required)
CTriangleMesh::~CTriangleMesh ( )

Destructor - it releases all the data.

Member Function Documentation

CTriangleMesh* CTriangleMesh::clone ( ) const
Returns
a copy of this mesh
CTriangleMesh CTriangleMesh::clone_connectivity ( ) const
Returns
a mesh where the connectivity is copied, the vertices are allocated, but not set, and without normals and scale values
const color_type& CTriangleMesh::color_at ( unsigned int  i) const
Returns
the color at the given index i
Parameters
i
void CTriangleMesh::evaluate_normals ( )

Force the re-evaluation of the normals of the mesh. The normal at a vertex is evaluared as the area-weighted average of the normals of the triangles, the vertex is part of.

Referenced by colorize_mesh().

int CTriangleMesh::get_available_data ( ) const
Returns
a set of EData flags indicating which data is available

Referenced by colorize_mesh().

const void* CTriangleMesh::get_color_pointer ( ) const
Returns
a raw pointer to the colors
const void* CTriangleMesh::get_normal_pointer ( ) const
Returns
a raw pointer to the normals
const std::string& CTriangleMesh::get_sourceformat ( ) const
inline
Returns
the format the mesh was given in the beginning

Definition at line 257 of file triangularMesh.hh.

const void* CTriangleMesh::get_triangle_pointer ( ) const
Returns
a raw pointer to the triangles
static const std::string CTriangleMesh::get_type_description ( )
static
Returns
a type sescription name usefull for some plugin handling
const void* CTriangleMesh::get_vertex_pointer ( ) const
Returns
a raw pointer to the vertices
const normal_type& CTriangleMesh::normal_at ( unsigned int  i) const
Returns
a const reference to the normal of the i-th vertex
const scale_type& CTriangleMesh::scale_at ( unsigned int  i) const
Returns
a const reference to the scale at the i-th vertex
void CTriangleMesh::set_sourceformat ( const std::string &  fmt)
inline
Parameters
fmtset the save format of the mesh

Definition at line 262 of file triangularMesh.hh.

const triangle_type& CTriangleMesh::triangle_at ( unsigned int  i) const
Returns
a cost reference to the triangle at index i
unsigned int CTriangleMesh::triangle_size ( ) const
Returns
the number of triangles, the mesh consists of
const vertex_type& CTriangleMesh::vertex_at ( unsigned int  i) const
Returns
a const reference to the i-th vertex
unsigned int CTriangleMesh::vertices_size ( ) const
Returns
the number of vertices the mesh consists of

Field Documentation

const char* CTriangleMesh::data_descr
static

The type description provides information about the data type that is used by the plug-in system

Definition at line 66 of file triangularMesh.hh.


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