cgv
cgv::media::mesh::simple_mesh_base Class Referenceabstract

#include <simple_mesh.h>

Inheritance diagram for cgv::media::mesh::simple_mesh_base:
cgv::media::colored_model cgv::media::color_storage_types cgv::media::mesh::simple_mesh< T > cgv::media::mesh::simple_mesh< float >

Public Types

typedef cgv::type::uint32_type idx_type
 define index type
 
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 illum::textured_surface_material mat_type
 define material type
 
typedef color< float, RGB > rgb
 define supported color types
 

Public Member Functions

 simple_mesh_base ()
 default constructor
 
 simple_mesh_base (const simple_mesh_base &smb)
 copy constructor
 
simple_mesh_baseoperator= (const simple_mesh_base &smb)
 assignment operator
 
virtual idx_type get_nr_positions () const =0
 position count
 
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_typeget_material (size_t i) const
 return const reference to i-th material
 
mat_typeref_material (size_t i)
 return reference to i-th material
 
const idx_typematerial_index (idx_type fi) const
 return material index of given face
 
idx_typematerial_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_typegroup_index (idx_type fi) const
 return group index of given face
 
idx_typegroup_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_storagecolor_storage_ptr
 pointer to color storage
 

Detailed Description

coordinate type independent base class of simple mesh data structure that handles indices and colors.

Member Function Documentation

◆ compute_c2e()

uint32_t cgv::media::mesh::simple_mesh_base::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)

given the inv corners compute index vector per corner its edge index and optionally per edge its corner index (implementation assumes closed manifold connectivity)

◆ ensure_colors()

void cgv::media::colored_model::ensure_colors ( ColorType  _color_type,
size_t  nr_colors = -1 
)
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


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