Open CASCADE Technology  7.7.0
Data Structures | Public Member Functions | Static Public Member Functions
Poly_MergeNodesTool Class Reference

Auxiliary tool for merging triangulation nodes for visualization purposes. Tool tries to merge all nodes within input triangulation, but split the ones on sharp corners at specified angle. More...

#include <Poly_MergeNodesTool.hxx>

Inheritance diagram for Poly_MergeNodesTool:
Inheritance graph
[legend]

Public Member Functions

 Poly_MergeNodesTool (const double theSmoothAngle, const double theMergeTolerance=0.0, const int theNbFacets=-1)
 Constructor. More...
 
double MergeTolerance () const
 Return merge tolerance; 0.0 by default (only 3D points with exactly matching coordinates are merged). More...
 
void SetMergeTolerance (double theTolerance)
 Set merge tolerance. More...
 
double MergeAngle () const
 Return merge angle in radians; 0.0 by default (normals with non-exact directions are not merged). More...
 
void SetMergeAngle (double theAngleRad)
 Set merge angle. More...
 
bool ToMergeOpposite () const
 Return TRUE if nodes with opposite normals should be merged; FALSE by default. More...
 
void SetMergeOpposite (bool theToMerge)
 Set if nodes with opposite normals should be merged. More...
 
void SetUnitFactor (double theUnitFactor)
 Setup unit factor. More...
 
bool ToDropDegenerative () const
 Return TRUE if degenerate elements should be discarded; TRUE by default. More...
 
void SetDropDegenerative (bool theToDrop)
 Set if degenerate elements should be discarded. More...
 
bool ToMergeElems () const
 Return TRUE if equal elements should be filtered; FALSE by default. More...
 
void SetMergeElems (bool theToMerge)
 Set if equal elements should be filtered. More...
 
NCollection_Vec3< float > computeTriNormal () const
 Compute normal for the mesh element. More...
 
virtual void AddTriangulation (const Handle< Poly_Triangulation > &theTris, const gp_Trsf &theTrsf=gp_Trsf(), const Standard_Boolean theToReverse=false)
 Add another triangulation to created one. More...
 
Handle< Poly_TriangulationResult ()
 Prepare and return result triangulation (temporary data will be truncated to result size). More...
 
void AddTriangle (const gp_XYZ theElemNodes[3])
 Add new triangle. More...
 
void AddQuad (const gp_XYZ theElemNodes[4])
 Add new quad. More...
 
void AddElement (const gp_XYZ *theElemNodes, int theNbNodes)
 Add new triangle or quad. More...
 
gp_XYZChangeElementNode (int theIndex)
 Change node coordinates of element to be pushed. More...
 
void PushLastElement (int theNbNodes)
 Add new triangle or quad with nodes specified by ChangeElementNode(). More...
 
void PushLastTriangle ()
 Add new triangle with nodes specified by ChangeElementNode(). More...
 
void PushLastQuad ()
 Add new quad with nodes specified by ChangeElementNode(). More...
 
Standard_Integer ElementNodeIndex (int theIndex) const
 Return current element node index defined by PushLastElement(). More...
 
int NbNodes () const
 Return number of nodes. More...
 
int NbElements () const
 Return number of elements. More...
 
int NbDegenerativeElems () const
 Return number of discarded degenerate elements. More...
 
int NbMergedElems () const
 Return number of merged equal elements. More...
 
