DATAKIT API  V2025.1
Dtk_mesh_face Class Referenceabstract

This is a high level face class. More...

+ Inheritance diagram for Dtk_mesh_face:

Public Member Functions

Dtk_ErrorStatus _Store (void *)
 
int add_mockup (const Dtk_tab< Dtk_tab< Dtk_UInt32 > > *inIndices)
 Add one mockup. More...
 
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)
 Add one polygon and the corresponding vertices. More...
 
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)
 
int add_point (Dtk_UInt32 inpnt)
 
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)
 
int add_points (const Dtk_tab< Dtk_UInt32 > *pnts)
 
int add_polygon (const Dtk_tab< Dtk_UInt32 > *inIndices)
 Add one polygon. More...
 
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)
 Add one polygon and the corresponding vertices. More...
 
int add_polyline (const Dtk_tab< Dtk_UInt32 > *inIndices)
 Add one polyline. More...
 
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)
 Add one polyline and the corresponding vertices. More...
 
int add_subinfo (Dtk_InfoPtr &ininf)
 
int add_triangle_fan (const Dtk_tab< Dtk_UInt32 > *inIndices)
 Add one triangle fan. More...
 
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)
 Add one triangle fan and the corresponding vertices. More...
 
int add_triangle_strip (const Dtk_tab< Dtk_UInt32 > *inIndices)
 Add one triangle strip. More...
 
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)
 Add one triangle strip and the corresponding vertices. More...
 
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)
 Add one of multiple triangles and the corresponding vertices. More...
 
int add_triangles (const Dtk_UInt32 *inIndices, Dtk_Size_t nb)
 
int add_triangles (Dtk_tab< Dtk_UInt32 > *inIndices)
 Add one of multiple triangles. More...
 
int compute_bb (Dtk_pnt *min, Dtk_pnt *max)
 Compute the mesh Bounding Box. More...
 
int compute_bb_center (Dtk_pnt *i)
 Compute the mesh Bounding Box. More...
 
int compute_round_normals ()
 Compute round normals from geometry. More...
 
 Dtk_mesh_face (const Dtk_mesh_face &inMeshface, Dtk_mesh *inMesh, Dtk_UInt32 shift=0)
 Copy Constructor. More...
 
 Dtk_mesh_face (Dtk_mesh *inMesh)
 Constructor. More...
 
Dtk_Int32 DtkDynamicType (const Dtk_Int32 &inId)
 Retrieves the dynamic entity type. More...
 
virtual int DtkDynamicType (const int &inId)=0
 
virtual void dump (FILE *file=stdout)
 
int explode ()
 Decompose all complex geometry (triangle strips, fan, polygons) into triangles, and append it into the internal triangle array. More...
 
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 triangles, and append it into the internal triangle array. More...
 
Dtk_RGB get_face_color ()
 Return the RGB face color. More...
 
int get_face_icolor ()
 Return the RGB face color (indice) More...
 
Dtk_string get_face_name ()
 Get a name for the face. More...
 
Dtk_dir get_face_normal ()
 Some interfaces need to keep a normal for a specific type of face. Use this to retrieve a global face normal. More...
 
DTK_MESH_TYPE_FACE get_face_type ()
 Return the current face type. More...
 
int get_id ()
 Return the face Id. More...
 
Dtk_meshget_mesh ()
 
Dtk_mesh_circle_data get_mesh_circle_data ()
 Return the mesh_circle_data of the current face. If it doesn't exist, NULL is returned. More...
 
const Dtk_tab< Dtk_tab< Dtk_UInt32 > > * get_mockup_indices (Dtk_Size_t inI) const
 Get inI-th mockup. More...
 
Dtk_dir get_mockup_normal (Dtk_Size_t inI) const
 
Dtk_Size_t get_nb_facets ()
 Compute all facets (triangles) holded by the class, including trianglestrips, fans, polygons. More...
 
Dtk_Size_t get_nb_vertices (int inOnce=1)
 Compute the total number of vertices used in the face. More...
 
Dtk_Size_t get_nbmockups () const
 Get the number of mockups kept in the class instance. More...
 
Dtk_Size_t get_nbpoints () const
 
