Hide menu
Loading...
Searching...
No Matches
cadex::ModelData_PolyRepresentation Class Reference

Defines polygonal (faceted or tessellated) representation of part. More...

#include <cadex/ModelData_PolyRepresentation.hxx>

Inheritance diagram for cadex::ModelData_PolyRepresentation:
cadex::ModelData_Representation cadex::ModelData_BaseObject

Classes

class  Provider
 Provides polygonal representation. More...
 

Public Types

typedef cadex::internal::ModelData_PolyRepresentationImpl ImplType
 
- Public Types inherited from cadex::ModelData_Representation
typedef cadex::internal::ModelData_RepresentationImpl ImplType
 
- Public Types inherited from cadex::ModelData_BaseObject
typedef int IdType
 Defines a type identifier.
 

Public Member Functions

 ModelData_PolyRepresentation ()
 Constructor.
 
 ModelData_PolyRepresentation (initialized)
 
 ModelData_PolyRepresentation (ImplType *theImpl)
 
 ModelData_PolyRepresentation (const ModelData_BRepRepresentation &theRef, const ModelAlgo_BRepMesherParameters &theParameters=ModelAlgo_BRepMesherParameters(), bool theComputeImmediately=false)
 
 ModelData_PolyRepresentation (const ModelData_PolyShape &theNode)
 
void Add (const ModelData_PolyShape &theShape)
 Adds a polygonal shape to the representation.
 
const ModelData_PolyShapeListGet () const
 Returns poly shapes comprising the representation.
 
void AddProvider (const std::shared_ptr< Provider > &theProvider)
 Adds a provider for polygonal data.
 
void Clear ()
 Discards associated data.
 
- Public Member Functions inherited from cadex::ModelData_Representation
 ModelData_Representation ()
 Constructor.
 
void Accept (ModelData_Part::RepresentationVisitor &theVisitor) const
 Accepts a representation visitor.
 
- Public Member Functions inherited from cadex::ModelData_BaseObject
 ModelData_BaseObject ()
 Constructor.
 
IdType TypeId () const
 Returns an object type id.
 
template<typename T >
bool IsOfType () const
 Returns true if the object has a type T.
 
void SetName (const Base_UTF16String &theName)
 Sets an object name.
 
Base_UTF16String Name () const
 
void SetUuid (const Base_Uuid &theUuid)
 
Base_Uuid Uuid () const
 
void Nullify ()
 Resets reference to implementation object.
 
bool IsNull () const
 Returns true if the object is nullified.
 
 operator bool () const
 Casts the object to the bool type.
 
internal::ModelData_BaseObjectImpl * Impl () const
 Return a handle to backend (reserved for internal use).
 

Static Public Member Functions

static IdType GetTypeId ()
 

Additional Inherited Members

- Protected Member Functions inherited from cadex::ModelData_Representation
 ModelData_Representation (internal::ModelData_BaseObjectImpl *theImpl)
 Constructor (reserved for internal use).
 
- Protected Member Functions inherited from cadex::ModelData_BaseObject
 ModelData_BaseObject (const internal::ModelData_BaseObjectImpl *theImpl)
 Constructor (reserved for internal use).
 
 ModelData_BaseObject (const internal::ModelData_BaseObjectImpl *theImpl, const Base_UTF16String &theName)
 Constructor (reserved for internal use).
 
template<typename T >
T * GetOrCreateImpl ()
 Reserved for internal use.
 

Detailed Description

Defines polygonal (faceted or tessellated) representation of part.