Handle< Poly_Triangulation > & ChangeOutput ()
 Setup output triangulation for modifications. When set to NULL, the tool could be used as a merge map for filling in external mesh structure. More...
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object. More...
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
Standard_Boolean IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_Boolean IsKind (const Standard_CString theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 
void IncrementRefCounter () const
 Increments the reference counter of this object. More...
 
Standard_Integer DecrementRefCounter () const
 Decrements the reference counter of this object; returns the decremented value. More...
 

Static Public Member Functions

static Handle< Poly_TriangulationMergeNodes (const Handle< Poly_Triangulation > &theTris, const gp_Trsf &theTrsf, const Standard_Boolean theToReverse, const double theSmoothAngle, const double theMergeTolerance=0.0, const bool theToForce=true)
 Merge nodes of existing mesh and return the new mesh. More...
 
- Static Public Member Functions inherited from Standard_Transient
static const char * get_type_name ()
 Returns a type descriptor about this object. More...
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class. More...
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object. More...
 

Detailed Description

Auxiliary tool for merging triangulation nodes for visualization purposes. Tool tries to merge all nodes within input triangulation, but split the ones on sharp corners at specified angle.

Constructor & Destructor Documentation

◆ Poly_MergeNodesTool()

Poly_MergeNodesTool::Poly_MergeNodesTool ( const double  theSmoothAngle,
const double  theMergeTolerance = 0.0,
const int  theNbFacets = -1 
)

Constructor.

Parameters
[in]theSmoothAnglesmooth angle in radians or 0.0 to disable merging by angle
[in]theMergeTolerancenode merging maximum distance
[in]theNbFacetsestimated number of facets for map preallocation

Member Function Documentation

◆ AddElement()

void Poly_MergeNodesTool::AddElement ( const gp_XYZ theElemNodes,
int  theNbNodes 
)

Add new triangle or quad.

Parameters
[in]theElemNodeselement nodes
[in]theNbNodesnumber of element nodes, should be 3 or 4

◆ AddQuad()

void Poly_MergeNodesTool::AddQuad ( const gp_XYZ  theElemNodes[4])
inline

Add new quad.

Parameters
[in]theElemNodes4 element nodes

◆ AddTriangle()

void Poly_MergeNodesTool::AddTriangle ( const gp_XYZ  theElemNodes[3])
inline

Add new triangle.

Parameters
[in]theElemNodes3 element nodes

◆ AddTriangulation()

virtual void Poly_MergeNodesTool::AddTriangulation ( const Handle< Poly_Triangulation > &  theTris,
const gp_Trsf theTrsf = gp_Trsf(),
const Standard_Boolean  theToReverse = false 
)
virtual

Add another triangulation to created one.

Parameters
[in]theTristriangulation to add
[in]theTrsftransformation to apply
[in]theToReversereverse triangle nodes order

◆ ChangeElementNode()

gp_XYZ& Poly_MergeNodesTool::ChangeElementNode ( int  theIndex)
inline

Change node coordinates of element to be pushed.

Parameters
[in]theIndexnode index within current element, in 0..3 range

◆ ChangeOutput()

Handle< Poly_Triangulation >& Poly_MergeNodesTool::ChangeOutput ( )
inline

Setup output triangulation for modifications. When set to NULL, the tool could be used as a merge map for filling in external mesh structure.

◆ computeTriNormal()

NCollection_Vec3<float> Poly_MergeNodesTool::computeTriNormal ( ) const
inline

Compute normal for the mesh element.

◆ ElementNodeIndex()

Standard_Integer Poly_MergeNodesTool::ElementNodeIndex ( int  theIndex) const
inline

Return current element node index defined by PushLastElement().

◆ MergeAngle()

double Poly_MergeNodesTool::MergeAngle ( ) const
inline

Return merge angle in radians; 0.0 by default (normals with non-exact directions are not merged).

◆ MergeNodes()

static Handle< Poly_Triangulation > Poly_MergeNodesTool::MergeNodes ( const Handle< Poly_Triangulation > &  theTris,
const gp_Trsf theTrsf,
const Standard_Boolean  theToReverse,
const double  theSmoothAngle,
const double  theMergeTolerance = 0.0,
const bool  theToForce = true 
)
static

Merge nodes of existing mesh and return the new mesh.

Parameters
[in]theTristriangulation to add
[in]theTrsftransformation to apply
[in]theToReversereverse triangle nodes order
[in]theSmoothAnglemerge angle in radians
[in]theMergeTolerancelinear merge tolerance
[in]theToForcereturn merged triangulation even if it's statistics is equal to input one
Returns
merged triangulation or NULL on no result

◆ MergeTolerance()

double Poly_MergeNodesTool::MergeTolerance ( ) const
inline

Return merge tolerance; 0.0 by default (only 3D points with exactly matching coordinates are merged).

◆ NbDegenerativeElems()

int Poly_MergeNodesTool::NbDegenerativeElems ( ) const
inline

Return number of discarded degenerate elements.

◆ NbElements()

int Poly_MergeNodesTool::NbElements ( ) const
inline

Return number of elements.

◆ NbMergedElems()

int Poly_MergeNodesTool::NbMergedElems ( ) const
inline

Return number of merged equal elements.

◆ NbNodes()

int Poly_MergeNodesTool::NbNodes ( ) const
inline

Return number of nodes.

◆ PushLastElement()

void Poly_MergeNodesTool::PushLastElement ( int  theNbNodes)

Add new triangle or quad with nodes specified by ChangeElementNode().

◆ PushLastQuad()

void Poly_MergeNodesTool::PushLastQuad ( )
inline

Add new quad with nodes specified by ChangeElementNode().

◆ PushLastTriangle()

void Poly_MergeNodesTool::PushLastTriangle ( )
inline

Add new triangle with nodes specified by ChangeElementNode().

◆ Result()

Handle< Poly_Triangulation > Poly_MergeNodesTool::Result ( )

Prepare and return result triangulation (temporary data will be truncated to result size).

◆ SetDropDegenerative()

void Poly_MergeNodesTool::SetDropDegenerative ( bool  theToDrop)
inline

Set if degenerate elements should be discarded.

◆ SetMergeAngle()

void Poly_MergeNodesTool::SetMergeAngle ( double  theAngleRad)
inline

Set merge angle.

◆ SetMergeElems()

void Poly_MergeNodesTool::SetMergeElems ( bool  theToMerge)
inline

Set if equal elements should be filtered.

◆ SetMergeOpposite()

void Poly_MergeNodesTool::SetMergeOpposite ( bool  theToMerge)
inline

Set if nodes with opposite normals should be merged.

◆ SetMergeTolerance()

void Poly_MergeNodesTool::SetMergeTolerance ( double  theTolerance)
inline

Set merge tolerance.

◆ SetUnitFactor()

void Poly_MergeNodesTool::SetUnitFactor ( double  theUnitFactor)
inline

Setup unit factor.

◆ ToDropDegenerative()

bool Poly_MergeNodesTool::ToDropDegenerative ( ) const
inline

Return TRUE if degenerate elements should be discarded; TRUE by default.

◆ ToMergeElems()

bool Poly_MergeNodesTool::ToMergeElems ( ) const
inline

Return TRUE if equal elements should be filtered; FALSE by default.

◆ ToMergeOpposite()

bool Poly_MergeNodesTool::ToMergeOpposite ( ) const
inline

Return TRUE if nodes with opposite normals should be merged; FALSE by default.


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