Container class for a generic mesh with normal, color, ... More...
Public Member Functions | |
const std::vector< v3 > & | get_vertices () const |
return internal vertices vector | |
const std::vector< v3 > & | get_normal () const |
return internal normal vector | |
const std::vector< color > & | get_color () const |
return internal color vector | |
const std::vector< int > & | get_connectivity () const |
return internal connectivity vector | |
std::vector< v3 > & | get_vertices () |
return internal vertices vector | |
std::vector< v3 > & | get_normal () |
return internal normal vector | |
std::vector< color > & | get_color () |
return internal color vector | |
std::vector< int > & | get_connectivity () |
return internal connectivity vector | |
void | fill_color (const color &c) |
fill mesh with constant color | |
void | fill_color_xyz () |
fill mesh with color depending of (x,y,z)-coordinates | |
void | fill_color_normal () |
fill mesh with color depending of normal orientation | |
void | compute_normal () |
Compute a per-vertex normal and fill the internal vector. | |
mesh & | operator+= (const v3 &x) |
internal translation | |
mesh & | operator-= (const v3 &x) |
internal translation | |
mesh & | operator*= (const double &s) |
uniform scaling | |
void | scale (const double &sx, const double &sy, const double &sz) |
scale the mesh with anisotropical values | |
void | auto_scale (const double &scale=1.0) |
Set vertices to fit in scalex[-1,1]x[-1,1]. | |
void | load_off (const std::string &filename) |
load a off file | |
Private Attributes | |
std::vector< v3 > | v_vertices |
internal vertices storage | |
std::vector< v3 > | v_normal |
internal normal storage | |
std::vector< color > | v_color |
internal color storage | |
std::vector< int > | v_connectivity |
internal connectivity storage | |
Friends | |
mesh | operator+ (const v3 &x, const mesh &m) |
translation | |
mesh | operator+ (const mesh &m, const v3 &x) |
translation | |
mesh | operator- (const mesh &m, const v3 &x) |
translation | |
mesh | operator* (const double &s, const mesh &m) |
uniform scaling | |
mesh | operator* (const mesh &m, const double &s) |
uniform scaling |
Container class for a generic mesh with normal, color, ...
void cpe::mesh::auto_scale | ( | const double & | scale = 1.0 |
) |
Set vertices to fit in scalex[-1,1]x[-1,1].
z-coordinate is set to start at -1 Auto fit the unit square ((-1,-1,1),(-1,1,1),(1,-1,1),(1,1,1))
References v_vertices, cpe::v3::x(), cpe::v3::y(), and cpe::v3::z().
Referenced by main().
void cpe::mesh::compute_normal | ( | ) |
Compute a per-vertex normal and fill the internal vector.
References cpe::v3::normalized(), v_connectivity, v_normal, and v_vertices.
Referenced by main().
void cpe::mesh::fill_color | ( | const color & | c | ) |
void cpe::mesh::fill_color_normal | ( | ) |
fill mesh with color depending of normal orientation
References v_color, v_normal, v_vertices, cpe::v3::x(), cpe::v3::y(), and cpe::v3::z().
void cpe::mesh::fill_color_xyz | ( | ) |
fill mesh with color depending of (x,y,z)-coordinates
References v_color, v_vertices, cpe::v3::x(), cpe::v3::y(), and cpe::v3::z().
Referenced by main().
const std::vector< color > & cpe::mesh::get_color | ( | ) | const |
std::vector< int > & cpe::mesh::get_connectivity | ( | ) |
return internal connectivity vector
References v_connectivity.
const std::vector< int > & cpe::mesh::get_connectivity | ( | ) | const |
return internal connectivity vector
References v_connectivity.
Referenced by cpe::render_engine::render_mesh().
const std::vector< v3 > & cpe::mesh::get_normal | ( | ) | const |
std::vector< v3 > & cpe::mesh::get_vertices | ( | ) |
return internal vertices vector
References v_vertices.
const std::vector< v3 > & cpe::mesh::get_vertices | ( | ) | const |
return internal vertices vector
References v_vertices.
Referenced by cpe::render_engine::render_mesh().
void cpe::mesh::load_off | ( | const std::string & | filename | ) |
load a off file
References v_color, v_connectivity, v_normal, v_vertices, cpe::v3::x(), cpe::v3::y(), and cpe::v3::z().
Referenced by main().
mesh & cpe::mesh::operator*= | ( | const double & | s | ) |
uniform scaling
References v_vertices.
internal translation
References v_vertices.
internal translation
References v_vertices.
void cpe::mesh::scale | ( | const double & | sx, | |
const double & | sy, | |||
const double & | sz | |||
) |
scale the mesh with anisotropical values
References v_vertices.
std::vector<color> cpe::mesh::v_color [private] |
internal color storage
Referenced by fill_color(), fill_color_normal(), fill_color_xyz(), get_color(), and load_off().
std::vector<int> cpe::mesh::v_connectivity [private] |
internal connectivity storage
Referenced by compute_normal(), get_connectivity(), and load_off().
std::vector<v3> cpe::mesh::v_normal [private] |
internal normal storage
Referenced by compute_normal(), fill_color_normal(), get_normal(), and load_off().
std::vector<v3> cpe::mesh::v_vertices [private] |
internal vertices storage
Referenced by auto_scale(), compute_normal(), fill_color(), fill_color_normal(), fill_color_xyz(), get_vertices(), load_off(), operator*=(), operator+=(), operator-=(), and scale().