Dtk_Size_t get_nbpolygons () const
 Get the number of polygons kept in the class instance. More...
 
Dtk_Size_t get_nbpolylines () const
 Get the number of polylines kept in the class instance. More...
 
Dtk_Size_t get_nbsubinfos () const
 
Dtk_Size_t get_nbtriangle_fans () const
 Get the number of triangle fans kept in the class instance. More...
 
Dtk_Size_t get_nbtriangle_strips () const
 Get the number of triangle strips kept in the class instance. More...
 
Dtk_Size_t get_nbtriangles () const
 Get the number of simple triangles kept in the class instance. More...
 
Dtk_UInt32 get_point_indice (Dtk_Size_t inI) const
 
const Dtk_tab< Dtk_UInt32 > * get_polygon_indices (Dtk_Size_t inI) const
 Get inI-th polygon. More...
 
Dtk_dir get_polygon_normal (Dtk_Size_t inI) const
 
const Dtk_tab< Dtk_UInt32 > * get_polyline_indices (Dtk_Size_t inI) const
 Get inI-th polygon. More...
 
Dtk_InfoPtrget_subinfo (Dtk_Size_t inI)
 
const Dtk_InfoPtrget_subinfo (Dtk_Size_t inI) const
 
const Dtk_tab< Dtk_UInt32 > * get_triangle_fan_indices (Dtk_Size_t inI) const
 Get inI-th triangle fan. More...
 
const Dtk_UInt32get_triangle_indices (Dtk_Size_t inI) const
 Get pointer of triangle indices of i-th triangle. More...
 
Dtk_dir get_triangle_normal (Dtk_Size_t inI) const
 Get the center normal of the inI-th triangle. More...
 
const Dtk_tab< Dtk_UInt32 > * get_triangle_strip_indices (Dtk_Size_t inI) const
 Get inI-th triangle strip. More...
 
Dtk_pnt get_triangle_vertex (Dtk_Size_t inI, Dtk_Size_t inV) const
 Get the V-th vertex of the inI-th triangle. More...
 
virtual Dtk_Size_t GetSize () const
 
Dtk_InfoPtrinfo ()
 acces to class info of mesh_face More...
 
const Dtk_InfoPtrinfo () const
 acces to class info of mesh_face More...
 
int makestrips ()
 
void merge (Dtk_mesh_face *inMeshface)
 Merge a face into the current face. More...
 
void reduce ()
 Reduce memory cost of the Dtk_mesh, to call after adding all geometry. More...
 
void reserve_polylines (Dtk_Size_t nb)
 
int reserve_triangle_strip (Dtk_Size_t nb)
 
void reverse_triangle (Dtk_Size_t inI)
 Reverse the i-th triangle of the set of triangle, so that the normal will be inversed. More...
 
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. More...
 
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. More...
 
void set_face_name (const Dtk_string &inName)
 Set a name for the face. More...
 
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 normal. More...
 
void set_face_type (DTK_MESH_TYPE_FACE inType)
 Set a face type. More...
 
void set_id (int inId)
 Set an Id to the face. More...
 
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) More...
 
 ~Dtk_mesh_face ()
 Destructor. More...
 

Static Public Member Functions

static Dtk_mesh_facePtr Create (const Dtk_mesh_face &inToBeCopied)
 Copy constructor. More...
 
static Dtk_mesh_faceDtkDynamicCast (Dtk_Object *s)
 Performs a dynamic cast - doesn't need RTTI -. More...
 

Protected Types

enum  { _typeID = DTK_TYPE_OBJECT }
 
enum  { _typeID = DTK_TYPE_MESH_FACE }
 

Protected Member Functions

void _copy (const Dtk_Object &s)
 
void _init ()
 
void _reset ()
 

Protected Attributes

Dtk_InfoPtr _infos
 
unsigned long count_
 
Dtk_meshmesh
 
Dtk_tab< Dtk_tab< Dtk_tab< Dtk_UInt32 > > > mockup
 
Dtk_tab< Dtk_UInt32points
 
Dtk_tab< Dtk_tab< Dtk_UInt32 > > polygons
 
Dtk_tab< Dtk_tab< Dtk_UInt32 > > polylines
 
