Public Types | Public Member Functions | Private Attributes
imesh_mesh Class Reference

A simple mesh. More...

#include <imesh_mesh.h>

Inheritance diagram for imesh_mesh:
Inheritance graph
[legend]

List of all members.

Public Types

enum  tex_coord_type { TEX_COORD_NONE = 0, TEX_COORD_ON_VERT = 1, TEX_COORD_ON_CORNER = 2 }
 This type indicates how texture coordinates are indexed. More...

Public Member Functions

 imesh_mesh ()
 Default Constructor.
 imesh_mesh (vcl_auto_ptr< imesh_vertex_array_base > verts, vcl_auto_ptr< imesh_face_array_base > faces)
 Constructor from vertex and face arrays.
 imesh_mesh (const imesh_mesh &other)
 Copy Constructor.
imesh_meshoperator= (imesh_mesh const &other)
 Assignment operator.
unsigned int num_verts () const
 Return the number of vertices.
unsigned int num_faces () const
 Return the number of faces.
unsigned int num_edges () const
 Return the number of edges.
void merge (const imesh_mesh &other)
 Merge the data from another mesh into this one.
bool is_init () const
 Return true if the mesh has been initialized.
const imesh_vertex_array_basevertices () const
 Access the vector of vertices.
imesh_vertex_array_basevertices ()
template<unsigned int d>
const imesh_vertex_array< d > & vertices () const
 Access the vector of vertices cast to a dimension.
template<unsigned int d>
imesh_vertex_array< d > & vertices ()
const imesh_face_array_basefaces () const
 Access the vector of faces.
imesh_face_array_basefaces ()
void set_vertices (vcl_auto_ptr< imesh_vertex_array_base > verts)
 Set the vertices.
void set_faces (vcl_auto_ptr< imesh_face_array_base > faces)
 Set the faces.
bool has_half_edges () const
 Returns true if the mesh has computed half edges.
const imesh_half_edge_sethalf_edges () const
 Return the half edge set.
void build_edge_graph ()
 Construct the half edges graph structure.
void remove_edge_graph ()
 Remove the half edge graph structure.
void compute_vertex_normals ()
 Compute vertex normals.
void compute_vertex_normals_from_faces ()
 Compute vertex normals using face normals.
void compute_face_normals (bool norm=true)
 Compute face normals.
tex_coord_type has_tex_coords () const
 Returns texture coordinate availability.
const vcl_vector< vgl_point_2d
< double > > & 
tex_coords () const
 Return the texture coordinates.
void set_tex_coords (const vcl_vector< vgl_point_2d< double > > &tc)
 Set the texture coordinates.
void set_tex_source (const vcl_string ts)
 set the texture sources.
const vcl_string & tex_source () const
const vcl_vector< bool > & valid_tex_faces () const
 Return a vector indicating which faces have texture.
void set_valid_tex_faces (const vcl_vector< bool > &valid)
 Set the vector indicating which faces have texture.
void label_ccw_tex_faces_valid ()
 Label all faces with positive (counter clockwise orientation) area as valid.
vgl_point_2d< double > texture_map (unsigned int tri, double u, double v) const
 Map a barycentric coordinate (u,v) on triangle.

Private Attributes

vcl_auto_ptr
< imesh_vertex_array_base
verts_
vcl_auto_ptr
< imesh_face_array_base
faces_
imesh_half_edge_set half_edges_
vcl_vector< vgl_point_2d
< double > > 
tex_coords_
 vector of texture coordinates.
vcl_string tex_source_
 vector of texture sources.
vcl_vector< bool > valid_tex_faces_
 indicate which faces have texture data.
tex_coord_type tex_coord_status_
 the type of texture coordinates.

Detailed Description

A simple mesh.

Definition at line 26 of file imesh_mesh.h.


Member Enumeration Documentation

This type indicates how texture coordinates are indexed.

ON_VERT is one coordinate per vertex ON_CORNER is one coordinate per half edge (i.e. corner)

Enumerator:
TEX_COORD_NONE 
TEX_COORD_ON_VERT 
TEX_COORD_ON_CORNER 

Definition at line 112 of file imesh_mesh.h.


Constructor & Destructor Documentation

imesh_mesh::imesh_mesh ( ) [inline]

Default Constructor.

Definition at line 30 of file imesh_mesh.h.

imesh_mesh::imesh_mesh ( vcl_auto_ptr< imesh_vertex_array_base verts,
vcl_auto_ptr< imesh_face_array_base faces 
) [inline]

Constructor from vertex and face arrays.

Takes ownership of these arrays

Definition at line 34 of file imesh_mesh.h.

imesh_mesh::imesh_mesh ( const imesh_mesh other)

Copy Constructor.

Definition at line 12 of file imesh_mesh.cxx.


Member Function Documentation

void imesh_mesh::build_edge_graph ( )

Construct the half edges graph structure.

Definition at line 93 of file imesh_mesh.cxx.

void imesh_mesh::compute_face_normals ( bool  norm = true)

Compute face normals.

If norm == false the vector lengths are twice the area of the face

Definition at line 183 of file imesh_mesh.cxx.

void imesh_mesh::compute_vertex_normals ( )

Compute vertex normals.

Definition at line 108 of file imesh_mesh.cxx.

void imesh_mesh::compute_vertex_normals_from_faces ( )

