imesh_mesh Class Reference

#include <imesh_mesh.h>

Inheritance diagram for imesh_mesh:

imesh_pca_mesh List of all members.

Detailed Description

A simple mesh.

Definition at line 21 of file imesh_mesh.h.


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 availablity.
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.
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_baseverts_
vcl_auto_ptr< imesh_face_array_basefaces_
imesh_half_edge_set half_edges_
vcl_vector< vgl_point_2d<
double > > 
tex_coords_
 vector of texture coordinates.
vcl_vector< bool > valid_tex_faces_
 indicate which faces have texture data.
tex_coord_type tex_coord_status_
 the type of texture coordinates.

Member Enumeration Documentation

enum imesh_mesh::tex_coord_type

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 107 of file imesh_mesh.h.


Constructor & Destructor Documentation

imesh_mesh::imesh_mesh (  )  [inline]

Default Constructor.

Definition at line 25 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 29 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

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

Assignment operator.

Definition at line 24 of file imesh_mesh.cxx.

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

Return the number of vertices.

Definition at line 39 of file imesh_mesh.h.

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

Return the number of faces.

Definition at line 42 of file imesh_mesh.h.

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

Return the number of edges.

Definition at line 45 of file imesh_mesh.h.

void imesh_mesh::merge ( const imesh_mesh other  ) 

Merge the data from another mesh into this one.

Duplicates are not removed

Definition at line 42 of file imesh_mesh.cxx.

bool imesh_mesh::is_init (  )  const [inline]

Return true if the mesh has been initialized.

Definition at line 52 of file imesh_mesh.h.

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

Access the vector of vertices.

Definition at line 55 of file imesh_mesh.h.

imesh_vertex_array_base& imesh_mesh::vertices (  )  [inline]

Definition at line 56 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 60 of file imesh_mesh.h.

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

Definition at line 66 of file imesh_mesh.h.

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

Access the vector of faces.

Definition at line 73 of file imesh_mesh.h.

imesh_face_array_base& imesh_mesh::faces (  )  [inline]

Definition at line 74 of file imesh_mesh.h.

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

Set the vertices.

Definition at line 77 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 80 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 83 of file imesh_mesh.h.

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

Return the half edge set.

Definition at line 86 of file imesh_mesh.h.

void imesh_mesh::build_edge_graph (  ) 

Construct the half edges graph structure.

Definition at line 91 of file imesh_mesh.cxx.

void imesh_mesh::remove_edge_graph (  )  [inline]

Remove the half edge graph structure.

Definition at line 92 of file imesh_mesh.h.

void imesh_mesh::compute_vertex_normals (  ) 

Compute vertex normals.

Definition at line 106 of file imesh_mesh.cxx.

void imesh_mesh::compute_vertex_normals_from_faces (  ) 

Compute vertex normals using face normals.

Definition at line 142 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 181 of file imesh_mesh.cxx.

tex_coord_type imesh_mesh::has_tex_coords (  )  const [inline]

Returns texture coordinate availablity.

Definition at line 112 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 115 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 77 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 121 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 224 of file imesh_mesh.cxx.

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 233 of file imesh_mesh.cxx.

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:
tri into texture space.

Definition at line 206 of file imesh_mesh.cxx.


Member Data Documentation

vcl_auto_ptr<imesh_vertex_array_base> imesh_mesh::verts_ [private]

Definition at line 136 of file imesh_mesh.h.

vcl_auto_ptr<imesh_face_array_base> imesh_mesh::faces_ [private]

Definition at line 137 of file imesh_mesh.h.

imesh_half_edge_set imesh_mesh::half_edges_ [private]

Definition at line 138 of file imesh_mesh.h.

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

vector of texture coordinates.

Definition at line 141 of file imesh_mesh.h.

vcl_vector<bool> imesh_mesh::valid_tex_faces_ [private]

indicate which faces have texture data.

Definition at line 143 of file imesh_mesh.h.

tex_coord_type imesh_mesh::tex_coord_status_ [private]

the type of texture coordinates.

Definition at line 145 of file imesh_mesh.h.


The documentation for this class was generated from the following files:
Generated on Mon Mar 8 05:30:59 2010 for contrib/brl/bbas/imesh by  doxygen 1.5.1