cpe::mesh Class Reference

basic mesh class More...

Collaboration diagram for cpe::mesh:

List of all members.

Public Member Functions

 mesh ()
 empty constructor
 mesh (const std::pair< std::vector< double >, std::vector< unsigned int > > &input)
 constructor from std::pair <vertex,connectivity>
v3 get_vertex (const unsigned int &k_vertex) const
 get vertex k
v3 get_vertex (const unsigned int &k_tri, const unsigned int &k_v) const
 get k_v (k_v in [0,2]) vertex of triangle k_tri
std::vector< unsigned int > get_connectivity (const unsigned int &k_polygon) const
 get connectivity polygon (to do)
void set_vertex (const unsigned int &k_vertex, const v3 &new_vertex)
 set a 3D vertex
void set_connectivity (const unsigned int &k_polygon, const std::vector< unsigned int > &new_triangle)
 set connectivity
void set_texture (const unsigned int &k_vertex, const double &tx, const double &ty)
 set texture for vertex k_vertex
double get_texture_tx (const unsigned int &k_vertex) const
 get texture tx for vertex k_vertex
double get_texture_ty (const unsigned int &k_vertex) const
 get texture ty for vertex k_vertex
void add_vertex (const v3 &x)
 add a vertex in the mesh
void add_vertex (const double &x, const double &y, const double &z)
 add a vertex in the mesh
void add_triangle (const unsigned int &u0, const unsigned int &u1, const unsigned int &u2)
 add indices of a triangle in the mesh
unsigned int vertex_number () const
 number of vertices
unsigned int triangle_number () const
 number of triangles
std::map< int, std::list< int > > ring () const
 build one ring
std::map< int, std::list< int > > star () const
 build one star
std::vector< double > normal_vertex () const
 compute per vertex normal
std::vector< double > normal_polygon () const
 compute per polygon normal
void inverse_triangle_order ()
 swap triangle order (inverse normal direction)
const std::vector< double > & get_vertex () const
 get internal vertex
std::vector< double > & get_vertex ()
 get internal vertex
const std::vector< unsigned int > & get_connectivity () const
 get internal connectivity
std::vector< unsigned int > & get_connectivity ()
 get internal connectivity
const std::vector< double > & get_texture () const
 get the internal vector of texture
std::vector< double > & get_texture ()
 get the internal vector of texture
void assert_vertex (const unsigned int &k_vertex) const
 check vertex index are within the bounds
void assert_connectivity (const unsigned int &k_connectivity) const
 check polygon index are within the bounds
void save_off_file (const std::string &filename) const
 save mesh as off file
void scale_unity ()
 scale and translate the mesh to fit into the unit cube
void scale (const double &value)
 scale the mesh
void apply (const matrix3 &M)
 matrix multiplication
void translate (const v3 &tr)
 translate

Static Public Member Functions

static mesh load_off_file (const std::string &filename)
 load off file

Private Attributes

std::vector< double > vertex
 vertex vector (size=3xN_vertex)
std::vector< unsigned int > connectivity
 connectivity vector (only triangles) (size=3xN_poly)
std::vector< double > texture
 texture vector (size=2xN_vertex)

Detailed Description

basic mesh class


Constructor & Destructor Documentation

cpe::mesh::mesh ( )

empty constructor

cpe::mesh::mesh ( const std::pair< std::vector< double >, std::vector< unsigned int > > &  input)

constructor from std::pair <vertex,connectivity>

References connectivity, and vertex.


Member Function Documentation

void cpe::mesh::add_triangle ( const unsigned int &  u0,
const unsigned int &  u1,
const unsigned int &  u2 
)

add indices of a triangle in the mesh

References connectivity.

void cpe::mesh::add_vertex ( const v3 x)

add a vertex in the mesh

References cpe::v3::x(), cpe::v3::y(), and cpe::v3::z().

Here is the call graph for this function:

void cpe::mesh::add_vertex ( const double &  x,
const double &  y,
const double &  z 
)

add a vertex in the mesh

References vertex.

void cpe::mesh::apply ( const matrix3 M)

matrix multiplication

References vertex, vertex_number(), cpe::v3::x(), cpe::v3::y(), and cpe::v3::z().

Here is the call graph for this function:

void cpe::mesh::assert_connectivity ( const unsigned int &  k_connectivity) const

check polygon index are within the bounds

References connectivity.

Referenced by get_connectivity(), get_vertex(), and set_connectivity().

void cpe::mesh::assert_vertex ( const unsigned int &  k_vertex) const