Polygonal representation contains an approximated (facetted or tessellated) description of a part (ModelData_Part). A part may have none, one or multiple polygonal representations. In the latter case, they are to considered to define multiple level of details (or LOD's) of the part.

Root Vertex Set List

Polygonal representation contains ModelData_PolyShapeList, which is a list of vertex sets (ModelData_PolyVertexSet), returned by the Get() method. The polygonal representation may contain one or multiple vertex sets, for instance having distinct appearance settings (although for a part having a single representation it is much more common to attach an appearance to the part itself). An example of explicit appearance attached to each vertex set is given below. In this case a part contains one polygonal representation which in its turn contains several triangle sets each holding its own color (green or orange):

Multiple triangle sets in one polygonal representation

The following example demonstrates how to iterate over root vertex sets:

ModelData_Part aPart = ...;
ModelData_PolyRepresentation aPoly = aPart.PolyRepresentation (ModelData_RM_Poly); //retrieve first (fine) poly
if (aPoly) {
const ModelData_PolyShapeList& aList = aPoly.Get(); //retrieve roots
for (ModelData_PolyShapeList::SizeType i = 0; i < aList.Size(); ++i) {
const ModelData_PolyVertexSet& aSet = aList[i];
//...
}
}
Defines a leaf node in the scene graph hiearchy.
Definition: ModelData_Part.hxx:35
ModelData_PolyRepresentation PolyRepresentation(ModelData_RepresentationMask theRepresentationMask) const
Definition: ModelData_Part.cxx:371
Defines polygonal (faceted or tessellated) representation of part.
Definition: ModelData_PolyRepresentation.hxx:39
const ModelData_PolyShapeList & Get() const
Returns poly shapes comprising the representation.
Definition: ModelData_PolyRepresentation.cxx:408
List of vertex sets contained in polygonal representation.
Definition: ModelData_PolyShapeList.hxx:33
Base class for particular vertex sets - triangle sets, polyline sets, point sets.
Definition: ModelData_PolyVertexSet.hxx:31

Polygonal Object Types

The following picture demonstrates each supported types:

Triangle set
ModelData_IndexedTriangleSet - a set of triangles
Polyline set
ModelData_PolyLineSet - a set of polylines
Point set
ModelData_PolyPointSet - a set of points

Creation

Bottom-up Creation

A polygonal representation is initially created with an empty list of vertex sets. Adding vertex sets is done with the help of ModelData_PolyRepresentation::Add() or provided in the constructor, for instance:

//invoke ModelData_IndexedTriangleSet API to populate the object...
ModelData_Part aPart (aPoly, "my_part");
Defines a polygonal shape consisting of triangles.
Definition: ModelData_IndexedTriangleSet.hxx:35

Each subclass of ModelData_PolyVertexSet provides API to construct the respective object bottom-up.

Generation from B-Rep representation

A polygonal representation can be created from a B-Rep representation with the help of visulization or computational meshers. Refer to Meshing for further details.

ModelAlgo_BRepMesher is used underneath to create a polygonal representation. It may also be used explicitly, for instance, to create polygonal representations for all parts which have B-Rep representations and do not have polygonal representations:

ModelData_Model aModel = ...;
ModelAlgo_BRepMesher aMesher (ModelAlgo_BRepMesherParameters::Fine);
aMesher.Compute (aModel);
Computes a polygonal representation from a B-Rep one.
Definition: ModelAlgo_BRepMesher.hxx:48
Provides CAD Exchanger data model.
Definition: ModelData_Model.hxx:43
See also
ModelData_BRepRepresentation, Polygonal Representation Example, Visualization Mesher Example.
Examples
MTKConverter/Program.cs, advgeom/meshsimplify/Program.cs, advgeom/meshsimplify/main.cxx, exploring/appearance/Program.cs, exploring/appearance/main.cxx, exploring/polyrepresentation/Program.cs, exploring/polyrepresentation/main.cxx, meshing/lods/Program.cs, meshing/lods/main.cxx, modeling/poly/Program.cs, modeling/poly/main.cxx, modification/coloring/Program.cs, modification/coloring/main.cxx, modification/renaming/Program.cs, modification/renaming/main.cxx, wall_thickness/visualization/Program.cs, and wall_thickness/visualization/main.cxx.

Constructor & Destructor Documentation

◆ ModelData_PolyRepresentation()

cadex::ModelData_PolyRepresentation::ModelData_PolyRepresentation ( )

Constructor.

If theToInitialize is false then creates a null object (see IsNull()).

Member Function Documentation

◆ Get()