Dtk_tab< Dtk_InfoPtrsubinfos
 
Dtk_tab< Dtk_UInt32triangles
 
Dtk_tab< Dtk_tab< Dtk_UInt32 > > trifans
 
Dtk_tab< Dtk_tab< Dtk_UInt32 > > tristrips
 

Friends

class Dtk_mesh
 
class Dtk_SmartPtr< Dtk_mesh_face >
 

Detailed Description

This is a high level face class.

This class gathers all the datas related to a triangulated mesh face.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protectedinherited
Enumerator
_typeID 

◆ anonymous enum

anonymous enum
protected
Enumerator
_typeID 
874  {
876  };

Constructor & Destructor Documentation

◆ Dtk_mesh_face() [1/2]

Dtk_mesh_face::Dtk_mesh_face ( Dtk_mesh inMesh)

Constructor.

Parameters
inMesh: the mesh which will contain the face

◆ Dtk_mesh_face() [2/2]

Dtk_mesh_face::Dtk_mesh_face ( const Dtk_mesh_face inMeshface,
Dtk_mesh inMesh,
Dtk_UInt32  shift = 0 
)

Copy Constructor.

Do not use param shift.

◆ ~Dtk_mesh_face()

Dtk_mesh_face::~Dtk_mesh_face ( )

Destructor.

Member Function Documentation

◆ _copy()

void Dtk_Object::_copy ( const Dtk_Object s)
protectedinherited

◆ _init()

void Dtk_Object::_init ( )
protectedinherited

◆ _reset()

void Dtk_Object::_reset ( )
protectedinherited

◆ _Store()

Dtk_ErrorStatus Dtk_mesh_face::_Store ( void *  )

◆ add_mockup() [1/2]

int Dtk_mesh_face::add_mockup ( const Dtk_tab< Dtk_tab< Dtk_UInt32 > > *  inIndices)

Add one mockup.

On this form, indices MUST match an existing vertex inside Dtk_Mesh class

Parameters
[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

Note : Polygons MUST be convex

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

Returns
return 0 if ok, other value if fails.

◆ add_mockup() [2/2]

int Dtk_mesh_face::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 
)

Add one polygon and the corresponding vertices.

poygon MUST be convex