check vertex index are within the bounds

References vertex.

Referenced by get_vertex(), and set_vertex().

const std::vector< unsigned int > & cpe::mesh::get_connectivity ( ) const

get internal connectivity

References connectivity.

std::vector< unsigned int > cpe::mesh::get_connectivity ( const unsigned int &  k_polygon) const
std::vector< unsigned int > & cpe::mesh::get_connectivity ( )

get internal connectivity

References connectivity.

const std::vector< double > & cpe::mesh::get_texture ( ) const
std::vector< double > & cpe::mesh::get_texture ( )

get the internal vector of texture

References texture.

double cpe::mesh::get_texture_tx ( const unsigned int &  k_vertex) const

get texture tx for vertex k_vertex

References cpe::string_converter::to_string().

Referenced by cpe::mesh_io_off::save_mesh_io_off().

Here is the call graph for this function:

double cpe::mesh::get_texture_ty ( const unsigned int &  k_vertex) const

get texture ty for vertex k_vertex

References cpe::string_converter::to_string().

Referenced by cpe::mesh_io_off::save_mesh_io_off().

Here is the call graph for this function:

v3 cpe::mesh::get_vertex ( const unsigned int &  k_tri,
const unsigned int &  k_v 
) const

get k_v (k_v in [0,2]) vertex of triangle k_tri

References assert_connectivity(), connectivity, get_vertex(), and cpe::string_converter::to_string().

Here is the call graph for this function:

const std::vector< double > & cpe::mesh::get_vertex ( ) const

get internal vertex

References vertex.

Referenced by get_vertex().

std::vector< double > & cpe::mesh::get_vertex ( )

get internal vertex

References vertex.

v3 cpe::mesh::get_vertex ( const unsigned int &  k_vertex) const
void cpe::mesh::inverse_triangle_order ( )

swap triangle order (inverse normal direction)

References connectivity, and triangle_number().

Here is the call graph for this function:

mesh cpe::mesh::load_off_file ( const std::string &  filename) [static]

load off file

References cpe::mesh_io_off::load_mesh_io_off().

Referenced by objet_affichable::objet_affichable().

Here is the call graph for this function:

std::vector< double > cpe::mesh::normal_polygon ( ) const

compute per polygon normal

References connectivity, triangle_number(), and vertex.

Referenced by normal_vertex(), and objet_affichable::objet_affichable().

Here is the call graph for this function:

std::vector< double > cpe::mesh::normal_vertex ( ) const

compute per vertex normal

References normal_polygon(), cpe::v3::normalized(), star(), vertex, and vertex_number().

Here is the call graph for this function:

std::map< int, std::list< int > > cpe::mesh::ring ( ) const

build one ring

References connectivity, and triangle_number().

Here is the call graph for this function:

void cpe::mesh::save_off_file ( const std::string &  filename) const

save mesh as off file

References cpe::mesh_io_off::save_mesh_io_off().

Here is the call graph for this function:

void cpe::mesh::scale ( const double &  value)

scale the mesh

References vertex.

void cpe::mesh::scale_unity ( )

scale and translate the mesh to fit into the unit cube

References vertex, and vertex_number().

Here is the call graph for this function:

void cpe::mesh::set_connectivity ( const unsigned int &  k_polygon,
const std::vector< unsigned int > &  new_triangle 
)

set connectivity

References assert_connectivity(), and vertex.

Here is the call graph for this function:

void cpe::mesh::set_texture ( const unsigned int &  k_vertex,
const double &  tx,
const double &  ty 
)

set texture for vertex k_vertex

References cpe::string_converter::to_string().

Here is the call graph for this function:

void cpe::mesh::set_vertex ( const unsigned int &  k_vertex,
const v3 new_vertex 
)

set a 3D vertex

References assert_vertex(), and vertex.

Here is the call graph for this function:

std::map< int, std::list< int > > cpe::mesh::star ( ) const

build one star

References connectivity, and triangle_number().

Referenced by normal_vertex().

Here is the call graph for this function:

void cpe::mesh::translate ( const v3 tr)

translate

References vertex, vertex_number(), cpe::v3::x(), cpe::v3::y(), and cpe::v3::z().

Here is the call graph for this function:


Member Data Documentation

std::vector<unsigned int> cpe::mesh::connectivity [private]
std::vector<double> cpe::mesh::texture [private]

texture vector (size=2xN_vertex)

Note:
Assume texture connectivity=vertex connectivity

Referenced by get_texture().


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