21#ifndef __TRIANGULARMESH_HH
22#define __TRIANGULARMESH_HH 1
36# ifdef miamesh_EXPORTS
37# define EXPORT_MESH __declspec(dllexport)
39# define EXPORT_MESH __declspec(dllimport)
44# define EXPORT_MESH __attribute__((visibility("default")))
72 typedef std::shared_ptr<CTriangleMesh>
Pointer;
83 typedef std::vector<T3DVector<unsigned int>> CTrianglefield;
84 typedef std::vector<C3DFVector> CVertexfield;
85 typedef std::vector<C3DFVector> CNormalfield;
86 typedef std::vector<C3DFVector> CColorfield;
87 typedef std::vector<float> CScalefield;
89 typedef std::shared_ptr<CTrianglefield > PTrianglefield;
90 typedef std::shared_ptr<CVertexfield > PVertexfield;
91 typedef std::shared_ptr<CNormalfield > PNormalfield;
92 typedef std::shared_ptr<CColorfield > PColorfield;
93 typedef std::shared_ptr<CScalefield > PScalefield;
95 typedef CTrianglefield::value_type triangle_type;
96 typedef CVertexfield::value_type vertex_type;
97 typedef CNormalfield::value_type normal_type;
98 typedef CColorfield::value_type color_type;
99 typedef CScalefield::value_type scale_type;
101 typedef CVertexfield::const_iterator const_vertex_iterator;
102 typedef CVertexfield::iterator vertex_iterator;
104 typedef CTrianglefield::const_iterator const_triangle_iterator;
105 typedef CTrianglefield::iterator triangle_iterator;
107 typedef CNormalfield::const_iterator const_normal_iterator;
108 typedef CNormalfield::iterator normal_iterator;
110 typedef CScalefield::const_iterator const_scale_iterator;
111 typedef CScalefield::iterator scale_iterator;
113 typedef CColorfield::const_iterator const_color_iterator;
114 typedef CColorfield::iterator color_iterator;
141 PVertexfield vertices,
142 PNormalfield normals,
166 static const
std::
string get_type_description();
171 int get_available_data() const;
176 const
void *get_vertex_pointer()const;
181 const
void *get_normal_pointer()const;
187 const
void *get_triangle_pointer()const;
192 const
void *get_color_pointer()const;
198 unsigned int triangle_size()const;
203 unsigned int vertices_size()const;
208 const triangle_type& triangle_at(
unsigned int i)const;
213 const vertex_type& vertex_at(
unsigned int i)const;
218 const normal_type& normal_at(
unsigned int i)const;
223 const scale_type& scale_at(
unsigned int i)const;
229 const color_type& color_at(
unsigned int i)const;
232 const CVertexfield& get_vertices() const;
233 const CTrianglefield& get_triangles() const;
236 const_triangle_iterator triangles_begin() const;
237 triangle_iterator triangles_begin();
238 const_triangle_iterator triangles_end() const;
239 triangle_iterator triangles_end();
241 const_vertex_iterator vertices_begin()const;
242 const_vertex_iterator vertices_end()const;
243 vertex_iterator vertices_begin();
244 vertex_iterator vertices_end();
246 const_normal_iterator normals_begin()const;
247 const_normal_iterator normals_end()const;
248 normal_iterator normals_begin();
249 normal_iterator normals_end();
251 const_scale_iterator scale_begin()const;
252 const_scale_iterator scale_end()const;
253 scale_iterator scale_begin();
254 scale_iterator scale_end();
256 const_color_iterator color_begin()const;
257 const_color_iterator color_end()const;
258 color_iterator color_begin();
259 color_iterator color_end();
263 const
std::
string& get_sourceformat()
const
265 return m_sourceformat;
271 m_sourceformat = fmt;
282 std::string m_sourceformat;
283 struct CTriangleMeshData *data;
300template <
class Deformation>
309 CTriangleMesh::scale_iterator sb = mesh->scale_begin();
310 CTriangleMesh::scale_iterator se = mesh->scale_end();
311 CTriangleMesh::const_vertex_iterator vb = cmesh.vertices_begin();
312 CTriangleMesh::const_normal_iterator nb = cmesh.normals_begin();
315 *sb++ =
dot(*nb++, deform.apply(*vb++));
327template <
class Deformation>
helper class to derive from for data that can be loaded and stored to a disk.
A class to deine a triangle mesh with some attributes.
CTriangleMesh * clone() const __attribute__((warn_unused_result))
EData
these are some flags to indicate, which data is actually available
CTriangleMesh()
Standart constructor creates an empty mesh.
CTriangleMesh(const CTriangleMesh &orig)
CTriangleMesh(int n_triangles, int n_vertices)
int get_available_data() const
std::shared_ptr< CTriangleMesh > Pointer
CTriangleMesh(PTrianglefield triangles, PVertexfield vertices)
void set_sourceformat(const std::string &fmt)
CTriangleMesh(PTrianglefield triangles, PVertexfield vertices, PNormalfield normals, PColorfield colors, PScalefield scales)
static const char * data_descr
the singleton that a plug-in handler really is
The templatex basis class of all IO plug-ins.
The generic base for all plug-ins.
#define NS_MIA_BEGIN
conveniance define to start the mia namespace
#define NS_MIA_END
conveniance define to end the mia namespace
double EXPORT_GSL dot(const gsl_vector *lhs, const gsl_vector *rhs)
THandlerSingleton< TIOPluginHandler< CMeshIOPlugin > > CMeshIOPluginHandler
Plug-in handler for triangulat mesh IO.
PTriangleMesh EXPORT_MESH get_sub_mesh(const CTriangleMesh &mesh, const std::vector< unsigned > &triangle_indices)
#define EXPORT_MESH
define visibility for proper export
void colorize_mesh(CTriangleMesh *mesh, const Deformation &deform)
TIOPlugin< CTriangleMesh > CMeshIOPlugin
IO plugin for triangular meshes.
CTriangleMesh::Pointer PTriangleMesh
Pointer type of the CTriangle mesh class.