DATAKIT SDK  V2026.4
util_mesh_dtk.hpp
Go to the documentation of this file.
1 
2 #ifndef _UTIL_MESH_DTK_HPP_
3 #define _UTIL_MESH_DTK_HPP_
4 
5 #include "util/util_stl_dtk.hpp"
6 #include "util/util_ent_dtk.hpp"
7 #include "util/dtk_picture.hpp"
8 #include <cstdio>
9 #include "def/define.h"
17 #include "util/dtk_val.hpp"
18 #include "util/error_dtk.hpp"
19 #include "util/util_ptr_dtk.hpp"
20 
21 class Dtk_material;
22 class Dtk_mesh;
23 class Dtk_mesh_face;
27 
28 /* Filtres */
29 
30 #define DTK_MESH_XYZ 1
31 #define DTK_MESH_NORMAL 2
32 #define DTK_MESH_RGB 4
33 #define DTK_MESH_UV_TEXTURES 8 // textures
34 #define DTK_MESH_UV_BREP 16
35 #define DTK_MESH_DOUBLEPRECISION 32
36 // combinations
37 #define DTK_MESH_XYZ_NORMAL 3
38 #define DTK_MESH_XYZ_NORMAL_UVTEXTURES 11
39 #define DTK_MESH_XYZ_NORMAL_RGB 7
40 #define DTK_MESH_ALL 31
41 
42 /* Types de triangulation */
43 
45 
47 
48 #define DTK_VALUE_M 1000.0
49 #define DTK_VALUE_CM 10.0
50 #define DTK_VALUE_MM 1.0
51 #define DTK_VALUE_INCH 25.4
52 #define DTK_VALUE_FEET 304.8
53 
54 
55 /// @cond OLD_DTK_API
56 struct Dtk_bounding_box
57 {
58  Dtk_pnt A;
59  Dtk_pnt B;
60  Dtk_pnt M;
61 };
62 
63 typedef Dtk_bounding_box dtk_mesh_face_bb;
64 typedef Dtk_tab<dtk_mesh_face_bb> dtk_mesh_body_face_bb;
65 
66 typedef Dtk_tab<dtk_mesh_body_face_bb> dtk_mesh_per_body_face_bb;
67 typedef Dtk_bounding_box dtk_mesh_body_bb;
68 
69 typedef Dtk_tab<dtk_mesh_body_bb> dtk_mesh_bodies_bb;
70 typedef Dtk_bounding_box dtk_mesh_all_bodies_bb;
71 
72 typedef Dtk_bounding_box dtk_mesh_crv_bb;
73 typedef Dtk_tab<dtk_mesh_crv_bb> dtk_mesh_per_crv_bb;
74 typedef Dtk_bounding_box dtk_mesh_all_crvs_bb;
75 
76 
77 class Dtk_material_value
78 {
79 public:
80  Dtk_string NameProperties;
81  Dtk_tab<Dtk_Val > PropertiesValue;
82 
83  //! \deprecated Use Dtk_material_value::Dtk_material_value(const Dtk_material_value &) instead
84  SetAsDeprecated( "2026.4", "Use Dtk_material_value::Dtk_material_value(const Dtk_material_value &) instead" )
85  void _Copy(const Dtk_material_value & s)
86  {
87  NameProperties = s.NameProperties;
88  for(Dtk_Size_t i=0;i<s.PropertiesValue.size();i++)
89  {
90  PropertiesValue.push_back(Dtk_Val(s.PropertiesValue.at(i)));
91  }
92  }
93 };
94 
95 class Dtk_rendering
96 {
97 public:
98  Dtk_string name;
100 
101  //! \deprecated Use Dtk_rendering::Dtk_rendering(const Dtk_rendering &) instead
102  SetAsDeprecated( "2026.4", "Use Dtk_rendering::Dtk_rendering(const Dtk_rendering &) instead" )
103  void _Copy(const Dtk_rendering * s)
104  {
105  if(s)
106  {
107  name = s->name;
108  value = s->value;
109  }
110  }
111 };
112 
113 class Dtk_drw
114 {
115 public:
116  Dtk_string name;
117  Dtk_picture * picture;
118  Dtk_string picturename;
120 
121  Dtk_drw( ) : picture( nullptr ){}
122  ~Dtk_drw()
123  {
124  delete picture;
125  picture = nullptr;
126  }
127 
128  Dtk_drw( const Dtk_drw& s ) : name( s.name ), picturename( s.picturename ), picture( nullptr ), value( s.value )
129  {
130  if( s.picture )
131  {
132  picture = new Dtk_picture( *s.picture );
133  }
134  }
135  Dtk_drw& operator=( const Dtk_drw& s )
136  {
137  if( this != &s )
138  {
139  name = s.name;
140  picturename = s.picturename;
141  delete picture;
142  picture = nullptr;
143  if( s.picture )
144  {
145  picture = new Dtk_picture( *s.picture );
146  }
147  value = s.value;
148  }
149  return *this;
150  }
151  Dtk_drw( Dtk_drw && s ) DTK_NOEXCEPT : name( std::move( s.name ) ), picturename( std::move( s.picturename ) ), picture( s.picture ), value( std::move( s.value ) )
152  {
153  s.picture = nullptr;
154  }
155  Dtk_drw& operator=( Dtk_drw && s ) DTK_NOEXCEPT
156  {
157  if( this != &s )
158  {
159  name = std::move( s.name );
160  picturename = std::move( s.picturename );
161  delete picture;
162  picture = s.picture;
163  s.picture = nullptr;
164  value = std::move( s.value );
165  }
166  return *this;
167  }
168  //! \deprecated Use Dtk_drw::Dtk_drw(const Dtk_drw &) instead
169  SetAsDeprecated( "2026.4", "Use Dtk_drw::Dtk_drw(const Dtk_drw &) instead" )
170  void _Copy( const Dtk_drw* s )
171  {
172  if( s )
173  {
174  name = s->name;
175  picturename = s->picturename;
176  if( s->picture )
177  {
178  picture = new Dtk_picture( *s->picture );
179  }
180  value = s->value;
181  }
182  }
183 };
184 
185 class Dtk_drafting
186 {
187 public:
188  Dtk_string name;
191 
192  Dtk_drafting() : drw(), value() {}
193  Dtk_drafting( const Dtk_drafting& s ) : name( s.name ), drw(), value( s.value )
194  {
195  for( Dtk_Size_t i = 0; i < s.drw.size(); i++ )
196  {
197  if( s.drw.at( i ) != nullptr )
198  {
199  drw.push_back( new Dtk_drw( *s.drw.at( i ) ) );
200  }
201  }
202  }
203 
204  Dtk_drafting& operator=( const Dtk_drafting& s )
205  {
206  if( this != &s )
207  {
208  name = s.name;
209  value = s.value;
210  for( Dtk_Size_t i = 0; i < drw.size(); i++ )
211  {
212  delete drw.at( i );
213  drw.at( i ) = nullptr;
214  }
215  drw.clear();
216  drw.reserve( s.drw.size() );
217  for( Dtk_Size_t i = 0; i < s.drw.size(); i++ )
218  {
219  if( s.drw.at( i ) == nullptr )
220  {
221  drw.push_back( nullptr );
222  continue;
223  }
224  drw.push_back( new Dtk_drw( *s.drw.at( i ) ) );
225  }
226  }
227  return *this;
228  }
229 
230  Dtk_drafting( Dtk_drafting && s ) DTK_NOEXCEPT : name( std::move( s.name ) ), drw( std::move( s.drw ) ), value( std::move( s.value ) )
231  {
232  s.drw.clear();
233  }
234 
235  Dtk_drafting& operator=( Dtk_drafting && s ) DTK_NOEXCEPT
236  {
237  if( this != &s )
238  {
239  name = std::move( s.name );
240  value = std::move( s.value );
241  for( Dtk_Size_t i = 0; i < drw.size(); i++ )
242  {
243  delete drw.at( i );
244  drw.at( i ) = nullptr;
245  }
246  drw = std::move( s.drw );
247  s.drw.clear();
248  }
249  return *this;
250  }
251 
252  ~Dtk_drafting()
253  {
254  for( Dtk_Size_t i = 0; i < drw.size(); i++ )
255  {
256  delete drw.at( i );
257  drw.at( i ) = nullptr;
258  }
259  }
260 
261  //! \deprecated Use Dtk_drafting::Dtk_drafting(const Dtk_drafting &) instead
262  SetAsDeprecated( "2026.4", "Use Dtk_drafting::Dtk_drafting(const Dtk_drafting &) instead" )
263  void _Copy(const Dtk_drafting * s)
264  {
265  if(s)
266  {
267  name = s->name;
268  for(Dtk_Size_t i=0;i<s->drw.size();i++)
269  {
270  if( s->drw.at(i) != nullptr )
271  {
272  drw.push_back( new Dtk_drw( *s->drw.at( i ) ) );
273  }
274  }
275  value = s->value;
276  }
277  }
278 };
279 
280 class Dtk_analysis
281 {
282 public:
283  Dtk_string name;
285 
286  //! \deprecated Use Dtk_analysis::Dtk_analysis(const Dtk_analysis &) instead
287  SetAsDeprecated( "2026.4", "Use Dtk_analysis::Dtk_analysis(const Dtk_analysis &) instead" )
288  void _Copy(const Dtk_analysis * s)
289  {
290  if(s)
291  {
292  name = s->name;
293  value = s->value;
294  }
295  }
296 };
297 
298 class Dtk_composites
299 {
300 public:
301  Dtk_string name;
303 
304  //! \deprecated Use Dtk_composites::Dtk_composites(const Dtk_composites &) instead
305  SetAsDeprecated( "2026.4", "Use Dtk_composites::Dtk_composites(const Dtk_composites &) instead" )
306  void _Copy(const Dtk_composites * s)
307  {
308  if(s)
309  {
310  name = s->name;
311  value = s->value;
312  }
313  }
314 };
315 
316 class Dtk_positioned
317 {
318 public:
319  Dtk_string name;
321  Dtk_transfo * matrix;
322 
323  Dtk_positioned() : matrix( nullptr ){}
324  ~Dtk_positioned()
325  {
326  delete matrix;
327  matrix = nullptr;
328  }
329  Dtk_positioned( const Dtk_positioned& s ) : name( s.name ), matrix( nullptr ), value( s.value )
330  {
331  if( s.matrix )
332  {
333  matrix = new Dtk_transfo( s.matrix->getXdir(), s.matrix->getYdir(), s.matrix->getZdir(), s.matrix->getOrigin(), s.matrix->getScale() );
334  }
335  }
336  Dtk_positioned& operator=( const Dtk_positioned& s )
337  {
338  if( this != &s )
339  {
340  name = s.name;
341  value = s.value;
342  delete matrix;
343  matrix = nullptr;
344  if( s.matrix )
345  {
346  matrix = new Dtk_transfo( s.matrix->getXdir(), s.matrix->getYdir(), s.matrix->getZdir(), s.matrix->getOrigin(), s.matrix->getScale() );
347  }
348  }
349  return *this;
350  }
351  Dtk_positioned( Dtk_positioned && s ) DTK_NOEXCEPT : name( std::move( s.name ) ), matrix( s.matrix ), value( std::move( s.value ) )
352  {
353  s.matrix = nullptr;
354  }
355  Dtk_positioned& operator=( Dtk_positioned && s ) DTK_NOEXCEPT
356  {
357  if( this != &s )
358  {
359  name = std::move( s.name );
360  value = std::move( s.value );
361  delete matrix;
362  matrix = s.matrix;
363  s.matrix = nullptr;
364  }
365  return *this;
366  }
367 
368  //! \deprecated Use Dtk_positioned::Dtk_positioned(const Dtk_positioned &) instead
369  SetAsDeprecated( "2026.4", "Use Dtk_positioned::Dtk_positioned(const Dtk_positioned &) instead" )
370  void _Copy( const Dtk_positioned* s )
371  {
372  if( s )
373  {
374  name = s->name;
375  value = s->value;
376  if( s->matrix )
377  {
378  matrix = new Dtk_transfo( s->matrix->getXdir(), s->matrix->getYdir(), s->matrix->getZdir(), s->matrix->getOrigin(), s->matrix->getScale() );
379  }
380  }
381  }
382 };
383 
384 //! \brief Gathers material related datas
385 class Dtk_material : public Dtk_Object
386 {
387 protected:
388  enum
389  {
390  _typeID = DTK_TYPE_MATERIAL
391  };
392 private:
393  friend class Dtk_SmartPtr<Dtk_material>;
394 public:
395  //! \brief type of material
396  Dtk_string label;
397 
398  double ambient;
399  double diffuse;
400  double specular;
401  double refraction;
402  double transparency;
403  double reflectivity;
404  double roughness;
405  double _Density;
406 
407  Dtk_Int32 _renderID;
408  Dtk_Int32 _physicalID;
409  //! \brief identifiant dans la library de material
410  Dtk_Int32 _identifier_library;
411  //! \brief Texture clamping setting (u)
412  bool repeat_u;
413  //! \brief Texture clamping setting (v)
414  bool repeat_v;
415  //! \brief picture
416  Dtk_picture * picture;
417  //! \brief Texture filename
418  Dtk_string texture;
419 
420  //! \brief other properties
421  Dtk_rendering * rendering;
422  Dtk_drafting * drafting;
423  Dtk_analysis * analysis;
424  Dtk_composites * composites;
425  Dtk_positioned * positioned;
426 
427  //! \DtkDynamicType
428  Dtk_Int32 DtkDynamicType(const Dtk_Int32 &inId)
429  {
430  if (inId == _typeID)
431  {
432  return 1;
433  }
434  return Dtk_material::DtkDynamicType(inId);
435  }
436  //! \DtkDynamicCast
437  static Dtk_material * DtkDynamicCast(Dtk_Object * s)
438  {
439  if(s->DtkDynamicType(_typeID))
440  return static_cast<Dtk_material * >(s);
441  return NULL;
442  }
443 
444 
445  //! \deprecated Use Dtk_material::Dtk_material(const Dtk_MaterialPtr &) instead
446  SetAsDeprecated( "2026.4", "Use Dtk_material::Dtk_material(const Dtk_MaterialPtr &) instead" )
447  void _Copy(const Dtk_MaterialPtr & s)
448  {
449  if(s.IsNotNULL())
450  {
451  label = s->label;
452  ambient = s->ambient;
453  diffuse = s->diffuse;
454  specular = s->specular;
455  refraction = s->refraction;
456  transparency = s->transparency;
457  reflectivity = s->reflectivity;
458  roughness = s->roughness;
459  _Density = s->_Density;
460  _renderID = s->_renderID;
461  repeat_u = s->repeat_u;
462  repeat_v = s->repeat_v;
463  texture = s->texture;
464  _identifier_library = s->_identifier_library;
465  if(s->picture)
466  {
467  picture = new Dtk_picture(*s->picture);
468  }
469  if(s->rendering)
470  {
471  rendering = new Dtk_rendering(*s->rendering);
472  }
473  if(s->drafting)
474  {
475  drafting = new Dtk_drafting( *s->drafting );
476  }
477  if(s->analysis)
478  {
479  analysis = new Dtk_analysis( *s->analysis );
480  }
481  if(s->composites)
482  {
483  composites = new Dtk_composites( *s->composites );
484  }
485  if(s->positioned)
486  {
487  positioned = new Dtk_positioned( *s->positioned );
488  }
489  }
490  }
491 
492  Dtk_material( const Dtk_material& s ) : label(s.label), texture(s.texture ),roughness( s.roughness ), refraction( s.refraction ), ambient( s.ambient ), transparency( s.transparency ), diffuse( s.diffuse ), specular( s.specular ),
493  reflectivity( s.reflectivity ), repeat_u( s.repeat_u ), repeat_v( s.repeat_v ), _Density( s._Density ), _renderID( s._renderID ), _physicalID( s._physicalID ),
494  _identifier_library( s._identifier_library ), picture( nullptr ), rendering( nullptr ), drafting( nullptr ), analysis( nullptr ), composites( nullptr ), positioned( nullptr )
495  {
496  if( s.picture )
497  {
498  picture = new Dtk_picture(*s.picture);
499  }
500  if( s.rendering )
501  {
502  rendering = new Dtk_rendering(*s.rendering);
503  }
504  if( s.drafting )
505  {
506  drafting = new Dtk_drafting( *s.drafting );
507  }
508  if( s.analysis )
509  {
510  analysis = new Dtk_analysis( *s.analysis );
511  }
512  if( s.composites )
513  {
514  composites = new Dtk_composites( *s.composites );
515  }
516  if( s.positioned )
517  {
518  positioned = new Dtk_positioned( *s.positioned );
519  }
520  }
521  Dtk_material& operator=( const Dtk_material& s )
522  {
523  if( this != &s )
524  {
525  roughness = s.roughness;
526  refraction = s.refraction;
527  ambient = s.ambient;
528  transparency = s.transparency;
529  diffuse = s.diffuse;
530  specular = s.specular;
531  reflectivity = s.reflectivity;
532  repeat_u = s.repeat_u;
533  repeat_v = s.repeat_v;
534  _Density = s._Density;
535  _renderID = s._renderID;
536  _physicalID = s._physicalID;
537  _identifier_library = s._identifier_library;
538  if( picture )
539  {
540  delete picture;
541  picture = nullptr;
542  }
543  picture = s.picture ? new Dtk_picture( *s.picture ) : nullptr;
544  if( rendering )
545  {
546  delete rendering;
547  rendering = nullptr;
548  }
549  rendering = s.rendering ? new Dtk_rendering( *s.rendering ) : nullptr;
550  if( drafting )
551  {
552  delete drafting;
553  drafting = nullptr;
554  }
555  drafting = s.drafting ? new Dtk_drafting( *s.drafting ) : nullptr;
556  if( analysis )
557  {
558  delete analysis;
559  analysis = nullptr;
560  }
561  analysis = s.analysis ? new Dtk_analysis( *s.analysis ) : nullptr;
562  if( composites )
563  {
564  delete composites;
565  composites = nullptr;
566  }
567  composites = s.composites ? new Dtk_composites( *s.composites ) : nullptr;
568  if( positioned )
569  {
570  delete positioned;
571  positioned = nullptr;
572  }
573  positioned = s.positioned ? new Dtk_positioned( *s.positioned ) : nullptr;
574  }
575  return *this;
576  }
577 
578  Dtk_material( Dtk_material&& s ) DTK_NOEXCEPT : roughness( s.roughness ), refraction( s.refraction ), ambient( s.ambient ), transparency( s.transparency ), diffuse( s.diffuse ), specular( s.specular ),
579  reflectivity( s.reflectivity ), repeat_u( s.repeat_u ), repeat_v( s.repeat_v ), _Density( s._Density ), _renderID( s._renderID ), _physicalID( s._physicalID ),
580  _identifier_library( s._identifier_library ), picture( s.picture ), rendering( s.rendering ), drafting( s.drafting ), analysis( s.analysis ), composites( s.composites ), positioned( s.positioned )
581  {
582  s.picture = nullptr;
583  s.rendering = nullptr;
584  s.drafting = nullptr;
585  s.analysis = nullptr;
586  s.composites = nullptr;
587  s.positioned = nullptr;
588  }
589  //Constructor
590  Dtk_material() : roughness( 0.0 ), refraction( 0.0 ), ambient( 0.0 ), diffuse( 0.0 ), specular( 0.0 ), transparency( 0.0 ), reflectivity( 0.0 ),
591  repeat_u( 0 ), repeat_v( 0 ), rendering( nullptr ), drafting( nullptr ), analysis( nullptr ), composites( nullptr ), positioned( nullptr ), picture( nullptr ),
592  _Density( 0.0 ), _renderID( -1 ), _physicalID( -1 ), _identifier_library( 0 )
593  {}
594  Dtk_material& operator=( Dtk_material&& s ) DTK_NOEXCEPT
595  {
596  roughness = s.roughness;
597  refraction = s.refraction;
598  ambient = s.ambient;
599  diffuse = s.diffuse;
600  specular = s.specular;
601  transparency = s.transparency;
602  reflectivity = s.reflectivity;
603  repeat_u = s.repeat_u;
604  repeat_v = s.repeat_v;
605  _Density = s._Density;
606  _renderID = s._renderID;
607  _physicalID = s._physicalID;
608  _identifier_library = s._identifier_library;
609  if( rendering )
610  {
611  delete rendering;
612  rendering = nullptr;
613  }
614  rendering = s.rendering;
615  s.rendering = nullptr;
616  if( drafting )
617  {
618  delete drafting;
619  drafting = nullptr;
620  }
621  drafting = s.drafting;
622  s.drafting = nullptr;
623  if( analysis )
624  {
625  delete analysis;
626  analysis = nullptr;
627  }
628  analysis = s.analysis;
629  s.analysis = nullptr;
630  if( composites )
631  {
632  delete composites;
633  composites = nullptr;
634  }
635  composites = s.composites;
636  s.composites = nullptr;
637  if( positioned )
638  {
639  delete positioned;
640  positioned = nullptr;
641  }
642  positioned = s.positioned;
643  s.positioned = nullptr;
644  if( picture )
645  {
646  delete picture;
647  picture = nullptr;
648  }
649  picture = s.picture;
650  s.picture = nullptr;
651  return *this;
652  }
653 
654  // Destructor
655  ~Dtk_material()
656  {
657  delete picture;
658  picture = NULL;
659  delete drafting;
660  drafting = NULL;
661  delete rendering;
662  rendering = NULL;
663  delete analysis;
664  analysis = NULL;
665  delete composites;
666  composites = NULL;
667  delete positioned;
668  positioned = NULL;
669  }
670 
671  inline Dtk_Double64 GetDensity() const {return _Density;}
672  inline void SetDensity(const Dtk_Double64 inDensity) {_Density = inDensity;}
673  inline Dtk_Int32 GetRenderID() const {return _renderID;}
674  inline void SetRenderID(const Dtk_Int32 inRenderID) {_renderID = inRenderID;}
675  inline Dtk_Int32 GetPhysicalMaterialID() const { return _physicalID; }
676  inline void SetPhysicalMaterialID(const Dtk_Int32 inPhysicalID) { _physicalID = inPhysicalID; }
677 
678 };
679 //! \endcond
680 
681 /* Class mesh */
682 
683 class Dtk_mesh_vertex;
684 class Dtk_facet;
685 class Dtk_mesh_face;
686 
687 
688 
689 //! \class Dtk_mesh
690 //! \brief This is a high level mesh class.
691 //!
692 //! This class gathers all the datas related to a triangulated mesh.
693 class Dtk_mesh:public Dtk_Entity
694 {
695  private:
696  friend class Dtk_SmartPtr<Dtk_mesh>;
697  protected:
698  enum {
700  };
701  int id;
705 #ifdef NOCOMPRESSEDVERTICES
706  Dtk_tab<Dtk_mesh_vertex *> vertices; // hide, and hide subclasses.
707 #else
710  void C_GetVertex(Dtk_Size_t i,Dtk_pnt& out) const;
711  void C_GetNormal(Dtk_Size_t i,Dtk_dir& out) const;
712  void C_GetRGB(Dtk_Size_t i,Dtk_RGB& out) const;
717  void C_SetVertex(Dtk_Size_t i,const Dtk_pnt& out);
718  void C_SetNormal(Dtk_Size_t i,const Dtk_dir& out);
719  void C_SetRGB(Dtk_Size_t i,const Dtk_RGB& out);
723 #endif
726  friend class Dtk_mesh_face;
727  Dtk_bool check_params(const Dtk_pnt * inVertex, const Dtk_dir * inNormal, const Dtk_RGB * inColor, Dtk_Float32 inU, Dtk_Float32 inV);
728  Dtk_bool check_params(const Dtk_tab<Dtk_pnt> * inVertices, const Dtk_tab<Dtk_dir> * inNormals, const Dtk_tab<Dtk_RGB> * inColors, const Dtk_tab<Dtk_Float32> * inU, const Dtk_tab<Dtk_Float32> * inV);
729  void clean_up();
730  inline virtual Dtk_Object* Clone() { return new Dtk_mesh(*this); }
731 public:
732  Dtk_mesh(int inVertex_format = DTK_MESH_XYZ, Dtk_bool inBack_face_culling = true);
733  Dtk_mesh(const Dtk_mesh &inMesh);
735  Dtk_mesh& operator=(const Dtk_mesh &inMesh);
738 
739  public:
740  //! \DtkDynamicType
742 
743  //! \DtkDynamicCast
745 
746  //! \brief Constructor
747  //! \param inVertex_format : the chosen vertex format you will work with
748  //! \param inBack_face_culling : culling mode
749  //!
750  //! \b Vertex \b formats \b available: \n
751  //!
752  //! - \b DTK_MESH_XYZ : each point has xyz coords\n
753  //! - \b DTK_MESH_NORMAL : each point has a normal\n
754  //! - \b DTK_MESH_RGB : each point has a color\n
755  //! - \b DTK_MESH_UVTEXTURES : each point has UV texture coords\n
756  //! - \b DTK_MESH_UVBBREP : each point has UVbrep match coords\n
757  //! - \b DTK_MESH_DOUBLEPRECISION : each point has xyz coords as double\n
758  //!\n
759  //!\b For \b example : DTK_MESH_XYZ | DTK_MESH_NORMAL | DTK_MESH_UVTEXTURES : to have coords,normals, and uv textures
760  //!\n
761  //void dump_vertices();
762  static Dtk_MeshPtr Create(int inVertex_format = DTK_MESH_XYZ, Dtk_bool inBack_face_culling = true);
763 
764  //! \CreateCopy{in}
765  static Dtk_MeshPtr Create(const Dtk_mesh & in);
766 
767  //! \brief Checks The current vertex format of the Dtk_mesh object
768  //! \param inFormat : vertex format to test with
769  //! \return true if the format includes inFormat parameters, else false
770  Dtk_bool check_format(int inFormat);
771 
772  //! \brief Compute round normals from geometry
773  //! \warning Can alter vertex_format
774  //! \return return 0 if ok
776 
777  //! \brief Compute the mesh Bounding Box
778  //! \param[out] min, max : computed extrem points of the boundig box
779  //! \return return 0 if ok
780  int compute_bb(Dtk_pnt * min, Dtk_pnt * max);
781 
782  //! \brief Compute the mesh Bounding Box
783  //! \param[out] min, max : computed extrem points of the boundig box
784  //! \return return 0 if ok
786 
787  //! \brief Decompose all complex geometry (triangle strips, fan, polygons) into triangles, and append it into the internal triangle array
788  //! \brief Note that mockup decomposition is not yet supported.
789  //! \return return 0 if ok
790  int explode();
791 
792  //! \brief Decompose complex geometry (triangle strips, fan, polygons) according to specified parameters into triangles, and append it into the internal triangle array
793  //! \brief Note that mockup decomposition is not yet supported.
794  //! \return return 0 if ok
795  int explode(Dtk_bool ExplodeTristrips, Dtk_bool ExplodeTrifans, Dtk_bool ExplodePolygons, Dtk_bool ExplodeMockups);
796 
797  //! \brief Assemble all simple triangle, try to make triange-strips
798  //! \return return 0 if ok
799  int makestrips();
800 
801  //! \brief Change Vertex format, check constructor comment to see options
802  //! \param[in] inVertex_format : the chosen vertex format you will work with
803  //! \return return 0 if ok
804  int change_vertex_format(int inVertex_format);
805 
806  //! \brief Apply a transformation matrix to the Mesh
807  //! \param[in] inMatrix : Matrix to apply
808  //! \return return 0 if ok
809  int transform(Dtk_transfo * inMatrix);
810 
811  //! \brief Make a copy of the current mesh, applying a transformation on it.
812  //! \param[in] inMatrix : Matrix to apply
813  //! \return The copy mesh, NULL if error.
815 
816  //! \brief Return the true of false if culled or not
817  //! \return True or false.
819  int to_stl(Dtk_string inFilename,Dtk_bool inIsAciiMode=DTK_FALSE);
820 
821  //! \brief Return true if the current vertex format includes 3D coords (XYZ)
823  //! \brief Return true if the current vertex format includes normal
825  //! \brief Return true if the current vertex format includes color (RGB)
827  //! \brief Return true if the current vertex format includes texture coords (UVTEXTURES)
829 
830  //! \brief Add a vertex to the mesh vertices list
831  //! \param inVertex : vertex to add
832  //! \param inNormal : normal to add (if vertex format includes normal)
833  //! \param inColor : color to add (if vertex format includes color)
834  //! \param inU, inV : texture coords (if vertex format includes tex coords)
835  //! \return return 0 if ok, 1 if error, 2 if wrong vertex format
836  int add_vertex(const Dtk_pnt * inVertex,const Dtk_dir * inNormal = NULL,const Dtk_RGB * inColor = NULL, Dtk_Float32 inU = 0., Dtk_Float32 inV = 0., Dtk_Float32 inUBrep = 0., Dtk_Float32 inVBrep = 0.);
837 
839  //! \brief Add a face (Dtk_mesh_face) to the mesh
840  //! \param in_mesh_face : face to add
841  //! \return return 0 if ok, 1 if error
842  int add_mesh_face(Dtk_mesh_face * inMesh_face);
843 
844  //! \brief Set a vertex
845  //! \param inPos : indice in the vertices array
846  //! \param inVertex : vertex to set
847  //! \param inNormal : normal to set (if vertex format includes normal)
848  //! \param inColor : color to set (if vertex format includes color)
849  //! \param inU, inV : texture coords (if vertex format includes tex coord)
850  //! \return return 0 if ok, 1 if error, 2 if wrong vertex format
851  int set_vertex(Dtk_Size_t inPos, const Dtk_pnt * inVertex, const Dtk_dir * inNormal = NULL, const Dtk_RGB * inColor = NULL, Dtk_Float32 inU = 0., Dtk_Float32 inV = 0., Dtk_Float32 inUBrep = 0., Dtk_Float32 inVBrep = 0.);
852 
853  //! \brief Set a normal to a point (if vertex format includes normal)
854  //! \param inPos : indice in the vertices array
855  //! \param inNormal : normal to set
856  //! \return return 0 if ok, 1 if error, 2 if wrong vertex format
857  int set_normal(Dtk_Size_t inPos, const Dtk_dir * inNormal);
858 
859  //! \brief Set a color to a point (if vertex format includes color)
860  //! \param inPos : indice in the vertices array
861  //! \param inColor : color to set
862  //! \return return 0 if ok, 1 if error, 2 if wrong vertex format
863  int set_color(Dtk_Size_t inPos, const Dtk_RGB * inColor);
864 
865  //! \brief Set texture coords to a point (if vertex format includes tex coords)
866  //! \param inPos : indice in the vertices array
867  //! \param inU, inV : U,V to set
868  //! \return return 0 if ok, 1 if error, 2 if wrong vertex format
870 
871  //! \brief Return texture coords (if vertex format includes tex coords)
872  //! \param inPos : indice in the vertices array
873  //! \param[out] outU, outV : UVtextures returned
874  //! \return return 0 if ok, 1 if error, 2 if wrong vertex format
875  int get_texcoords(Dtk_Size_t inPos, Dtk_Float32 * outU, Dtk_Float32 * outV);
876 
877  //! \brief Return the vertices array size
879 
880  //! \brief Return a vertex
881  //! \param inPos : indice in the vertices array
882  //! \param[out] outVertex : vertex returned
883  //! \return return 0 if ok, 1 if error, 2 if wrong vertex format
884  int get_vertex(Dtk_Size_t inPos, Dtk_pnt * outVertex);
885 
886  //! \brief Return a vertex (2nd form of get_vertex)
887  //! \param inPos : indice in the vertices array
888  //! \return The vertex
890 
891  //! \brief Return a normal (if vertex format includes normal)
892  //! \brief Note, if vertex format does not support normal, the fonction will return a null vector
893  //! \param inPos : indice in the vertices array
894  //! \param[out]: outNormal : vertex returned
895  //! \param[in]: inMeshFace : current mesh face
896  //! \return return 0 if ok, 1 if error, 2 if wrong vertex format
897  int get_normal(Dtk_Size_t inPos, Dtk_dir * outNormal,Dtk_mesh_face * inMeshFace = NULL);
898 
899  //! \brief Return a vertex (2nd form of get_normal)
900  //! \brief Note, if vertex format does not support normal, the fonction will return a null vector
901  //! \param inPos : indice in the vertices array
902  //! \return The normal
904 
905 
908 
911 
912  //! \brief Return a color (if vertex format includes color)
913  //! \param inPos : indice in the vertices array
914  //! \param[out] outColor : color returned
915  //! \return return 0 if ok, 1 if error, 2 if wrong vertex format
916  int get_color(Dtk_Size_t inPos, Dtk_RGB * outColor);
917 
918  //! \brief Return the faces array size
920 
921  //! \brief Return a face
922  //! \param inPos : indice in the faces array
924 
925  //! \brief Return the array of mesh faces
928 
929  //! \brief Return total number of facets
931 
932  //! \brief Set an id to the mesh
933  //! \param inId : id to set
934  void set_id(int inId);
935 
936  //! \brief Return the mesh id
937  int get_id();
938 
939  //! \brief set color in Dtk_mesh
940  void set_mesh_color(const Dtk_RGB & inColor);
941 
942  //! \brief get color in Dtk_mesh
944 
945  //! \brief Return DtkInfosPtr of this Dtk_Mesh may be NULL
947 
948  //! \brief Set DtkInfosPtr of this Dtk_Mesh
949  void set_Infos(const Dtk_InfoPtr& inDtkInfosPtr);
950 
951  //! \brief Set the material of the mesh
953 
954  //! \brief Get the material of the mesh
956 
957  //! \brief Perform a scale of the model
958  //! \brief Note : calling this function has the same effect than calling "transform" method with a scale matrix.
959  int rescale_model(float ratio);
960 
961  //! \brief Reduce memory cost of the Dtk_mesh, to call after adding all geometry
962  //! \brief The Dtk_mesh class hold internal containers that keep more memory not to reallocate each data enqueuing (like reserve of a std::vector)
963  //! \brief This function remove all reserves to free some useless memory
964  void reduce();
965 
966  //! \brief Merge another Dtk_mesh.
967  //! \param inMesh : mesh to merge.
968  void merge(const Dtk_mesh* inMesh);
969  void merge(const Dtk_SmartPtr<Dtk_mesh>& inMesh);
970 
971  void mergemove( Dtk_tab<Dtk_MeshPtr>& inArraymesh );
973  void mergemove( Dtk_mesh* inmesh );
975 
976 
977  //! \brief Merge subfaces that have the same properties
979 
980  //! \brief Get a reference to the mesh face array // DEPRECATED, UNSAFE.
982 
983  enum type_detk get_type_detk() const;
985 
987 
988  //! \brief Apply texture mapping to the mesh. It will modify points texture UV coordinates.
990 
991 
992  Dtk_ErrorStatus Store(FILE* inFile, Dtk_Size_t inIo = 1);
993  Dtk_ErrorStatus Store(const Dtk_string& inFile, Dtk_Size_t inIo = 1);
994  void SetStream(Dtk_StreamPtr inStream);
996 };
997 
998 /* Class mesh_vertex : vertex data */
999 
1000 //! \class Dtk_mesh_vertex
1001 //! \brief For internal use.
1002 //!
1003 //! This class gathers all the datas related to a vertex.
1005 {
1006 protected:
1008 public:
1010  Dtk_mesh_vertex(const Dtk_pnt * inVertex);
1011  virtual ~Dtk_mesh_vertex();
1012  virtual Dtk_pnt GetVertex() const;
1013  virtual Dtk_dir GetNormal() const;
1014  virtual Dtk_RGB GetRGB() const;
1015  virtual Dtk_Float32 GetU() const;
1016  virtual Dtk_Float32 GetV() const;
1017  virtual Dtk_Int32 SetVertex(const Dtk_pnt&);
1018  virtual Dtk_Int32 SetNormal(const Dtk_dir&);
1019  virtual Dtk_Int32 SetRGB(const Dtk_RGB&);
1023  virtual Dtk_Size_t GetSize() const ;
1024 };
1025 
1027 {
1028 protected:
1030 public:
1032  Dtk_mesh_vertex_norm(const Dtk_pnt * inVertex,const Dtk_dir * inNorm);
1037 };
1038 
1040 {
1041 protected:
1043 public:
1045  Dtk_mesh_vertex_norm_color(const Dtk_pnt * inVertex,const Dtk_dir * inNorm,const Dtk_RGB* inRGB);
1046  Dtk_RGB GetRGB() const;
1049 };
1050 
1052 {
1053 protected:
1055 public:
1057  Dtk_mesh_vertex_norm_color_uv(const Dtk_pnt * inVertex,const Dtk_dir * inNorm,const Dtk_RGB* inRGB,Dtk_Float32 inU,Dtk_Float32 inV);
1063 };
1064 
1065 
1066 /* --------------------------------------------- */
1067 
1069 class Dtk_mesh_circle_data;
1070 
1071 //! \class Dtk_mesh_face
1072 //! \brief This is a high level face class.
1073 //!
1074 //! This class gathers all the datas related to a triangulated mesh face.
1076 {
1077 private:
1078  friend class Dtk_SmartPtr<Dtk_mesh_face>;
1079 protected:
1080  enum {
1082  };
1084 // all types
1093 // additionnal
1097  friend class Dtk_mesh;
1098 private:
1099  int explode_tristrips(Dtk_tab<Dtk_UInt32>* ret);
1100  int explode_trifans(Dtk_tab<Dtk_UInt32>* ret);
1101  int explode_polygons(Dtk_tab<Dtk_UInt32>* ret);
1102  int explode_mockups(Dtk_tab<Dtk_UInt32>* ret);
1103  int add_shapevertices(const Dtk_tab<Dtk_pnt> * inVertices,const Dtk_tab<Dtk_dir> * inNormals,const Dtk_tab<Dtk_RGB> * inColors,const Dtk_tab<Dtk_Float32> * inU, const Dtk_tab<Dtk_Float32> * inV);
1104 
1105  int _finddoublonstriangles();
1106 public:
1107  //! \brief Constructor
1108  //! \param inMesh : the mesh which will contain the face
1110 
1111  //! \brief Copy Constructor
1112  //! \brief Do not use param shift.
1113  Dtk_mesh_face(const Dtk_mesh_face& inMeshface,Dtk_mesh* inMesh,Dtk_UInt32 shift=0);
1114 
1115  //! \brief Destructor
1117 
1118 public:
1119  //! \DtkDynamicType
1121 
1122  //! \DtkDynamicCast
1124 
1125  //! \CreateCopy{in}
1127 
1128  //! \brief Compute round normals from geometry
1129  //! \warning Can alter vertex_format
1130  //! \return return 0 if ok, 1 if error
1132 
1133  //! \brief Compute the mesh Bounding Box
1134  //! \param[out] min, max : computed extrem points of the boundig box
1135  //! \return return 0 if ok
1136  int compute_bb(Dtk_pnt * min, Dtk_pnt * max);
1137 
1138  //! \brief Compute the mesh Bounding Box
1139  //! \param[out] in : computed center point of the boundig box
1140  //! \return return 0 if ok
1142 
1143  //! \brief Decompose all complex geometry (triangle strips, fan, polygons) into triangles, and append it into the internal triangle array
1144  //! \brief Note that mockup decomposition is not yet supported.
1145  //! \return return 0 if ok
1146  int explode();
1147 
1148  //! \brief Decompose complex geometry (triangle strips, fan, polygons) according to specified parameters into triangles, and append it into the internal triangle array
1149  //! \brief Note that mockup decomposition is not yet supported.
1150  //! \return return 0 if ok
1151  int explode(Dtk_bool ExplodeTristrips, Dtk_bool ExplodeTrifans, Dtk_bool ExplodePolygons, Dtk_bool ExplodeMockups);
1152 
1153  int makestrips();
1154 
1155  //! \brief Compute all facets (triangles) holded by the class, including trianglestrips, fans, polygons
1156  //! \return Number of facets
1158 
1159  //! \brief Compute the total number of vertices used in the face
1160  //! \param[in] inOnce (default = true) : Imagine a case we have 2 adjascent triangles, with 2 common vertices. If inOnce = true, return 4, if false, return 6.
1161  //! \return return an array of indices.
1163 
1165 
1166 
1167 // triangles
1168 
1169  //! \brief Add one of multiple triangles
1170  //! \brief On this form, indices MUST match an existing vertex inside Dtk_Mesh class
1171  //! \param[in] inIndices : Array of indices. Must be a multiple of 3. This will add arraysize/3 triangles
1172  //! \return return 0 if ok, other value if fails.
1173  int add_triangles(Dtk_tab<Dtk_UInt32> * inIndices);
1174  int add_triangles(const Dtk_UInt32* inIndices,Dtk_Size_t nb);
1175 
1176  //! \brief Add one of multiple triangles and the corresponding vertices
1177  //! \param[in] inIndices : Array of indices. Must be a multiple of 3. This will add arraysize/3 triangles.
1178  //! \param[in] inVertices : Array of vertices. They will be added into the mesh. inIndices values are indices of this table
1179  //! \param[in] inNormals : Array of normals (or NULL is not specified). If specified, size must be the same than inVertices.
1180  //! \param[in] inColors : Array of RGBcolors (or NULL is not specified). If specified, size must be the same than inVertices.
1181  //! \param[in] inU : Array of u params (or NULL is not specified). If specified, size must be the same than inVertices.
1182  //! \param[in] inV : Array of v params (or NULL is not specified). If specified, size must be the same than inVertices.
1183  //! \return return 0 if ok, other value if fails.
1184  int add_triangles(const Dtk_tab<Dtk_UInt32> * inIndices,const Dtk_tab<Dtk_pnt> * inVertices,const Dtk_tab<Dtk_dir> * inNormals = NULL,const Dtk_tab<Dtk_RGB> * inColors = NULL,const Dtk_tab<Dtk_Float32> * inU = NULL,const Dtk_tab<Dtk_Float32> * inV = NULL);
1185 
1186  //! \brief Get the number of simple triangles kept in the class instance
1187  //! \return return Number of triangles
1189 
1190  //! \brief Get pointer of triangle indices of i-th triangle.
1191  //! \param[in] inI : triangle to get (use get_nbtriangles to see how many triangles there is)
1192  //! \brief Use the result as an array (check example below)
1193  //! \b Sample:
1194  //! \code
1195  //! const Dtk_UInt32* t = get_triangle_indices(5); // get the 5th triangle indices
1196  //! printf("indices are : %d %d %d\n",t[0],t[1],t[2]);
1197  //! \endcode
1198  //! \return return Number of triangles
1200 
1201  //! \brief Get the V-th vertex of the inI-th triangle.
1202  //! \param[in] inI : triangle to get (use get_nbtriangles to see how many triangles there is)
1203  //! \param[in] inV : Vertex to get (0, 1 or 2)
1204  //! \return The vertex.
1206 
1207  //! \brief Get the center normal of the inI-th triangle.
1208  //! \param[in] inI : triangle to get (use get_nbtriangles to see how many triangles there is)
1209  //! \return the normal of the triangle .
1211 
1212  //! \brief Reverse the i-th triangle of the set of triangle, so that the normal will be inversed.
1213  //! \param[in] inI : triangle to reverse (use get_nbtriangles to see how many triangles there is)
1215 
1216 // trianglestrip
1217  //! \brief Add one triangle strip
1218  //! \brief On this form, indices MUST match an existing vertex inside Dtk_Mesh class
1219  //! \param[in] inIndices : Array of indices. Must be a at least 3.
1220  //! \return return 0 if ok, other value if fails.
1221  int add_triangle_strip(const Dtk_tab<Dtk_UInt32> * inIndices);
1222 
1224 
1225  //! \brief Add one triangle strip and the corresponding vertices
1226  //! \param[in] inIndices : Array of indices. Must be at least 3.
1227  //! \param[in] inVertices : Array of vertices. They will be added into the mesh. inIndices values are indices of this table
1228  //! \param[in] inNormals : Array of normals (or NULL is not specified). If specified, size must be the same than inVertices.
1229  //! \param[in] inColors : Array of RGBcolors (or NULL is not specified). If specified, size must be the same than inVertices.
1230  //! \param[in] inU : Array of u params (or NULL is not specified). If specified, size must be the same than inVertices.
1231  //! \param[in] inV : Array of v params (or NULL is not specified). If specified, size must be the same than inVertices.
1232  //! \return return 0 if ok, other value if fails.
1233  int add_triangle_strip(const Dtk_tab<Dtk_UInt32> * inIndices,const Dtk_tab<Dtk_pnt> * inVertices,const Dtk_tab<Dtk_dir> * inNormals = NULL,const Dtk_tab<Dtk_RGB> * inColors = NULL,const Dtk_tab<Dtk_Float32> * inU = NULL,const Dtk_tab<Dtk_Float32> * inV = NULL);
1234 
1235  //! \brief Get the number of triangle strips kept in the class instance
1236  //! \return return Number of triangle strips
1238 
1239  //! \brief Get inI-th triangle strip
1240  //! \param[in] inI : indice of the triangle strip to get.
1241  //! \return return an array of indices.
1243 
1244 // trianglefan
1245  //! \brief Add one triangle fan
1246  //! \brief On this form, indices MUST match an existing vertex inside Dtk_Mesh class
1247  //! \param[in] inIndices : Array of indices. Must be a at least 3.
1248  //! \return return 0 if ok, other value if fails.
1249  int add_triangle_fan(const Dtk_tab<Dtk_UInt32> * inIndices);
1250 
1251  //! \brief Add one triangle fan and the corresponding vertices
1252  //! \param[in] inIndices : Array of indices. Must be at least 3.
1253  //! \param[in] inVertices : Array of vertices. They will be added into the mesh. inIndices values are indices of this table
1254  //! \param[in] inNormals : Array of normals (or NULL is not specified). If specified, size must be the same than inVertices.
1255  //! \param[in] inColors : Array of RGBcolors (or NULL is not specified). If specified, size must be the same than inVertices.
1256  //! \param[in] inU : Array of u params (or NULL is not specified). If specified, size must be the same than inVertices.
1257  //! \param[in] inV : Array of v params (or NULL is not specified). If specified, size must be the same than inVertices.
1258  //! \return return 0 if ok, other value if fails.
1259  int add_triangle_fan(const Dtk_tab<Dtk_UInt32> * inIndices,const Dtk_tab<Dtk_pnt> * inVertices,const Dtk_tab<Dtk_dir> * inNormals = NULL,const Dtk_tab<Dtk_RGB> * inColors = NULL,const Dtk_tab<Dtk_Float32> * inU = NULL,const Dtk_tab<Dtk_Float32> * inV = NULL);
1260 
1261  //! \brief Get the number of triangle fans kept in the class instance
1262  //! \param[in] inI : indice of the triangle fan to get.
1263  //! \return return Number of triangle fans
1265 
1266  //! \brief Get inI-th triangle fan
1267  //! \return return an array of indices.
1269 
1270 // polygons
1271  //! \brief Add one polygon
1272  //! \brief poygon MUST be convex
1273  //! \brief On this form, indices MUST match an existing vertex inside Dtk_Mesh class
1274  //! \param[in] inIndices : Array of indices. Must be a at least 3.
1275  //! \return return 0 if ok, other value if fails.
1276  int add_polygon(const Dtk_tab<Dtk_UInt32> * inIndices);
1277 
1278  //! \brief Add one polygon and the corresponding vertices
1279  //! \brief poygon MUST be convex
1280  //! \param[in] inIndices : Array of indices. Must be at least 3.
1281  //! \param[in] inVertices : Array of vertices. They will be added into the mesh. inIndices values are indices of this table
1282  //! \param[in] inNormals : Array of normals (or NULL is not specified). If specified, size must be the same than inVertices.
1283  //! \param[in] inColors : Array of RGBcolors (or NULL is not specified). If specified, size must be the same than inVertices.
1284  //! \param[in] inU : Array of u params (or NULL is not specified). If specified, size must be the same than inVertices.
1285  //! \param[in] inV : Array of v params (or NULL is not specified). If specified, size must be the same than inVertices.
1286  //! \return return 0 if ok, other value if fails.
1287  int add_polygon(const Dtk_tab<Dtk_UInt32> * inIndices,const Dtk_tab<Dtk_pnt> * inVertices,const Dtk_tab<Dtk_dir> * inNormals = NULL,const Dtk_tab<Dtk_RGB> * inColors = NULL,const Dtk_tab<Dtk_Float32> * inU = NULL,const Dtk_tab<Dtk_Float32> * inV = NULL);
1288 
1289  //! \brief Get the number of polygons kept in the class instance
1290  //! \return return Number of polygons
1292 
1293  //! \brief Get inI-th polygon
1294  //! \param[in] inI : indice of the polygon to get.
1295  //! \return return an array of indices.
1297 
1298 
1300 
1301 // mockups
1302  //! \brief Add one mockup
1303  //! \brief On this form, indices MUST match an existing vertex inside Dtk_Mesh class
1304  //! \param[in] inIndices : Array of Array of indices (ie : Array of polygons). The first polygon is the outer limit of the mockups, the others are inner loops
1305  //! \brief Note : Polygons MUST be convex
1306  //! \brief Note : Face is ALWAYS on the left of polygon. It means that for outer polygon, the sens is counterclockwise, for the other, sense is clockwise
1307  //! \return return 0 if ok, other value if fails.
1308  int add_mockup(const Dtk_tab<Dtk_tab<Dtk_UInt32> > * inIndices);
1309 
1310  //! \brief Add one polygon and the corresponding vertices
1311  //! \brief poygon MUST be convex
1312  //! \param[in] inIndices : Array of Array of indices (ie : Array of polygons). The first polygon is the outer limit of the mockups, the others are inner loops
1313  //! \brief Note : Polygons MUST be convex
1314  //! \brief Note : Face is ALWAYS on the left of polygon. It means that for outer polygon, the sens is counterclockwise, for the other, sense is clockwise
1315  //! \param[in] inVertices : Array of vertices. They will be added into the mesh. inIndices values are indices of this table
1316  //! \param[in] inNormals : Array of normals (or NULL is not specified). If specified, size must be the same than inVertices.
1317  //! \param[in] inColors : Array of RGBcolors (or NULL is not specified). If specified, size must be the same than inVertices.
1318  //! \param[in] inU : Array of u params (or NULL is not specified). If specified, size must be the same than inVertices.
1319  //! \param[in] inV : Array of v params (or NULL is not specified). If specified, size must be the same than inVertices.
1320  //! \return return 0 if ok, other value if fails.
1321  int add_mockup(const Dtk_tab<Dtk_tab<Dtk_UInt32> > * inIndices, const Dtk_tab<Dtk_pnt> * inVertices, const Dtk_tab<Dtk_dir> * inNormals = NULL, const Dtk_tab<Dtk_RGB> * inColors = NULL, const Dtk_tab<Dtk_Float32> * inU = NULL, const Dtk_tab<Dtk_Float32> * inV = NULL);
1322 
1323  int add_mockups(const Dtk_tab<Dtk_tab<Dtk_tab<Dtk_UInt32> > >* inIndices, const Dtk_tab<Dtk_pnt> * inVertices, const Dtk_tab<Dtk_dir> * inNormals = NULL, const Dtk_tab<Dtk_RGB> * inColors = NULL, const Dtk_tab<Dtk_Float32> * inU =NULL , const Dtk_tab<Dtk_Float32> * inV = NULL);
1324 
1325  //! \brief Get the number of mockups kept in the class instance
1326  //! \return return Number of mockups
1328 
1329  //! \brief Get inI-th mockup
1330  //! \return return an array of indices.
1332 
1334 
1335 // polylines
1336 
1337  //! \brief Add one polyline
1338  //! \brief On this form, indices MUST match an existing vertex inside Dtk_Mesh class
1339  //! \param[in] inIndices : Array of indices. Must be a at least 3.
1340  //! \return return 0 if ok, other value if fails.
1341  int add_polyline(const Dtk_tab<Dtk_UInt32> * inIndices);
1342 
1343  //! \brief Add one polyline and the corresponding vertices
1344  //! \param[in] inIndices : Array of indices. Must be at least 2.
1345  //! \param[in] inVertices : Array of vertices. They will be added into the mesh. inIndices values are indices of this table
1346  //! \param[in] inNormals : Array of normals (or NULL is not specified). If specified, size must be the same than inVertices.
1347  //! \param[in] inColors : Array of RGBcolors (or NULL is not specified). If specified, size must be the same than inVertices.
1348  //! \param[in] inU : Array of u params (or NULL is not specified). If specified, size must be the same than inVertices.
1349  //! \param[in] inV : Array of v params (or NULL is not specified). If specified, size must be the same than inVertices.
1350  //! \return return 0 if ok, other value if fails.
1351  int add_polyline(const Dtk_tab<Dtk_UInt32> * inIndices,const Dtk_tab<Dtk_pnt> * inVertices,const Dtk_tab<Dtk_dir> * inNormals = NULL,const Dtk_tab<Dtk_RGB> * inColors = NULL,const Dtk_tab<Dtk_Float32> * inU = NULL,const Dtk_tab<Dtk_Float32> * inV = NULL);
1352 
1354  //! \brief Get the number of polylines kept in the class instance
1355  //! \return return Number of polylines
1357 
1358  //! \brief Get inI-th polygon
1359  //! \param[in] inI : indice of the polygon to get.
1360  //! \return return an array of indices.
1362 
1363 // points
1364 
1365  int add_point(Dtk_UInt32 inpnt);
1366  int add_points(const Dtk_tab<Dtk_UInt32> * pnts);
1367  int add_points(const Dtk_tab<Dtk_UInt32> * inIndices,const Dtk_tab<Dtk_pnt> * inVertices,const Dtk_tab<Dtk_dir> * inNormals = NULL,const Dtk_tab<Dtk_RGB> * inColors = NULL,const Dtk_tab<Dtk_Float32> * inU = NULL,const Dtk_tab<Dtk_Float32> * inV = NULL);
1370 
1371 
1372 // subinfos
1373 
1378 
1379  //! \brief Reduce memory cost of the Dtk_mesh, to call after adding all geometry
1380  //! \brief The Dtk_mesh class hold internal containers that keep more memory not to reallocate each data enqueuing (like reserve of a std::vector)
1381  //! \brief This function remove all reserves to free some useless memory
1382  void reduce();
1383 
1384  //! \brief Merge a face into the current face
1385  //! \param[in] inMeshface : Mesh face to append to the current face.
1386  void merge(Dtk_mesh_face* inMeshface);
1387 
1388 // additionnal infos
1389  //! \brief acces to class info of mesh_face
1391  //! \brief acces to class info of mesh_face
1392  const Dtk_InfoPtr& info() const;
1393 
1394  //! \brief Set an Id to the face
1395  //! \param inId : set an Id to the face
1396  void set_id(int inId);
1397  //! \brief Return the face Id
1398  int get_id() const;
1399 
1400  //! \brief Set a color to the face. Sometimes, one needs to set a color to a face, not the vertices.
1401  //! \param inColor : RGB color
1402  void set_face_color(const Dtk_RGB& inColor);
1403  //! \brief Return the RGB face color
1405 
1406  //! \brief Return the RGB face color (indice)
1407  int get_face_icolor() const;
1408  //! \brief Set a color to the face (indexed). Sometimes, one needs to set a color to a face, not the vertices.
1409  //! \param inColor : indice of a RGB color
1410  void set_face_icolor(int inColor);
1411 
1412  //! \brief Return the current face type
1414  //! \brief Set a face type
1415  //! \param inType : face type. Can be DTK_MESH_CYLINDER, DTK_MESH_PLANE or DTK_MESH_OTHERSRF
1417 
1418  //! \brief Return the mesh_circle_data of the current face. If it doesn't exist, NULL is returned.
1420  //! \brief Set a mesh_circle_data object to the face, in order to add circular datas (for cylinders)
1421  //! \param inCircle A Dtk_mesh_circle_data object, filled.
1423 
1424  //! \brief Some interfaces need to keep a normal for a specific type of face. Use this to retrieve a global face normal
1426  //! \brief Some interfaces need to keep a normal for a specific type of face. Use this to store a global face normal
1427  void set_face_normal(const Dtk_dir&);
1428 
1429  //! \brief Get a name for the face
1431  //! \brief Set a name for the face
1432  //! \param inName : Name to set.
1433  void set_face_name(const Dtk_string& inName);
1434 
1435  virtual Dtk_Size_t GetSize() const;
1436 
1438 };
1439 
1440 /*
1441 
1442 //! \class Dtk_facet
1443 //! \brief This is a high level abstract facet class, used for both triangles and polygons.
1444 //!
1445 //! This class gathers all the datas related to a facet.
1446 class Dtk_facet
1447 {
1448  protected:
1449 
1450  // indices
1451  Dtk_tab<int> indices;
1452  Dtk_mesh * mesh;
1453 
1454  Dtk_Size_t numset;
1455 
1456  friend class Dtk_mesh;
1457  friend class Dtk_mesh_face;
1458 
1459  void set_numset(Dtk_Size_t);
1460  void set_mesh(Dtk_mesh* inMesh);
1461 
1462  public:
1463 
1464  //! \brief Default constructor
1465  Dtk_facet();
1466 
1467  //! \brief Constructor
1468  //! \param inIndices : indices of the facet vertices
1469  //! \warning Please remember that vertices are stored in a Dtk_mesh object
1470  Dtk_facet(Dtk_tab<int> * inIndices);
1471 
1472  //! \brief Destructor
1473  ~Dtk_facet();
1474 
1475  //! \brief Do some clean up (called by the destructor)
1476  void clean_up();
1477 
1478  //! \brief Used to compute normals
1479  //! \warning Pure virtual method
1480  virtual int compute_normal(Dtk_dir * outNormal) = 0;
1481 
1482  //! \brief A way to check if a facet is valid or not
1483  //! \warning Pure virtual method
1484  virtual Dtk_bool is_valid() = 0;
1485 
1486  //! \brief Add a vertex only by an indice
1487  //! \warning No test is made to check the validity of the parameter. You may call is_valid once the facet is attached to a mesh.
1488  //! \return The current number of vertices
1489  Dtk_Size_t add_indice(int inIndice);
1490 
1491  //! \brief Add a vertex
1492  //! \param inPnt : vertex
1493  //! \param inNormal : normal
1494  //! \param inColor : color
1495  //! \param inU, inV : tex coords
1496  //! \warning A mesh must be set
1497  //! \return return 0 if ok, 1 if error
1498  int add_vertex(Dtk_pnt * inPnt, Dtk_dir * inNormal = NULL, Dtk_RGB * inColor = NULL, Dtk_Float32 inU = 0., Dtk_Float32 inV = 0.);
1499 
1500  //! \brief Return the current number of vertices
1501  Dtk_Size_t get_nb_vertices();
1502 
1503  //! \brief Get a vertex from a facet
1504  //! \param inIndice : indice of the vertex to get
1505  //! \param[out] outPnt : vertex returned
1506  //! \return return 0 if ok, 1 if error, 2 if wrong vertex format
1507  int get_vertex(Dtk_Size_t inIndice, Dtk_pnt* outPnt);
1508 
1509  //! \brief Get a normal from a facet
1510  //! \param inIndice : indice of the vertex to get the normal
1511  //! \param[out] outPnt : normal returned
1512  //! \return return 0 if ok, 1 if error, 2 if wrong vertex format
1513  int get_normal(Dtk_Size_t inIndice, Dtk_dir* outNormal);
1514 
1515  //! \brief Get a color from a facet
1516  //! \param inIndice : indice of the vertex to get the color
1517  //! \param[out] outColor : color returned
1518  //! \return return 0 if ok, 1 if error, 2 if wrong vertex format
1519  int get_color(Dtk_Size_t inIndice, Dtk_RGB* outColor);
1520 
1521  //! \brief Get texture coords from a facet
1522  //! \param inIndice : indice of the vertex to get the texture coords
1523  //! \param[out] outU, outV : UV coords returned
1524  //! \return return 0 if ok, 1 if error, 2 if wrong vertex format
1525  int get_texcoords(Dtk_Size_t inIndice, double* ouU, double* outV);
1526 
1527  //! \brief Return the number of vertices
1528  Dtk_Size_t get_nb_indices();
1529 
1530  //! \brief Return the vertex indices array
1531  Dtk_tab<int>get_indices();
1532 
1533  //! \brief Return an vertex indice
1534  //! \param inIndice : indice in the vertex indices array
1535  int get_indice(int inIndice);
1536 
1537  //! \brief Return the mesh set to the facet
1538  Dtk_mesh * get_mesh();
1539 };
1540 
1541 */
1542 /*
1543 
1544 // n points, n normales
1545 //! \class Dtk_triangle
1546 //! \brief This is a high level triangle class.
1547 //!
1548 //! This class gathers all the datas related to a triangle.
1549 class Dtk_triangle: public Dtk_facet
1550 {
1551  public:
1552 
1553  //! \brief Constructor
1554  Dtk_triangle();
1555 
1556  //! \brief Constructor
1557  //! \param inIndices : indices of the vertices
1558  Dtk_triangle(Dtk_tab<int> * inIndices);
1559 
1560  //! \Destructor
1561  ~Dtk_triangle();
1562 
1563  //! \brief Is_valid method
1564  Dtk_bool is_valid();
1565 
1566  //! \brief To compute the facet normal
1567  //! \param[out] outNormal : the normal returned
1568  //! \return return 0 if ok, 1 if error
1569  int compute_normal(Dtk_dir * outNormal);
1570 };
1571 
1572 */
1573 
1574 /*
1575 
1576 class Dtk_planar_facet: public Dtk_facet
1577 {
1578  friend class Dtk_mesh;
1579  ///////////////////////////donnees membre : brep
1580  ////////////////////////// loops internes
1581  public:
1582 
1583  Dtk_planar_facet();
1584  Dtk_planar_facet(Dtk_tab<int> *);
1585  ~Dtk_planar_facet();
1586 
1587  Dtk_bool is_valid();
1588  int compute_normal(Dtk_dir *);
1589 
1590  Dtk_triangle * to_strip();
1591  Dtk_triangle * to_triangles();
1592 };
1593 
1594 */
1595 
1596 
1597 class Dtk_mesh_circle_data;
1598 
1599 
1600 //! \class Dtk_mesh_curve
1601 //! \brief This is a high level curve class.
1602 //!
1603 //! This class gathers all the datas related to a curve.
1604 //! In this class, vertices are indexed or not.
1606 {
1607  int type; // kind or crv
1608  DTK_MESH_CRV_TYPE crv_type; // crv type
1609  Dtk_tab<int> indices; // si type != 120
1610  Dtk_tab<Dtk_pnt> vertices; // si type == 120
1611  Dtk_RGB color;
1612  unsigned long id;
1613  int line_type;
1614  float thickness;
1615  Dtk_mesh_circle_data * circle_data;
1616 
1617  public:
1618 
1619  //! \brief Default constructor
1621  //! \brief Default destructor
1623 
1624  //! \brief Add an indexed vertex to the curve (indice to an external vertices array, like the one inside Dtk_mesh)
1625  //! \param inIndice : indice
1626  void add_indice(int inIndice);
1627  //! \brief Get an indice from the indices array. Indices array size must be greater than inNum
1628  //! \param inNum : indice to return
1630  //! \brief Pop the last indice from the indices array
1631  int pop_indice();
1632 
1633  //! \brief Add a vertex to the vertices array
1634  //! \param inVertex : vertex to add
1635  void add_vertex(Dtk_pnt inVertex);
1636  //! \brief Get a vertex from the verxtex array
1637  //! \param inIndice : number of the vertex to get
1638  //! \param[out] outVertex : vertex returned
1639  //! \return return 0 if ok
1640  int get_vertex(Dtk_Size_t inIndice, Dtk_pnt * outVertex);
1641  //! \brief Pop the last vertex from the vertices array
1643 
1644  //! \brief Return the vertices array size
1646  //! \brief Return the indices array size
1648 
1649  //! \brief Set an ID to the curve
1650  //! \param inID : ID
1651  void set_id(unsigned long inID);
1652  //! \brief Return the ID of the curve
1653  unsigned long get_id();
1654 
1655  //! \brief Set the curve type
1656  //! \param inType : type of the curve, can be :
1657  //!
1658  //!
1659  //! - \b DTK_CGR_CRV_WIREFRAME_INDICE : wireframe curve with indexed vertices\n
1660  //! - \b DTK_CGR_CRV_WIREFRAME_PNTS : wireframe curve non indexed\n
1661  //! - \b DTK_CGR_CRV_BOUNDARY_INDICE : boundary curve with indexed vertices\n
1662  //! - \b DTK_CGR_CRV_BOUNDARY_PNTS : boundary curve non indexed\n
1663  //! - \b DTK_CGR_CRV_NO_BOUNDARY_INDICE : internal\n
1664  //! - \b DTK_CGR_CRV_NO_BOUNDARY_PNTS : internal\n
1665  //!\n
1666  void set_type(int inType);
1667  //! \brief Return the curve type
1668  int get_type();
1669  //! \brief Set the curve nature
1670  //! \param type : can be DTK_MESH_CIRCLE, DTK_MESH_LINE or DTK_MESH_OTHERCRV
1671  //! if DTK_MESH_CIRCLE, the Dtk_mesh_curve object must have a mesh_circle_data object set (see set_mesh_circle_data(..) help)
1673  //! \brief Return the curve nature
1674  //! \return DTK_MESH_CRV_TYPE value
1676 
1677  //! \brief Set a RGB color to the curve
1678  //! \param R, G, B : RGB values
1679  void set_color(int R, int G, int B);
1680  //! \brief Return the curve color
1681  //! \return A Dtk_RGB object is returned
1683 
1684  //! \brief Set thickness in Dtk_mesh_curve
1685  void set_thickness(float inThickness);
1686 
1687  //! \brief Get thickness of Dtk_mesh_curve
1688  float get_thickness();
1689 
1690  //! \brief Set line type in Dtk_mesh_curve
1691  void set_linetype(int inLineType);
1692 
1693  //! \brief Get line type of Dtk_mesh_curve
1695 
1696  //! \brief Set a mesh_circle_data object to the face, in order to add circular datas (for circles)
1697  //! \param inCircle A Dtk_mesh_circle_data object, filled.
1700  //! \brief
1702 };
1703 
1704 
1705 
1706 //! \class Dtk_mesh_circle_data
1707 //! \brief This class gathers circle datas.
1709 {
1710  Dtk_dir axis;
1711  Dtk_pnt center;
1712  double radius;
1713 
1714  public:
1715  //! \brief Default constructor
1717  //! \brief Default destructor
1719 
1720  //! \brief Used to set the circle/cylinder axis
1721  //! \param inAxis : axis
1722  void set_axis(Dtk_dir inAxis);
1723  //! \brief Return the circle/cylinder axis
1725 
1726  //! \brief Used to set the circle/cylinder center
1727  //! \param inCenter : center
1728  void set_center(Dtk_pnt inCenter);
1729  //! \brief Return the circle/cylinder center
1731 
1732  //! \brief Used to set the circle/cylinder radius
1733  //! \param inRadius : radius
1734  void set_radius(double inRadius);
1735  //! \brief Return the circle/cylinder radius
1736  double get_radius() const;
1737 };
1738 
1739 
1740 
1741 // new class Dtk_MeshPolyline
1742 //! \class Dtk_MeshPolyline
1743 //! \brief This is the Polyline in Mesh mode.
1744 //!
1745 
1747 {
1748 private:
1749  friend class Dtk_SmartPtr<Dtk_MeshPolyline>;
1750  Dtk_tab<Dtk_UInt32> points; // array of indice in vertex array from Dtk_MEsh of Polyline
1751  int TopoID;
1752 
1753 public:
1756  void AddVertex(const Dtk_UInt32 ind);
1758  int GetTopoID() { return (TopoID); };
1759  void SetTopoID(const int ival);
1760  Dtk_Size_t GetNbVertex() { return (points.size()); };
1761 
1762  //downcasting
1763  int DtkDynamicType(const int& inId);
1765 
1766 
1767 };
1768 
1770 
1771 
1772 
1773 
1774 #endif
Dtk_mesh_face::get_nbtriangle_fans
Dtk_Size_t get_nbtriangle_fans() const
Get the number of triangle fans kept in the class instance.
Dtk_mesh::has_colors
Dtk_bool has_colors()
Return true if the current vertex format includes color (RGB)
Dtk_mesh_curve::set_type
void set_type(int inType)
Set the curve type.
Dtk_mesh_curve::set_linetype
void set_linetype(int inLineType)
Set line type in Dtk_mesh_curve.
Dtk_mesh_face::get_face_color
Dtk_RGB get_face_color() const
Return the RGB face color.
Dtk_mesh::set_vertex
int set_vertex(Dtk_Size_t inPos, const Dtk_pnt *inVertex, const Dtk_dir *inNormal=NULL, const Dtk_RGB *inColor=NULL, Dtk_Float32 inU=0., Dtk_Float32 inV=0., Dtk_Float32 inUBrep=0., Dtk_Float32 inVBrep=0.)
Set a vertex.
Dtk_mesh::get_id
int get_id()
Return the mesh id.
Dtk_mesh_vertex_norm::SetNormal
Dtk_Int32 SetNormal(const Dtk_dir &)
Dtk_mesh_vertex::GetNormal
virtual Dtk_dir GetNormal() const
Dtk_mesh_vertex
For internal use.
Definition: util_mesh_dtk.hpp:1005
DTK_FACET_TYPE
DTK_FACET_TYPE
Definition: util_mesh_dtk.hpp:44
Dtk_MeshPolyline::DtkDynamicType
int DtkDynamicType(const int &inId)
Dtk_mesh_face::trifans
Dtk_tab< Dtk_tab< Dtk_UInt32 > > trifans
Definition: util_mesh_dtk.hpp:1088
Dtk_mesh::check_params
Dtk_bool check_params(const Dtk_pnt *inVertex, const Dtk_dir *inNormal, const Dtk_RGB *inColor, Dtk_Float32 inU, Dtk_Float32 inV)
DTK_MESH_PLANE
@ DTK_MESH_PLANE
Definition: util_mesh_dtk.hpp:1068
Dtk_transfo
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
Dtk_mesh_vertex::GetU
virtual Dtk_Float32 GetU() const
Dtk_mesh_vertex::SetV
virtual Dtk_Int32 SetV(Dtk_Float32)
Dtk_mesh::_typeID
@ _typeID
Definition: util_mesh_dtk.hpp:699
Dtk_mesh_face
This is a high level face class.
Definition: util_mesh_dtk.hpp:1076
dtk_matrix.hpp
Dtk_mesh::Clone
virtual Dtk_Object * Clone()
Definition: util_mesh_dtk.hpp:730
Dtk_mesh::Store
Dtk_ErrorStatus Store(const Dtk_string &inFile, Dtk_Size_t inIo=1)
Dtk_mesh::compute_bb
int compute_bb(Dtk_pnt *min, Dtk_pnt *max)
Compute the mesh Bounding Box.
Dtk_mesh::_stream
Dtk_StreamPtr _stream
Definition: util_mesh_dtk.hpp:724
Dtk_mesh_face::get_mockup_indices
const Dtk_tab< Dtk_tab< Dtk_UInt32 > > * get_mockup_indices(Dtk_Size_t inI) const
Get inI-th mockup.
Dtk_mesh::get_Infos
const Dtk_InfoPtr & get_Infos()
Return DtkInfosPtr of this Dtk_Mesh may be NULL.
Dtk_mesh_face::add_polygon
int add_polygon(const Dtk_tab< Dtk_UInt32 > *inIndices)
Add one polygon.
dtk_dir.hpp
DTK_TYPE_MESH_FACE
@ DTK_TYPE_MESH_FACE
Definition: define.h:528
Dtk_mesh_face::compute_round_normals
int compute_round_normals()
Compute round normals from geometry.
Dtk_mesh_face::triangles
Dtk_tab< Dtk_UInt32 > triangles
Definition: util_mesh_dtk.hpp:1085
DTK_TYPE_MESH
@ DTK_TYPE_MESH
Definition: define.h:468
Dtk_mesh::set_material
void set_material(Dtk_MaterialPtr inMat)
Set the material of the mesh.
Dtk_mesh_vertex_norm::Dtk_mesh_vertex_norm
Dtk_mesh_vertex_norm()
Dtk_Float32
float Dtk_Float32
Definition: define.h:699
Dtk_mesh::set_Infos
void set_Infos(const Dtk_InfoPtr &inDtkInfosPtr)
Set DtkInfosPtr of this Dtk_Mesh.
Dtk_mesh::get_normal
int get_normal(Dtk_Size_t inPos, Dtk_dir *outNormal, Dtk_mesh_face *inMeshFace=NULL)
Return a normal (if vertex format includes normal)
Dtk_MeshPolyline::Dtk_MeshPolyline
Dtk_MeshPolyline()
Dtk_mesh_face::tristrips
Dtk_tab< Dtk_tab< Dtk_UInt32 > > tristrips
Definition: util_mesh_dtk.hpp:1087
Dtk_mesh::DtkDynamicType
Dtk_Int32 DtkDynamicType(const Dtk_Int32 &inId)
Retrieves the dynamic entity type.
Dtk_mesh::ofsUVBrep
Dtk_Size_t ofsUVBrep
Definition: util_mesh_dtk.hpp:709
Dtk_mesh::get_normal
Dtk_dir get_normal(Dtk_Size_t inPos)
Return a vertex (2nd form of get_normal)
Dtk_mesh_face::_Store
Dtk_ErrorStatus _Store(void *)
Dtk_mesh_curve::get_thickness
float get_thickness()
Get thickness of Dtk_mesh_curve.
Dtk_mesh::compute_round_normals
int compute_round_normals()
Compute round normals from geometry.
Dtk_mesh_face::set_id
void set_id(int inId)
Set an Id to the face.
Dtk_mesh_face::set_face_type
void set_face_type(DTK_MESH_TYPE_FACE inType)
Set a face type.
Dtk_mesh_vertex_norm::GetNormal
Dtk_dir GetNormal() const
Dtk_mesh::get_nb_mesh_face
Dtk_Size_t get_nb_mesh_face() const
Return the faces array size.
Dtk_mesh_vertex::SetRGB
virtual Dtk_Int32 SetRGB(const Dtk_RGB &)
Dtk_MeshPolyline::GetVertexInd
Dtk_UInt32 GetVertexInd(const Dtk_UInt32 ival)
DTK_MESH_OTHERSRF
@ DTK_MESH_OTHERSRF
Definition: util_mesh_dtk.hpp:1068
Dtk_mesh_face::_typeID
@ _typeID
Definition: util_mesh_dtk.hpp:1081
Dtk_mesh_vertex_norm_color_uv::GetV
Dtk_Float32 GetV() const
Dtk_mesh_face::get_polygon_indices
const Dtk_tab< Dtk_UInt32 > * get_polygon_indices(Dtk_Size_t inI) const
Get inI-th polygon.
Dtk_mesh::HasTextureValues
Dtk_bool HasTextureValues
Definition: util_mesh_dtk.hpp:703
Dtk_mesh_face::polygons
Dtk_tab< Dtk_tab< Dtk_UInt32 > > polygons
Definition: util_mesh_dtk.hpp:1086
Dtk_mesh_face::GetSize
virtual Dtk_Size_t GetSize() const
Dtk_mesh_curve::transform2Cpy
Dtk_mesh_curve * transform2Cpy(Dtk_transfo *inMatrix)
Dtk_mesh_face::DtkDynamicType
Dtk_Int32 DtkDynamicType(const Dtk_Int32 &inId)
Retrieves the dynamic entity type.
Dtk_mesh::back_face_culling
Dtk_bool back_face_culling
Definition: util_mesh_dtk.hpp:702
Dtk_mesh_curve::get_linetype
int get_linetype()
Get line type of Dtk_mesh_curve.
Dtk_mesh::Create
static Dtk_MeshPtr Create(int inVertex_format=1, Dtk_bool inBack_face_culling=true)
Constructor.
Dtk_mesh::DtkDynamicCast
static Dtk_mesh * DtkDynamicCast(Dtk_Object *s)
Performs a dynamic cast - doesn't need RTTI -.
Dtk_mesh::ofsRGB
Dtk_Size_t ofsRGB
Definition: util_mesh_dtk.hpp:709
Dtk_mesh_face::get_mockup_normal
Dtk_dir get_mockup_normal(Dtk_Size_t inI) const
Dtk_mesh_face::add_triangle_fan
int add_triangle_fan(const Dtk_tab< Dtk_UInt32 > *inIndices)
Add one triangle fan.
Dtk_mesh_face::points
Dtk_tab< Dtk_UInt32 > points
Definition: util_mesh_dtk.hpp:1091
Dtk_mesh::is_backface_culled
Dtk_bool is_backface_culled()
Return the true of false if culled or not.
Dtk_UInt32
uint32_t Dtk_UInt32
Definition: define.h:687
Dtk_mesh::submeshes
Dtk_tab< Dtk_mesh_face * > submeshes
Definition: util_mesh_dtk.hpp:725
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
Dtk_mesh_face::get_triangle_fan_indices
const Dtk_tab< Dtk_UInt32 > * get_triangle_fan_indices(Dtk_Size_t inI) const
Get inI-th triangle fan.
Dtk_mesh_face::reduce
void reduce()
Reduce memory cost of the Dtk_mesh, to call after adding all geometry.
Dtk_mesh_face::get_id
int get_id() const
Return the face Id.
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:711
Dtk_mesh_face::set_mesh_circle_data
void set_mesh_circle_data(const Dtk_mesh_circle_data &inCircle)
Set a mesh_circle_data object to the face, in order to add circular datas (for cylinders)
Dtk_mesh::C_GetU
Dtk_Float32 C_GetU(Dtk_Size_t i) const
Dtk_mesh_circle_data::get_center
Dtk_pnt get_center() const
Return the circle/cylinder center.
Dtk_mesh_circle_data::get_radius
double get_radius() const
Return the circle/cylinder radius.
Dtk_mesh_face::get_polyline_indices
const Dtk_tab< Dtk_UInt32 > * get_polyline_indices(Dtk_Size_t inI) const
Get inI-th polygon.
Dtk_mesh_face::add_triangle_strip
int add_triangle_strip(const Dtk_tab< Dtk_UInt32 > *inIndices)
Add one triangle strip.
Dtk_mesh_vertex_norm_color::GetRGB
Dtk_RGB GetRGB() const
Dtk_mesh::mergemove
void mergemove(Dtk_SmartPtr< Dtk_mesh > &inmesh)
Dtk_mesh_face::get_mesh_circle_data
Dtk_mesh_circle_data get_mesh_circle_data() const
Return the mesh_circle_data of the current face. If it doesn't exist, NULL is returned.
Dtk_mesh_face::mesh
Dtk_mesh * mesh
Definition: util_mesh_dtk.hpp:1083
Dtk_mesh_vertex_norm_color::Dtk_mesh_vertex_norm_color
Dtk_mesh_vertex_norm_color()
Dtk_mesh_face::get_triangle_normal
Dtk_dir get_triangle_normal(Dtk_Size_t inI) const
Get the center normal of the inI-th triangle.
Dtk_mesh::has_normals
Dtk_bool has_normals()
Return true if the current vertex format includes normal.
Dtk_mesh::GetVTexture
Dtk_Float32 GetVTexture(Dtk_Size_t inPos) const
Dtk_mesh_curve::set_id
void set_id(unsigned long inID)
Set an ID to the curve.
Dtk_mesh_curve::add_vertex
void add_vertex(Dtk_pnt inVertex)
Add a vertex to the vertices array.
Dtk_mesh::Store
Dtk_ErrorStatus Store(FILE *inFile, Dtk_Size_t inIo=1)
dtk_val.hpp
Dtk_mesh_vertex::GetV
virtual Dtk_Float32 GetV() const
Dtk_mesh::C_ComputeOffsets
void C_ComputeOffsets()
DTK_MESH_XYZ
#define DTK_MESH_XYZ
Definition: util_mesh_dtk.hpp:30
Dtk_MeshPolyline::GetTopoID
int GetTopoID()
Definition: util_mesh_dtk.hpp:1758
Dtk_mesh_face::get_nb_vertices
Dtk_Size_t get_nb_vertices(int inOnce=1)
Compute the total number of vertices used in the face.
Dtk_mesh::vertex_format
int vertex_format
Definition: util_mesh_dtk.hpp:704
Dtk_mesh_face::compute_bb
int compute_bb(Dtk_pnt *min, Dtk_pnt *max)
Compute the mesh Bounding Box.
Dtk_mesh::set_texcoords
int set_texcoords(Dtk_Size_t inPos, Dtk_Float32 inU, Dtk_Float32 inV)
Set texture coords to a point (if vertex format includes tex coords)
DTK_FALSE
#define DTK_FALSE
Definition: define.h:727
Dtk_mesh_vertex_norm::transform
Dtk_Int32 transform(Dtk_transfo &)
Dtk_bool
char Dtk_bool
Definition: define.h:724
Dtk_mesh::merge
void merge(const Dtk_mesh *inMesh)
Merge another Dtk_mesh.
Dtk_mesh_vertex_norm_color_uv::SetU
Dtk_Int32 SetU(Dtk_Float32)
DTK_TYPE_MATERIAL
@ DTK_TYPE_MATERIAL
Definition: define.h:515
Dtk_mesh::SetStream
void SetStream(Dtk_StreamPtr inStream)
Dtk_mesh::add_vertex
int add_vertex(const Dtk_pnt *inVertex, const Dtk_dir *inNormal=NULL, const Dtk_RGB *inColor=NULL, Dtk_Float32 inU=0., Dtk_Float32 inV=0., Dtk_Float32 inUBrep=0., Dtk_Float32 inVBrep=0.)
Add a vertex to the mesh vertices list.
DTK_MESH_CYLINDER
@ DTK_MESH_CYLINDER
Definition: util_mesh_dtk.hpp:1068
DTK_MESH_LINE
@ DTK_MESH_LINE
Definition: util_mesh_dtk.hpp:46
Dtk_mesh_face::get_nbmockups
Dtk_Size_t get_nbmockups() const
Get the number of mockups kept in the class instance.
Dtk_mesh::~Dtk_mesh
~Dtk_mesh()
Dtk_mesh::reducesubfaces
void reducesubfaces()
Merge subfaces that have the same properties.
Dtk_mesh_face::get_subinfo
Dtk_InfoPtr & get_subinfo(Dtk_Size_t inI)
Dtk_mesh::C_GetRGB
void C_GetRGB(Dtk_Size_t i, Dtk_RGB &out) const
Dtk_mesh::apply_render_infos
Dtk_bool apply_render_infos(Dtk_RenderInfosPtr)
Apply texture mapping to the mesh. It will modify points texture UV coordinates.
Dtk_mesh::Dtk_mesh
Dtk_mesh(Dtk_mesh &&inMesh) DTK_NOEXCEPT
Dtk_mesh_face::reserve_polylines
void reserve_polylines(Dtk_Size_t nb)
Dtk_mesh::transform
int transform(Dtk_transfo *inMatrix)
Apply a transformation matrix to the Mesh.
Dtk_MeshPolyline::GetNbVertex
Dtk_Size_t GetNbVertex()
Definition: util_mesh_dtk.hpp:1760
Dtk_Double64
double Dtk_Double64
Definition: define.h:698
Dtk_MeshPolyline::~Dtk_MeshPolyline
virtual ~Dtk_MeshPolyline()
Dtk_mesh_face::subinfos
Dtk_tab< Dtk_InfoPtr > subinfos
Definition: util_mesh_dtk.hpp:1092
Dtk_mesh_vertex::Dtk_mesh_vertex
Dtk_mesh_vertex(const Dtk_pnt *inVertex)
DTK_MOCKUP
@ DTK_MOCKUP
Definition: util_mesh_dtk.hpp:44
Dtk_mesh_face::get_nbpolylines
Dtk_Size_t get_nbpolylines() const
Get the number of polylines kept in the class instance.
Dtk_mesh::to_stl
int to_stl(Dtk_string inFilename, Dtk_bool inIsAciiMode=DTK_FALSE)
DTK_MESH_CIRCLE
@ DTK_MESH_CIRCLE
Definition: util_mesh_dtk.hpp:46
Dtk_mesh_curve::set_color
void set_color(int R, int G, int B)
Set a RGB color to the curve.
Dtk_mesh_face::get_face_name
Dtk_string get_face_name() const
Get a name for the face.
Dtk_mesh
This is a high level mesh class.
Definition: util_mesh_dtk.hpp:694
Dtk_mesh::reserve_submesh
void reserve_submesh(Dtk_Size_t nb)
Dtk_mesh_face::get_face_icolor
int get_face_icolor() const
Return the RGB face color (indice)
Dtk_mesh::check_format
Dtk_bool check_format(int inFormat)
Checks The current vertex format of the Dtk_mesh object.
Dtk_mesh::explode
int explode(Dtk_bool ExplodeTristrips, Dtk_bool ExplodeTrifans, Dtk_bool ExplodePolygons, Dtk_bool ExplodeMockups)
Decompose complex geometry (triangle strips, fan, polygons) according to specified parameters into tr...
Dtk_mesh::get_mesh_faces
Dtk_tab< Dtk_mesh_face * > & get_mesh_faces()
Return the array of mesh faces.
Dtk_mesh_vertex::SetU
virtual Dtk_Int32 SetU(Dtk_Float32)
Dtk_Val
Definition: dtk_val.hpp:67
Dtk_mesh::get_type_detk
enum type_detk get_type_detk() const
Dtk_mesh_face::add_subinfo
int add_subinfo(Dtk_InfoPtr &ininf)
Dtk_mesh::get_mesh_color
Dtk_RGB get_mesh_color()
get color in Dtk_mesh
Dtk_Object::DtkDynamicCast
static Dtk_Object * DtkDynamicCast(Dtk_Object *s)
Dtk_mesh::C_SetRGB
void C_SetRGB(Dtk_Size_t i, const Dtk_RGB &out)
Dtk_mesh_curve
This is a high level curve class.
Definition: util_mesh_dtk.hpp:1606
dtk_pnt.hpp
Dtk_mesh::get_nb_vertices
Dtk_Size_t get_nb_vertices() const
Return the vertices array size.
dtk_picture.hpp
Dtk_mesh::GetVBrep
Dtk_Float32 GetVBrep(Dtk_Size_t inPos) const
Dtk_mesh_face::get_triangle_vertex
Dtk_pnt get_triangle_vertex(Dtk_Size_t inI, Dtk_Size_t inV) const
Get the V-th vertex of the inI-th triangle.
Dtk_mesh_face::polylines
Dtk_tab< Dtk_tab< Dtk_UInt32 > > polylines
Definition: util_mesh_dtk.hpp:1090
Dtk_mesh_circle_data
This class gathers circle datas.
Definition: util_mesh_dtk.hpp:1709
Dtk_mesh_vertex_norm::normal
Dtk_Float32 normal[3]
Definition: util_mesh_dtk.hpp:1029
Dtk_mesh_face::compute_bb_center
int compute_bb_center(Dtk_pnt *i)
Compute the mesh Bounding Box.
Dtk_mesh_face::mockup
Dtk_tab< Dtk_tab< Dtk_tab< Dtk_UInt32 > > > mockup
Definition: util_mesh_dtk.hpp:1089
Dtk_mesh_face::add_mockup
int add_mockup(const Dtk_tab< Dtk_tab< Dtk_UInt32 > > *inIndices)
Add one mockup.
Dtk_picture
This class defines a picture.
Definition: dtk_picture.hpp:39
Dtk_mesh_curve::get_vertex
int get_vertex(Dtk_Size_t inIndice, Dtk_pnt *outVertex)
Get a vertex from the verxtex array.
Dtk_mesh_curve::get_indice
int get_indice(Dtk_Size_t inNum)
Get an indice from the indices array. Indices array size must be greater than inNum.
Dtk_mesh::operator=
Dtk_mesh & operator=(const Dtk_mesh &inMesh)
Dtk_mesh::ofsNRM
Dtk_Size_t ofsNRM
Definition: util_mesh_dtk.hpp:709
Dtk_mesh_face::Create
static Dtk_mesh_facePtr Create(const Dtk_mesh_face &in)
Calls copy constructor to allocate a new object.
util_ent_dtk.hpp
Dtk_mesh_vertex::~Dtk_mesh_vertex
virtual ~Dtk_mesh_vertex()
Dtk_mesh::mergemove
void mergemove(Dtk_mesh *inmesh)
Dtk_mesh::rescale_model
int rescale_model(float ratio)
Perform a scale of the model.
Dtk_Int32
int32_t Dtk_Int32
Definition: define.h:686
Dtk_mesh_circle_data::get_axis
Dtk_dir get_axis() const
Return the circle/cylinder axis.
Dtk_mesh_vertex_norm_color::Dtk_mesh_vertex_norm_color
Dtk_mesh_vertex_norm_color(const Dtk_pnt *inVertex, const Dtk_dir *inNorm, const Dtk_RGB *inRGB)
Dtk_mesh_face::set_face_normal
void set_face_normal(const Dtk_dir &)
Some interfaces need to keep a normal for a specific type of face. Use this to store a global face no...
Dtk_mesh_vertex::Dtk_mesh_vertex
Dtk_mesh_vertex()
Dtk_mesh::ofsUV
Dtk_Size_t ofsUV
Definition: util_mesh_dtk.hpp:709
Dtk_mesh_vertex::vertex
Dtk_Float32 vertex[3]
Definition: util_mesh_dtk.hpp:1007
Dtk_mesh_vertex_norm
Definition: util_mesh_dtk.hpp:1027
Dtk_mesh::C_SetVertex
void C_SetVertex(Dtk_Size_t i, const Dtk_pnt &out)
Dtk_mesh::compute_bb_center
int compute_bb_center(Dtk_pnt *i)
Compute the mesh Bounding Box.
Dtk_mesh_face::get_triangle_indices
const Dtk_UInt32 * get_triangle_indices(Dtk_Size_t inI) const
Get pointer of triangle indices of i-th triangle.
Dtk_mesh::has_xyz
Dtk_bool has_xyz()
Return true if the current vertex format includes 3D coords (XYZ)
Dtk_mesh_vertex_norm_color_uv
Definition: util_mesh_dtk.hpp:1052
Dtk_mesh::get_texcoords
int get_texcoords(Dtk_Size_t inPos, Dtk_Float32 *outU, Dtk_Float32 *outV)
Return texture coords (if vertex format includes tex coords)
Dtk_mesh_vertex::transform
virtual Dtk_Int32 transform(Dtk_transfo &)
Dtk_mesh_face::get_polygon_normal
Dtk_dir get_polygon_normal(Dtk_Size_t inI) const
Dtk_mesh_face::explode
int explode()
Decompose all complex geometry (triangle strips, fan, polygons) into triangles, and append it into th...
Dtk_MeshPolylinePtr
Dtk_SmartPtr< Dtk_MeshPolyline > Dtk_MeshPolylinePtr
Definition: util_mesh_dtk.hpp:1769
Dtk_MeshPolyline::AddVertex
void AddVertex(const Dtk_UInt32 ind)
Dtk_MeshPolyline::DtkDynamicCast
static Dtk_MeshPolyline * DtkDynamicCast(Dtk_Object *nObject)
Dtk_mesh_face::add_point
int add_point(Dtk_UInt32 inpnt)
Dtk_mesh_vertex_norm_color_uv::GetSize
Dtk_Size_t GetSize() const
Dtk_mesh::set_mesh_color
void set_mesh_color(const Dtk_RGB &inColor)
set color in Dtk_mesh
Dtk_mesh_circle_data::set_radius
void set_radius(double inRadius)
Used to set the circle/cylinder radius.
error_dtk.hpp
Dtk_mesh::sizeonevertex
Dtk_Size_t sizeonevertex
Definition: util_mesh_dtk.hpp:709
Dtk_mesh_face::get_face_type
DTK_MESH_TYPE_FACE get_face_type() const
Return the current face type.
Dtk_ErrorStatus
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
DTK_MESH_UNKNOWN_CRV_TYPE
@ DTK_MESH_UNKNOWN_CRV_TYPE
Definition: util_mesh_dtk.hpp:46
Dtk_mesh::reserve_vertex
int reserve_vertex(Dtk_Size_t nb)
Dtk_mesh_face::get_point_indice
Dtk_UInt32 get_point_indice(Dtk_Size_t inI) const
Dtk_tab::reserve
void reserve(Dtk_Size_t n)
Definition: util_stl_dtk.hpp:801
SetAsDeprecated
#define SetAsDeprecated(inFromVersion, inMessage)
Definition: define.h:762
Dtk_mesh_vertex::SetNormal
virtual Dtk_Int32 SetNormal(const Dtk_dir &)
DTK_UNKNOWN_FACET
@ DTK_UNKNOWN_FACET
Definition: util_mesh_dtk.hpp:44
Dtk_mesh::id
int id
Definition: util_mesh_dtk.hpp:701
Dtk_mesh::change_vertex_format
int change_vertex_format(int inVertex_format)
Change Vertex format, check constructor comment to see options.
Dtk_mesh::get_color
int get_color(Dtk_Size_t inPos, Dtk_RGB *outColor)
Return a color (if vertex format includes color)
Dtk_mesh::GetSize
Dtk_Size_t GetSize() const
Dtk_SmartPtr< Dtk_material >
Dtk_mesh_vertex::GetRGB
virtual Dtk_RGB GetRGB() const
Dtk_mesh::get_mesh_face
Dtk_mesh_face * get_mesh_face(Dtk_Size_t inPos)
Return a face.
Dtk_mesh::set_normal
int set_normal(Dtk_Size_t inPos, const Dtk_dir *inNormal)
Set a normal to a point (if vertex format includes normal)
Dtk_mesh_face::get_nbpoints
Dtk_Size_t get_nbpoints() const
DTK_MESH_UNKNOWN_TYPE_FACE
@ DTK_MESH_UNKNOWN_TYPE_FACE
Definition: util_mesh_dtk.hpp:1068
A
</td ></tr >< tr >< td width="33%"> Translucency</td >< td width="45%"> Alpha A() into Dtk_RGB</td >< td width
Dtk_mesh_face::get_nb_facets
Dtk_Size_t get_nb_facets()
Compute all facets (triangles) holded by the class, including trianglestrips, fans,...
Dtk_mesh_face::get_nbsubinfos
Dtk_Size_t get_nbsubinfos() const
Dtk_mesh_face::set_face_icolor
void set_face_icolor(int inColor)
Set a color to the face (indexed). Sometimes, one needs to set a color to a face, not the vertices.
Dtk_mesh_face::add_mockups
int add_mockups(const Dtk_tab< Dtk_tab< Dtk_tab< Dtk_UInt32 > > > *inIndices, const Dtk_tab< Dtk_pnt > *inVertices, const Dtk_tab< Dtk_dir > *inNormals=NULL, const Dtk_tab< Dtk_RGB > *inColors=NULL, const Dtk_tab< Dtk_Float32 > *inU=NULL, const Dtk_tab< Dtk_Float32 > *inV=NULL)
Dtk_mesh::merge
void merge(const Dtk_SmartPtr< Dtk_mesh > &inMesh)
Dtk_mesh_face::_infos
Dtk_InfoPtr _infos
Definition: util_mesh_dtk.hpp:1094
Dtk_mesh_vertex::SetVertex
virtual Dtk_Int32 SetVertex(const Dtk_pnt &)
Dtk_MeshPtr
Dtk_SmartPtr< Dtk_mesh > Dtk_MeshPtr
Definition: util_mesh_dtk.hpp:25
dtk_transfo.hpp
Dtk_mesh::Dtk_mesh
Dtk_mesh(int inVertex_format=1, Dtk_bool inBack_face_culling=true)
Dtk_mesh_face::reserve_triangle_strip
int reserve_triangle_strip(Dtk_Size_t nb)
Dtk_pnt
This is a mathematical point class.
Definition: dtk_pnt.hpp:20
type_detk
type_detk
Definition: define.h:21
Dtk_mesh_circle_data::set_center
void set_center(Dtk_pnt inCenter)
Used to set the circle/cylinder center.
Dtk_mesh::ofsVTX
Dtk_Size_t ofsVTX
Definition: util_mesh_dtk.hpp:709
Dtk_mesh::Transform
Dtk_ErrorStatus Transform(const Dtk_transfo &)
Dtk_mesh_curve::pop_indice
int pop_indice()
Pop the last indice from the indices array.
util_stl_dtk.hpp
Dtk_mesh::mergemove
void mergemove(Dtk_tab< Dtk_MeshPtr > &inArraymesh)
Dtk_mesh::clean_up
void clean_up()
Dtk_mesh_facePtr
Dtk_SmartPtr< Dtk_mesh_face > Dtk_mesh_facePtr
Definition: util_mesh_dtk.hpp:26
Dtk_mesh_curve::get_type
int get_type()
Return the curve type.
Dtk_mesh_face::get_nbtriangles
Dtk_Size_t get_nbtriangles() const
Get the number of simple triangles kept in the class instance.
Dtk_mesh::GetUTexture
Dtk_Float32 GetUTexture(Dtk_Size_t inPos) const
Dtk_mesh::GetUBrep
Dtk_Float32 GetUBrep(Dtk_Size_t inPos) const
Dtk_mesh_face::get_face_normal
Dtk_dir get_face_normal() const
Some interfaces need to keep a normal for a specific type of face. Use this to retrieve a global face...
util_ptr_dtk.hpp
Dtk_mesh_circle_data::~Dtk_mesh_circle_data
~Dtk_mesh_circle_data()
Default destructor.
Dtk_mesh::makestrips
int makestrips()
Assemble all simple triangle, try to make triange-strips.
define.h
Dtk_mesh::Create
static Dtk_MeshPtr Create(const Dtk_mesh &in)
Calls copy constructor to allocate a new object.
Dtk_mesh_curve::get_mesh_circle_data
Dtk_mesh_circle_data * get_mesh_circle_data()
Dtk_mesh_face::DtkDynamicCast
static Dtk_mesh_face * DtkDynamicCast(Dtk_Object *s)
Performs a dynamic cast - doesn't need RTTI -.
Dtk_mesh::reduce
void reduce()
Reduce memory cost of the Dtk_mesh, to call after adding all geometry.
Dtk_mesh::get_nb_facets
Dtk_Size_t get_nb_facets()
Return total number of facets.
Dtk_mesh_vertex::GetSize
virtual Dtk_Size_t GetSize() const
Dtk_mesh_curve::set_mesh_circle_data
void set_mesh_circle_data(Dtk_mesh_circle_data *inCircle)
Set a mesh_circle_data object to the face, in order to add circular datas (for circles)
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:84
DTK_MESH_CRV_TYPE
DTK_MESH_CRV_TYPE
Definition: util_mesh_dtk.hpp:46
Dtk_mesh::set_id
void set_id(int inId)
Set an id to the mesh.
Dtk_mesh::C_GetNormal
void C_GetNormal(Dtk_Size_t i, Dtk_dir &out) const
Dtk_tab::size
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:503
Dtk_mesh_vertex_norm_color::GetSize
Dtk_Size_t GetSize() const
Dtk_mesh_face::get_nbpolygons
Dtk_Size_t get_nbpolygons() const
Get the number of polygons kept in the class instance.
DTK_TRIANGLE_STRIP
@ DTK_TRIANGLE_STRIP
Definition: util_mesh_dtk.hpp:44
Dtk_mesh_curve::add_indice
void add_indice(int inIndice)
Add an indexed vertex to the curve (indice to an external vertices array, like the one inside Dtk_mes...
Dtk_mesh::explode
int explode()
Decompose all complex geometry (triangle strips, fan, polygons) into triangles, and append it into th...
Dtk_mesh_vertex_norm_color_uv::Dtk_mesh_vertex_norm_color_uv
Dtk_mesh_vertex_norm_color_uv()
Dtk_mesh_curve::Dtk_mesh_curve
Dtk_mesh_curve()
Default constructor.
Dtk_MeshPolyline::SetTopoID
void SetTopoID(const int ival)
Dtk_mesh_vertex_norm_color::SetRGB
Dtk_Int32 SetRGB(const Dtk_RGB &)
Dtk_mesh::Dtk_mesh
Dtk_mesh(const Dtk_mesh &inMesh)
Dtk_mesh_curve::get_nb_vertices
Dtk_Size_t get_nb_vertices()
Return the vertices array size.
Dtk_mesh::C_GetVertex
void C_GetVertex(Dtk_Size_t i, Dtk_pnt &out) const
Dtk_mesh_face::merge
void merge(Dtk_mesh_face *inMeshface)
Merge a face into the current face.
DTK_MESH_TYPE_FACE
DTK_MESH_TYPE_FACE
Definition: util_mesh_dtk.hpp:1068
Dtk_mesh_face::Dtk_mesh_face
Dtk_mesh_face(Dtk_mesh_face &&) DTK_NOEXCEPT
DTK_MESH_OTHERCRV
@ DTK_MESH_OTHERCRV
Definition: util_mesh_dtk.hpp:46
Dtk_mesh_vertex_norm::GetSize
Dtk_Size_t GetSize() const
Dtk_Object::DtkDynamicType
virtual int DtkDynamicType(const int &inId)=0
Dtk_mesh::get_mesh_faces
Dtk_tab< Dtk_mesh_face * > const & get_mesh_faces() const
Dtk_mesh_face::get_nbtriangle_strips
Dtk_Size_t get_nbtriangle_strips() const
Get the number of triangle strips kept in the class instance.
Dtk_mesh_vertex_norm_color_uv::u
Dtk_Float32 u
Definition: util_mesh_dtk.hpp:1054
Dtk_mesh::C_SetUVBrep
void C_SetUVBrep(Dtk_Size_t i, Dtk_Float32 u, Dtk_Float32 v)
DTK_TRIANGLE_FAN
@ DTK_TRIANGLE_FAN
Definition: util_mesh_dtk.hpp:44
Dtk_Object
Definition: dtk_object.hpp:8
Dtk_mesh::get_vertex
int get_vertex(Dtk_Size_t inPos, Dtk_pnt *outVertex)
Return a vertex.
Dtk_mesh_curve::set_thickness
void set_thickness(float inThickness)
Set thickness in Dtk_mesh_curve.
dtk_string.hpp
Dtk_mesh_vertex_norm_color::color
Dtk_RGB color
Definition: util_mesh_dtk.hpp:1042
Dtk_mesh_face::set_face_name
void set_face_name(const Dtk_string &inName)
Set a name for the face.
Dtk_mesh_circle_data::set_axis
void set_axis(Dtk_dir inAxis)
Used to set the circle/cylinder axis.
Dtk_tab::at
T & at(Dtk_Size_t k)
Definition: util_stl_dtk.hpp:397
Dtk_mesh::C_SetNormal
void C_SetNormal(Dtk_Size_t i, const Dtk_dir &out)
Dtk_tab::push_back
void push_back(const T &x)
Inserts an element at the end of the array.
Definition: util_stl_dtk.hpp:416
Dtk_mesh_face::info
Dtk_InfoPtr & info()
acces to class info of mesh_face
Dtk_mesh::C_GetVBrep
Dtk_Float32 C_GetVBrep(Dtk_Size_t i) const
Dtk_mesh_vertex_norm_color_uv::SetV
Dtk_Int32 SetV(Dtk_Float32)
Dtk_mesh::operator=
Dtk_mesh & operator=(Dtk_mesh &&inMesh) DTK_NOEXCEPT
Dtk_mesh_face::Dtk_mesh_face
Dtk_mesh_face(const Dtk_mesh_face &)
Dtk_mesh_vertex_norm_color_uv::v
Dtk_Float32 v
Definition: util_mesh_dtk.hpp:1054
Dtk_mesh_curve::~Dtk_mesh_curve
~Dtk_mesh_curve()
Default destructor.
Dtk_mesh_vertex::GetVertex
virtual Dtk_pnt GetVertex() const
Dtk_tab::clear
void clear(int no_delete=0)
Resets the Dtk_tab content.
Definition: util_stl_dtk.hpp:352
Dtk_mesh_face::reverse_triangle
void reverse_triangle(Dtk_Size_t inI)
Reverse the i-th triangle of the set of triangle, so that the normal will be inversed.
Dtk_mesh::get_mesh_face_array
Dtk_tab< Dtk_mesh_face * > & get_mesh_face_array()
Get a reference to the mesh face array // DEPRECATED, UNSAFE.
Dtk_mesh_face::makestrips
int makestrips()
dtk_rgb.hpp
Dtk_RGB
Definition: dtk_rgb.hpp:8
Dtk_mesh::set_color
int set_color(Dtk_Size_t inPos, const Dtk_RGB *inColor)
Set a color to a point (if vertex format includes color)
Dtk_mesh_vertex_norm::Dtk_mesh_vertex_norm
Dtk_mesh_vertex_norm(const Dtk_pnt *inVertex, const Dtk_dir *inNorm)
Dtk_mesh_face::get_mesh
Dtk_mesh * get_mesh()
Dtk_mesh_face::get_triangle_strip_indices
const Dtk_tab< Dtk_UInt32 > * get_triangle_strip_indices(Dtk_Size_t inI) const
Get inI-th triangle strip.
DTK_TRIANGLES
@ DTK_TRIANGLES
Definition: util_mesh_dtk.hpp:44
Dtk_MeshPolyline
This is the Polyline in Mesh mode.
Definition: util_mesh_dtk.hpp:1747
Dtk_mesh_curve::set_crv_type
void set_crv_type(DTK_MESH_CRV_TYPE type)
Set the curve nature.
Dtk_mesh_face::set_face_color
void set_face_color(const Dtk_RGB &inColor)
Set a color to the face. Sometimes, one needs to set a color to a face, not the vertices.
Dtk_mesh::C_GetV
Dtk_Float32 C_GetV(Dtk_Size_t i) const
Dtk_mesh::add_mesh_face
int add_mesh_face(Dtk_mesh_face *inMesh_face)
Add a face (Dtk_mesh_face) to the mesh.
Dtk_dir
This is a mathematical direction class.
Definition: dtk_dir.hpp:14
DTK_POLYGONS
@ DTK_POLYGONS
Definition: util_mesh_dtk.hpp:44
Dtk_mesh_curve::pop_vertex
int pop_vertex(Dtk_pnt *)
Pop the last vertex from the vertices array.
Dtk_mesh_face::add_polyline
int add_polyline(const Dtk_tab< Dtk_UInt32 > *inIndices)
Add one polyline.
Dtk_mesh_curve::get_id
unsigned long get_id()
Return the ID of the curve.
Dtk_mesh::cvertices
Dtk_tab< Dtk_UChar8 > cvertices
Definition: util_mesh_dtk.hpp:708
Dtk_mesh_circle_data::Dtk_mesh_circle_data
Dtk_mesh_circle_data()
Default constructor.
Dtk_mesh_face::add_points
int add_points(const Dtk_tab< Dtk_UInt32 > *pnts)
dtk_object.hpp
Dtk_MaterialPtr
Dtk_SmartPtr< Dtk_material > Dtk_MaterialPtr
Definition: util_mesh_dtk.hpp:23
Dtk_mesh::check_params
Dtk_bool check_params(const Dtk_tab< Dtk_pnt > *inVertices, const Dtk_tab< Dtk_dir > *inNormals, const Dtk_tab< Dtk_RGB > *inColors, const Dtk_tab< Dtk_Float32 > *inU, const Dtk_tab< Dtk_Float32 > *inV)
Dtk_mesh_curve::get_color
Dtk_RGB get_color()
Return the curve color.
Dtk_mesh_vertex_norm_color_uv::GetU
Dtk_Float32 GetU() const
Dtk_mesh_face::add_triangles
int add_triangles(Dtk_tab< Dtk_UInt32 > *inIndices)
Add one of multiple triangles.
Dtk_mesh::get_vertex
Dtk_pnt get_vertex(Dtk_Size_t inPos)
Return a vertex (2nd form of get_vertex)
Dtk_mesh::get_material
Dtk_MaterialPtr get_material()
Get the material of the mesh.
Dtk_mesh::has_texcoords
Dtk_bool has_texcoords()
Return true if the current vertex format includes texture coords (UVTEXTURES)
Dtk_mesh_curve::get_crv_type
DTK_MESH_CRV_TYPE get_crv_type()
Return the curve nature.
DTK_NOEXCEPT
#define DTK_NOEXCEPT
Definition: config.hpp:20
Dtk_mesh::transform2Cpy
Dtk_mesh * transform2Cpy(Dtk_transfo *inMatrix)
Make a copy of the current mesh, applying a transformation on it.
Dtk_Object::operator=
Dtk_Object & operator=(const Dtk_Object &s)
Dtk_mesh::C_GetUBrep
Dtk_Float32 C_GetUBrep(Dtk_Size_t i) const
Dtk_mesh_vertex_norm_color
Definition: util_mesh_dtk.hpp:1040
Dtk_mesh::C_SetUV
void C_SetUV(Dtk_Size_t i, Dtk_Float32 u, Dtk_Float32 v)
Dtk_Entity
Definition: util_ent_dtk.hpp:367
Dtk_mesh::GetStream
Dtk_StreamPtr GetStream() const
Dtk_mesh_curve::get_nb_indices
Dtk_Size_t get_nb_indices()
Return the indices array size.
Dtk_mesh_vertex_norm_color_uv::Dtk_mesh_vertex_norm_color_uv
Dtk_mesh_vertex_norm_color_uv(const Dtk_pnt *inVertex, const Dtk_dir *inNorm, const Dtk_RGB *inRGB, Dtk_Float32 inU, Dtk_Float32 inV)