Compute vertex normals using face normals.

Definition at line 144 of file imesh_mesh.cxx.

const imesh_face_array_base& imesh_mesh::faces ( ) const [inline]

Access the vector of faces.

Definition at line 78 of file imesh_mesh.h.

imesh_face_array_base& imesh_mesh::faces ( ) [inline]

Definition at line 79 of file imesh_mesh.h.

const imesh_half_edge_set& imesh_mesh::half_edges ( ) const [inline]

Return the half edge set.

Definition at line 91 of file imesh_mesh.h.

bool imesh_mesh::has_half_edges ( ) const [inline]

Returns true if the mesh has computed half edges.

Definition at line 88 of file imesh_mesh.h.

tex_coord_type imesh_mesh::has_tex_coords ( ) const [inline]

Returns texture coordinate availability.

Definition at line 117 of file imesh_mesh.h.

bool imesh_mesh::is_init ( ) const [inline]

Return true if the mesh has been initialized.

Definition at line 57 of file imesh_mesh.h.

void imesh_mesh::label_ccw_tex_faces_valid ( )

Label all faces with positive (counter clockwise orientation) area as valid.

This requirement refers to the texture map coordinates

Definition at line 235 of file imesh_mesh.cxx.

void imesh_mesh::merge ( const imesh_mesh other)

Merge the data from another mesh into this one.

Duplicates are not removed

Definition at line 44 of file imesh_mesh.cxx.

unsigned int imesh_mesh::num_edges ( ) const [inline]

Return the number of edges.

Definition at line 50 of file imesh_mesh.h.

unsigned int imesh_mesh::num_faces ( ) const [inline]

Return the number of faces.

Definition at line 47 of file imesh_mesh.h.

unsigned int imesh_mesh::num_verts ( ) const [inline]

Return the number of vertices.

Definition at line 44 of file imesh_mesh.h.

imesh_mesh & imesh_mesh::operator= ( imesh_mesh const &  other)

Assignment operator.

Definition at line 26 of file imesh_mesh.cxx.

void imesh_mesh::remove_edge_graph ( ) [inline]

Remove the half edge graph structure.

Definition at line 97 of file imesh_mesh.h.

void imesh_mesh::set_faces ( vcl_auto_ptr< imesh_face_array_base faces) [inline]

Set the faces.

Definition at line 85 of file imesh_mesh.h.

void imesh_mesh::set_tex_coords ( const vcl_vector< vgl_point_2d< double > > &  tc)

Set the texture coordinates.

Definition at line 79 of file imesh_mesh.cxx.

void imesh_mesh::set_tex_source ( const vcl_string  ts) [inline]

set the texture sources.

Definition at line 126 of file imesh_mesh.h.

void imesh_mesh::set_valid_tex_faces ( const vcl_vector< bool > &  valid)

Set the vector indicating which faces have texture.

Definition at line 226 of file imesh_mesh.cxx.

void imesh_mesh::set_vertices ( vcl_auto_ptr< imesh_vertex_array_base verts) [inline]

Set the vertices.

Definition at line 82 of file imesh_mesh.h.

const vcl_vector<vgl_point_2d<double> >& imesh_mesh::tex_coords ( ) const [inline]

Return the texture coordinates.

Definition at line 120 of file imesh_mesh.h.

const vcl_string& imesh_mesh::tex_source ( ) const [inline]

Definition at line 127 of file imesh_mesh.h.

vgl_point_2d< double > imesh_mesh::texture_map ( unsigned int  tri,
double  u,
double  v 
) const

Map a barycentric coordinate (u,v) on triangle.

Parameters:
triinto texture space.

Definition at line 208 of file imesh_mesh.cxx.

const vcl_vector<bool>& imesh_mesh::valid_tex_faces ( ) const [inline]

Return a vector indicating which faces have texture.

Definition at line 130 of file imesh_mesh.h.

const imesh_vertex_array_base& imesh_mesh::vertices ( ) const [inline]

Access the vector of vertices.

Definition at line 60 of file imesh_mesh.h.

imesh_vertex_array_base& imesh_mesh::vertices ( ) [inline]

Definition at line 61 of file imesh_mesh.h.

template<unsigned int d>
const imesh_vertex_array<d>& imesh_mesh::vertices ( ) const [inline]

Access the vector of vertices cast to a dimension.

Definition at line 65 of file imesh_mesh.h.

template<unsigned int d>
imesh_vertex_array<d>& imesh_mesh::vertices ( ) [inline]

Definition at line 71 of file imesh_mesh.h.


Member Data Documentation

vcl_auto_ptr<imesh_face_array_base> imesh_mesh::faces_ [private]

Definition at line 146 of file imesh_mesh.h.

Definition at line 147 of file imesh_mesh.h.

the type of texture coordinates.

Definition at line 158 of file imesh_mesh.h.

vcl_vector<vgl_point_2d<double> > imesh_mesh::tex_coords_ [private]

vector of texture coordinates.

Definition at line 150 of file imesh_mesh.h.

vcl_string imesh_mesh::tex_source_ [private]

vector of texture sources.

Definition at line 153 of file imesh_mesh.h.

vcl_vector<bool> imesh_mesh::valid_tex_faces_ [private]

indicate which faces have texture data.

Definition at line 156 of file imesh_mesh.h.

Definition at line 145 of file imesh_mesh.h.


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