cgv
|
the simple_mesh class is templated over the coordinate type that defaults to float More...
#include <simple_mesh.h>
Public Types | |
typedef simple_mesh< T > | mesh_type |
type of axis aligned 3d box | |
typedef cgv::media::axis_aligned_box< T, 3 > | box_type |
type of axis aligned 3d box | |
typedef cgv::math::fvec< T, 3 > | vec3 |
type of 3d vector | |
typedef cgv::math::fvec< T, 2 > | vec2 |
type of 2d vector | |
typedef cgv::math::fmat< T, 3, 3 > | mat3 |
linear transformation | |
typedef illum::surface_material::color_type | clr_type |
color type used in surface materials | |
typedef illum::textured_surface_material | mat_type |
textured surface materials are supported by mat_type | |
typedef cgv::type::uint32_type | idx_type |
32bit index | |
typedef cgv::math::fvec< idx_type, 2 > | vec2i |
define index pair type | |
typedef cgv::math::fvec< idx_type, 3 > | vec3i |
define index triple type | |
typedef color< float, RGB > | rgb |
define supported color types | |
Public Member Functions | |
simple_mesh (const simple_mesh< T > &sm) | |
construct from string corresponding to Conway notation (defaults to empty mesh) | |
simple_mesh (const std::string &conway_notation="") | |
construct from string corresponding to Conway notation (defaults to empty mesh) More... | |
simple_mesh< T > & | operator= (const simple_mesh< T > &sm) |
construct from string corresponding to Conway notation (defaults to empty mesh) | |
void | clear () |
clear simple mesh | |
idx_type | new_position (const vec3 &p) |
add a new position and return position index | |
idx_type | get_nr_positions () const |
access to positions | |
idx_type | new_normal (const vec3 &n) |
add a new normal and return normal index | |
bool | has_normals () const |
access to normals | |
idx_type | new_tex_coord (const vec2 &tc) |
add a new normal and return normal index | |
bool | has_tex_coords () const |
access to texture coordinates | |
void | compute_face_normals () |
compute per face normals (ensure that per corner normal indices are set correspondingly) | |
void | ambo () |
Conway ambo operator. | |
void | truncate (T lambda=0.33333f) |
Conway truncate operator. | |
void | snub (T lambda=0.33333f) |
Conway snub operator. | |
void | dual () |
Conway dual operator. | |
void | gyro (T lambda=0.3333f) |
Conway gyro operator. | |
void | join () |
Conway join operator. | |
void | ortho () |
Conway ortho operator. | |
void | construct_conway_polyhedron (const std::string &conway_notation) |
construct new mesh according to Conway polyhedron notation: [a|t|s|d|g|j|o]*[T|C|O|D|I] which is evaluated from right to left and last capital letter is Platonic solid and lowercase letters are Conway operations | |
box_type | compute_box () const |
compute the axis aligned bounding box | |
void | compute_vertex_normals () |
compute vertex normals by averaging triangle normals | |
bool | read (const std::string &file_name) |
read simple mesh from file (currently only obj and stl are supported) More... | |
bool | write (const std::string &file_name) const |
write simple mesh to file (currently only obj is supported) | |
unsigned | extract_vertex_attribute_buffer (const std::vector< idx_type > &vertex_indices, const std::vector< vec3i > &unique_triples, bool include_tex_coords, bool include_normals, std::vector< T > &attrib_buffer, bool *include_colors_ptr=0) const |
extract vertex attribute array, return size of color in bytes More... | |
void | transform (const mat3 &linear_transformation, const vec3 &translation) |
apply transformation to mesh | |
void | transform (const mat3 &linear_transform, const vec3 &translation, const mat3 &inverse_linear_transform) |
apply transformation to mesh with given inverse linear transformation | |
idx_type | start_face () |
create a new empty face to which new corners are added and return face index | |
idx_type | new_corner (idx_type position_index, idx_type normal_index=-1, idx_type tex_coord_index=-1) |
create a new corner from position, optional normal and optional tex coordinate indices and return corner index | |
idx_type | c2p (idx_type ci) const |
return position index of corner | |
idx_type | c2n (idx_type ci) const |
return normal index of corner | |
idx_type | c2t (idx_type ci) const |
return texture index of corner | |
idx_type | get_nr_faces () const |
return the number of faces | |
idx_type | get_nr_corners () const |
return the number of corners | |
idx_type | begin_corner (idx_type fi) const |
return index of first corner of face with index fi | |
idx_type | end_corner (idx_type fi) const |
return index of end corner (one after the last one) of face with index fi | |
idx_type | face_degree (idx_type fi) const |
return number of edges/corners of face with index fi | |
size_t | get_nr_materials () const |
return number of materials in mesh | |
idx_type | new_material () |
add a new material and return its index | |
const mat_type & | get_material (size_t i) const |
return const reference to i-th material | |
mat_type & | ref_material (size_t i) |
return reference to i-th material | |
const idx_type & | material_index (idx_type fi) const |
return material index of given face | |
idx_type & | material_index (idx_type fi) |
return reference to material index of given face | |
size_t | get_nr_groups () const |
return number of face groups | |
const std::string & | group_name (size_t i) const |
return the name of the i-th face group | |
std::string & | group_name (size_t i) |
set a new group name | |
idx_type | new_group (const std::string &name) |
add a new group and return its index | |
const idx_type & | group_index (idx_type fi) const |
return group index of given face | |
idx_type & | group_index (idx_type fi) |
return reference to group index of given face | |
void | revert_face_orientation () |
revert face orientation | |
void | sort_faces (std::vector< idx_type > &perm, bool by_group=true, bool by_material=true) const |
sort faces by group and material indices with two bucket sorts | |
void | merge_indices (std::vector< idx_type > &vertex_indices, std::vector< vec3i > &unique_triples, bool *include_tex_coords_ptr=0, bool *include_normals_ptr=0) const |
merge the three indices into one index into a vector of unique index triples | |
void | extract_triangle_element_buffer (const std::vector< idx_type > &vertex_indices, std::vector< idx_type > &triangle_element_buffer, const std::vector< idx_type > *face_perm_ptr=0, std::vector< vec3i > *material_group_start_ptr=0) const |
extract element array buffers for triangulation | |
void | extract_wireframe_element_buffer (const std::vector< idx_type > &vertex_indices, std::vector< idx_type > &edge_element_buffer) const |
extract element array buffers for edges in wireframe | |
void | compute_inv (std::vector< uint32_t > &inv, std::vector< uint32_t > *p2c_ptr=0, std::vector< uint32_t > *next_ptr=0, std::vector< uint32_t > *prev_ptr=0) |
compute a index vector storing the inv corners per corner and optionally index vectors with per position corner index, per corner next and or prev corner index (implementation assumes closed manifold connectivity) | |
uint32_t | compute_c2e (const std::vector< uint32_t > &inv, std::vector< uint32_t > &c2e, std::vector< uint32_t > *e2c_ptr=0) |
given the inv corners compute index vector per corner its edge index and optionally per edge its corner index and return edge count (implementation assumes closed manifold connectivity) More... | |
void | compute_c2f (std::vector< uint32_t > &c2f) |
compute index vector with per corner its face index | |
Protected Attributes | |
abst_color_storage * | color_storage_ptr |
pointer to color storage | |
the simple_mesh class is templated over the coordinate type that defaults to float
cgv::media::mesh::simple_mesh< T >::simple_mesh | ( | const std::string & | conway_notation = "" | ) |
construct from string corresponding to Conway notation (defaults to empty mesh)
construct from string corresponding to conway notation (defaults to empty mesh)
|
inherited |
given the inv corners compute index vector per corner its edge index and optionally per edge its corner index and return edge count (implementation assumes closed manifold connectivity)
given the inv corners compute index vector per corner its edge index and optionally per edge its corner index (implementation assumes closed manifold connectivity)
|
inherited |
ensure that colors are allocated and of given storage type
Only in case of new allocation, the second parameter is used to define the number of colors
unsigned cgv::media::mesh::simple_mesh< T >::extract_vertex_attribute_buffer | ( | const std::vector< idx_type > & | vertex_indices, |
const std::vector< vec3i > & | unique_triples, | ||
bool | include_tex_coords, | ||
bool | include_normals, | ||
std::vector< T > & | attrib_buffer, | ||
bool * | include_colors_ptr = 0 |
||
) | const |
extract vertex attribute array, return size of color in bytes
extract vertex attribute array and element array buffers for triangulation and edges in wireframe
bool cgv::media::mesh::simple_mesh< T >::read | ( | const std::string & | file_name | ) |
read simple mesh from file (currently only obj and stl are supported)
read simple mesh from file