Parameters
[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

Note : Polygons MUST be convex

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

Parameters
[in]inVertices: Array of vertices. They will be added into the mesh. inIndices values are indices of this table
[in]inNormals: Array of normals (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inColors: Array of RGBcolors (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inU: Array of u params (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inV: Array of v params (or NULL is not specified). If specified, size must be the same than inVertices.
Returns
return 0 if ok, other value if fails.

◆ add_mockups()

int Dtk_mesh_face::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 
)

◆ add_point()

int Dtk_mesh_face::add_point ( Dtk_UInt32  inpnt)

◆ add_points() [1/2]

int Dtk_mesh_face::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 
)

◆ add_points() [2/2]

int Dtk_mesh_face::add_points ( const Dtk_tab< Dtk_UInt32 > *  pnts)

◆ add_polygon() [1/2]

int Dtk_mesh_face::add_polygon ( const Dtk_tab< Dtk_UInt32 > *  inIndices)

Add one polygon.

poygon MUST be convex

On this form, indices MUST match an existing vertex inside Dtk_Mesh class

Parameters
[in]inIndices: Array of indices. Must be a at least 3.
Returns
return 0 if ok, other value if fails.

◆ add_polygon() [2/2]

int Dtk_mesh_face::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 
)

Add one polygon and the corresponding vertices.

poygon MUST be convex

Parameters
[in]inIndices: Array of indices. Must be at least 3.
[in]inVertices: Array of vertices. They will be added into the mesh. inIndices values are indices of this table
[in]inNormals: Array of normals (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inColors: Array of RGBcolors (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inU: Array of u params (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inV: Array of v params (or NULL is not specified). If specified, size must be the same than inVertices.
Returns
return 0 if ok, other value if fails.

◆ add_polyline() [1/2]

int Dtk_mesh_face::add_polyline ( const Dtk_tab< Dtk_UInt32 > *  inIndices)

Add one polyline.

On this form, indices MUST match an existing vertex inside Dtk_Mesh class

Parameters
[in]inIndices: Array of indices. Must be a at least 3.
Returns
return 0 if ok, other value if fails.

◆ add_polyline() [2/2]

int Dtk_mesh_face::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 
)

Add one polyline and the corresponding vertices.

Parameters
[in]inIndices: Array of indices. Must be at least 2.
[in]inVertices: Array of vertices. They will be added into the mesh. inIndices values are indices of this table
[in]inNormals: Array of normals (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inColors: Array of RGBcolors (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inU: Array of u params (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inV: Array of v params (or NULL is not specified). If specified, size must be the same than inVertices.
Returns
return 0 if ok, other value if fails.

◆ add_subinfo()

int Dtk_mesh_face::add_subinfo ( Dtk_InfoPtr ininf)

◆ add_triangle_fan() [1/2]

int Dtk_mesh_face::add_triangle_fan ( const Dtk_tab< Dtk_UInt32 > *  inIndices)

Add one triangle fan.

On this form, indices MUST match an existing vertex inside Dtk_Mesh class

Parameters
[in]inIndices: Array of indices. Must be a at least 3.
Returns
return 0 if ok, other value if fails.

◆ add_triangle_fan() [2/2]

int Dtk_mesh_face::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 
)

Add one triangle fan and the corresponding vertices.

Parameters
[in]inIndices: Array of indices. Must be at least 3.
[in]inVertices: Array of vertices. They will be added into the mesh. inIndices values are indices of this table
[in]inNormals: Array of normals (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inColors: Array of RGBcolors (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inU: Array of u params (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inV: Array of v params (or NULL is not specified). If specified, size must be the same than inVertices.
Returns
return 0 if ok, other value if fails.

◆ add_triangle_strip() [1/2]

int Dtk_mesh_face::add_triangle_strip ( const Dtk_tab< Dtk_UInt32 > *  inIndices)

Add one triangle strip.

On this form, indices MUST match an existing vertex inside Dtk_Mesh class

Parameters
[in]inIndices: Array of indices. Must be a at least 3.
Returns
return 0 if ok, other value if fails.

◆ add_triangle_strip() [2/2]

int Dtk_mesh_face::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 
)

Add one triangle strip and the corresponding vertices.

Parameters
[in]inIndices: Array of indices. Must be at least 3.
[in]inVertices: Array of vertices. They will be added into the mesh. inIndices values are indices of this table
[in]inNormals: Array of normals (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inColors: Array of RGBcolors (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inU: Array of u params (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inV: Array of v params (or NULL is not specified). If specified, size must be the same than inVertices.
Returns
return 0 if ok, other value if fails.

◆ add_triangles() [1/3]

int Dtk_mesh_face::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 
)

Add one of multiple triangles and the corresponding vertices.

Parameters
[in]inIndices: Array of indices. Must be a multiple of 3. This will add arraysize/3 triangles.
[in]inVertices: Array of vertices. They will be added into the mesh. inIndices values are indices of this table
[in]inNormals: Array of normals (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inColors: Array of RGBcolors (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inU: Array of u params (or NULL is not specified). If specified, size must be the same than inVertices.
[in]inV: Array of v params (or NULL is not specified). If specified, size must be the same than inVertices.
Returns
return 0 if ok, other value if fails.

◆ add_triangles() [2/3]

int Dtk_mesh_face::add_triangles ( const Dtk_UInt32 inIndices,
Dtk_Size_t  nb 
)

◆ add_triangles() [3/3]

int Dtk_mesh_face::add_triangles ( Dtk_tab< Dtk_UInt32 > *  inIndices)

Add one of multiple triangles.

On this form, indices MUST match an existing vertex inside Dtk_Mesh class

Parameters
[in]inIndices: Array of indices. Must be a multiple of 3. This will add arraysize/3 triangles
Returns
return 0 if ok, other value if fails.

◆ compute_bb()

int Dtk_mesh_face::compute_bb ( Dtk_pnt min,
Dtk_pnt max 
)

Compute the mesh Bounding Box.

Parameters
[out]min,max: computed extrem points of the boundig box
Returns
return 0 if ok

◆ compute_bb_center()

int Dtk_mesh_face::compute_bb_center ( Dtk_pnt i)

Compute the mesh Bounding Box.

Parameters
[out]in: computed center point of the boundig box
Returns
return 0 if ok

◆ compute_round_normals()

int Dtk_mesh_face::compute_round_normals ( )

Compute round normals from geometry.

Warning
Can alter vertex_format
Returns
return 0 if ok, 1 if error

◆ Create()

static Dtk_mesh_facePtr Dtk_mesh_face::Create ( const Dtk_mesh_face inToBeCopied)
static

Copy constructor.

Parameters
inToBeCopiedObject to copy.

◆ DtkDynamicCast()

static Dtk_mesh_face* Dtk_mesh_face::DtkDynamicCast ( Dtk_Object s)
static

Performs a dynamic cast - doesn't need RTTI -.

◆ DtkDynamicType() [1/2]

Dtk_Int32 Dtk_mesh_face::DtkDynamicType ( const Dtk_Int32 inId)

Retrieves the dynamic entity type.

◆ DtkDynamicType() [2/2]

◆ dump()

virtual void Dtk_Object::dump ( FILE *  file = stdout)
virtualinherited

◆ explode() [1/2]

int Dtk_mesh_face::explode ( )

Decompose all complex geometry (triangle strips, fan, polygons) into triangles, and append it into the internal triangle array.

Note that mockup decomposition is not yet supported.

Returns
return 0 if ok

◆ explode() [2/2]

int Dtk_mesh_face::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 triangles, and append it into the internal triangle array.

Note that mockup decomposition is not yet supported.

Returns
return 0 if ok

◆ get_face_color()

Dtk_RGB Dtk_mesh_face::get_face_color ( )

Return the RGB face color.

◆ get_face_icolor()

int Dtk_mesh_face::get_face_icolor ( )

Return the RGB face color (indice)

◆ get_face_name()

Dtk_string Dtk_mesh_face::get_face_name ( )

Get a name for the face.

◆ get_face_normal()

Dtk_dir Dtk_mesh_face::get_face_normal ( )

Some interfaces need to keep a normal for a specific type of face. Use this to retrieve a global face normal.

◆ get_face_type()

DTK_MESH_TYPE_FACE Dtk_mesh_face::get_face_type ( )

Return the current face type.

◆ get_id()

int Dtk_mesh_face::get_id ( )

Return the face Id.

◆ get_mesh()

Dtk_mesh* Dtk_mesh_face::get_mesh ( )

◆ get_mesh_circle_data()

Dtk_mesh_circle_data Dtk_mesh_face::get_mesh_circle_data ( )

Return the mesh_circle_data of the current face. If it doesn't exist, NULL is returned.

◆ get_mockup_indices()

const Dtk_tab<Dtk_tab<Dtk_UInt32> >* Dtk_mesh_face::get_mockup_indices ( Dtk_Size_t  inI) const

Get inI-th mockup.

Returns
return an array of indices.

◆ get_mockup_normal()

Dtk_dir Dtk_mesh_face::get_mockup_normal ( Dtk_Size_t  inI) const

◆ get_nb_facets()

Dtk_Size_t Dtk_mesh_face::get_nb_facets ( )

Compute all facets (triangles) holded by the class, including trianglestrips, fans, polygons.

Returns
Number of facets

◆ get_nb_vertices()

Dtk_Size_t Dtk_mesh_face::get_nb_vertices ( int  inOnce = 1)

Compute the total number of vertices used in the face.

Parameters
[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.
Returns
return an array of indices.

◆ get_nbmockups()

Dtk_Size_t Dtk_mesh_face::get_nbmockups ( ) const

Get the number of mockups kept in the class instance.

Returns
return Number of mockups

◆ get_nbpoints()

Dtk_Size_t Dtk_mesh_face::get_nbpoints ( ) const

◆ get_nbpolygons()

Dtk_Size_t Dtk_mesh_face::get_nbpolygons ( ) const

Get the number of polygons kept in the class instance.

Returns
return Number of polygons

◆ get_nbpolylines()

Dtk_Size_t Dtk_mesh_face::get_nbpolylines ( ) const

Get the number of polylines kept in the class instance.

Returns
return Number of polylines

◆ get_nbsubinfos()

Dtk_Size_t Dtk_mesh_face::get_nbsubinfos ( ) const

◆ get_nbtriangle_fans()

Dtk_Size_t Dtk_mesh_face::get_nbtriangle_fans ( ) const

Get the number of triangle fans kept in the class instance.

Parameters
[in]inI: indice of the triangle fan to get.
Returns
return Number of triangle fans

◆ get_nbtriangle_strips()

Dtk_Size_t Dtk_mesh_face::get_nbtriangle_strips ( ) const

Get the number of triangle strips kept in the class instance.

Returns
return Number of triangle strips

◆ get_nbtriangles()

Dtk_Size_t Dtk_mesh_face::get_nbtriangles ( ) const

Get the number of simple triangles kept in the class instance.

Returns
return Number of triangles

◆ get_point_indice()

Dtk_UInt32 Dtk_mesh_face::get_point_indice ( Dtk_Size_t  inI) const

◆ get_polygon_indices()

const Dtk_tab<Dtk_UInt32>* Dtk_mesh_face::get_polygon_indices ( Dtk_Size_t  inI) const

Get inI-th polygon.

Parameters
[in]inI: indice of the polygon to get.
Returns
return an array of indices.

◆ get_polygon_normal()

Dtk_dir Dtk_mesh_face::get_polygon_normal ( Dtk_Size_t  inI) const

◆ get_polyline_indices()

const Dtk_tab<Dtk_UInt32>* Dtk_mesh_face::get_polyline_indices ( Dtk_Size_t  inI) const

Get inI-th polygon.

Parameters
[in]inI: indice of the polygon to get.
Returns
return an array of indices.

◆ get_subinfo() [1/2]

Dtk_InfoPtr& Dtk_mesh_face::get_subinfo ( Dtk_Size_t  inI)

◆ get_subinfo() [2/2]

const Dtk_InfoPtr& Dtk_mesh_face::get_subinfo ( Dtk_Size_t  inI) const

◆ get_triangle_fan_indices()

const Dtk_tab<Dtk_UInt32>* Dtk_mesh_face::get_triangle_fan_indices ( Dtk_Size_t  inI) const

Get inI-th triangle fan.

Returns
return an array of indices.

◆ get_triangle_indices()

const Dtk_UInt32* Dtk_mesh_face::get_triangle_indices ( Dtk_Size_t  inI) const

Get pointer of triangle indices of i-th triangle.

Parameters
[in]inI: triangle to get (use get_nbtriangles to see how many triangles there is)

Use the result as an array (check example below) Sample:

const Dtk_UInt32* t = get_triangle_indices(5); // get the 5th triangle indices
printf("indices are : %d %d %d\n",t[0],t[1],t[2]);
Returns
return Number of triangles

◆ get_triangle_normal()

Dtk_dir Dtk_mesh_face::get_triangle_normal ( Dtk_Size_t  inI) const

Get the center normal of the inI-th triangle.

Parameters
[in]inI: triangle to get (use get_nbtriangles to see how many triangles there is)
Returns
the normal of the triangle .

◆ get_triangle_strip_indices()

const Dtk_tab<Dtk_UInt32>* Dtk_mesh_face::get_triangle_strip_indices ( Dtk_Size_t  inI) const

Get inI-th triangle strip.

Parameters
[in]inI: indice of the triangle strip to get.
Returns
return an array of indices.

◆ get_triangle_vertex()

Dtk_pnt Dtk_mesh_face::get_triangle_vertex ( Dtk_Size_t  inI,
Dtk_Size_t  inV 
) const

Get the V-th vertex of the inI-th triangle.

Parameters
[in]inI: triangle to get (use get_nbtriangles to see how many triangles there is)
[in]inV: Vertex to get (0, 1 or 2)
Returns
The vertex.

◆ GetSize()

virtual Dtk_Size_t Dtk_mesh_face::GetSize ( ) const
virtual

Reimplemented from Dtk_Object.

◆ info() [1/2]

Dtk_InfoPtr& Dtk_mesh_face::info ( )

acces to class info of mesh_face

◆ info() [2/2]

const Dtk_InfoPtr& Dtk_mesh_face::info ( ) const

acces to class info of mesh_face

◆ makestrips()

int Dtk_mesh_face::makestrips ( )

◆ merge()

void Dtk_mesh_face::merge ( Dtk_mesh_face inMeshface)

Merge a face into the current face.

Parameters
[in]inMeshface: Mesh face to append to the current face.

◆ reduce()

void Dtk_mesh_face::reduce ( )

Reduce memory cost of the Dtk_mesh, to call after adding all geometry.

The Dtk_mesh class hold internal containers that keep more memory not to reallocate each data enqueuing (like reserve of a std::vector)

This function remove all reserves to free some useless memory

◆ reserve_polylines()

void Dtk_mesh_face::reserve_polylines ( Dtk_Size_t  nb)

◆ reserve_triangle_strip()

int Dtk_mesh_face::reserve_triangle_strip ( Dtk_Size_t  nb)

◆ reverse_triangle()

void Dtk_mesh_face::reverse_triangle ( Dtk_Size_t  inI)

Reverse the i-th triangle of the set of triangle, so that the normal will be inversed.

Parameters
[in]inI: triangle to reverse (use get_nbtriangles to see how many triangles there is)

◆ set_face_color()

void Dtk_mesh_face::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.

Parameters
inColor: RGB color

◆ set_face_icolor()

void Dtk_mesh_face::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.

Parameters
inColor: indice of a RGB color

◆ set_face_name()

void Dtk_mesh_face::set_face_name ( const Dtk_string inName)

Set a name for the face.

Parameters
inName: Name to set.

◆ set_face_normal()

void Dtk_mesh_face::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 normal.

◆ set_face_type()

void Dtk_mesh_face::set_face_type ( DTK_MESH_TYPE_FACE  inType)

Set a face type.

Parameters
inType: face type. Can be DTK_MESH_CYLINDER, DTK_MESH_PLANE or DTK_MESH_OTHERSRF

◆ set_id()

void Dtk_mesh_face::set_id ( int  inId)

Set an Id to the face.

Parameters
inId: set an Id to the face

◆ set_mesh_circle_data()

void Dtk_mesh_face::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)

Parameters
inCircleA Dtk_mesh_circle_data object, filled.

Friends And Related Function Documentation

◆ Dtk_mesh

friend class Dtk_mesh
friend

◆ Dtk_SmartPtr< Dtk_mesh_face >

friend class Dtk_SmartPtr< Dtk_mesh_face >
friend

Field Documentation

◆ _infos

Dtk_InfoPtr Dtk_mesh_face::_infos
protected

◆ count_

unsigned long Dtk_Object::count_
protectedinherited

◆ mesh

Dtk_mesh* Dtk_mesh_face::mesh
protected

◆ mockup

Dtk_tab<Dtk_tab<Dtk_tab<Dtk_UInt32> > > Dtk_mesh_face::mockup
protected

◆ points

Dtk_tab<Dtk_UInt32> Dtk_mesh_face::points
protected

◆ polygons

Dtk_tab<Dtk_tab<Dtk_UInt32> > Dtk_mesh_face::polygons
protected

◆ polylines

Dtk_tab<Dtk_tab<Dtk_UInt32> > Dtk_mesh_face::polylines
protected

◆ subinfos

Dtk_tab<Dtk_InfoPtr> Dtk_mesh_face::subinfos
protected

◆ triangles

Dtk_tab<Dtk_UInt32> Dtk_mesh_face::triangles
protected

◆ trifans

Dtk_tab<Dtk_tab<Dtk_UInt32> > Dtk_mesh_face::trifans
protected

◆ tristrips

Dtk_tab<Dtk_tab<Dtk_UInt32> > Dtk_mesh_face::tristrips
protected
DTK_TYPE_MESH_FACE
@ DTK_TYPE_MESH_FACE
Definition: define.h:537
Dtk_mesh_face::_typeID
@ _typeID
Definition: util_mesh_dtk.hpp:875
Dtk_UInt32
uint32_t Dtk_UInt32
Definition: define.h:688
DTK_TYPE_OBJECT
@ DTK_TYPE_OBJECT
Definition: define.h:464
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_Object::_typeID
@ _typeID
Definition: dtk_object.hpp:13