Hide menu
cadex::ModelAlgo_BRepMesherParameters Class Reference

Defines parameters used by the B-Rep mesher. More...

Public Types

enum  Granularity { Coarse, Medium, Fine, Custom }
 Defines target accuracy of the mesh to be generated. More...
 
enum  TriangulatorVersion { V1 = 1, V2 = 2, V3 = 3 }
 Defines the version of the triangulator used by visualization mesher. More...
 

Public Member Functions

 ModelAlgo_BRepMesherParameters (Granularity theGranularity=Fine, bool theMergeFaceSets=true)
 Constructor. More...
 
 ModelAlgo_BRepMesherParameters (const ModelAlgo_BRepMesherParameters &theOther)
 Constructor. More...
 
void SetGranularity (Granularity theVal)
 Sets mesh granularity policy. More...
 
Granularity GetGranularity () const
 Returns a granularity value. More...
 
void SetChordalDeflection (double theValue)
 Sets chordal deflection. More...
 
double ChordalDeflection () const
 Returns chordal deflection. More...
 
void SetIsRelativeChordalDeflection (bool theValue)
 Sets if ChordalDeflection() contains an absolute or relative value. More...
 
bool IsRelativeChordalDeflection () const
 Returns whether ChordalDeflection() contains an absolute or relative value. More...
 
void SetMaxEdgeLength (double theValue)
 Sets maximum length of triangle's edges. More...
 
double MaxEdgeLength () const
 Returns maximum length of triangle's edges. More...
 
void SetIsRelativeMaxEdgeLength (bool theValue)
 Sets if MaxEdgeLength() contains an absolute or relative value. More...
 
bool IsRelativeMaxEdgeLength () const
 Returns whether MaxEdgeLength() contains an absolute or relative value. More...
 
void SetAngularDeflection (double theValue)
 Sets angular deflection. More...
 
double AngularDeflection () const
 Returns angular deflection. More...
 
void SetTriangulatorVersion (TriangulatorVersion theValue)
 Sets an internal version of the triangulator. More...
 
TriangulatorVersion GetTriangulatorVersion () const
 Returns an internal version of the triangulator. More...
 
bool MergeFaceSets () const
 Returns true if the triangle sets from B-Rep faces should be merged. More...
 
bool & MergeFaceSets ()
 Returns true if the triangle sets from B-Rep faces should be merged. More...
 
bool GenerateFaceMeshAssociations () const
 Returns true if associations between faces and meshes should be generated. More...
 
bool & GenerateFaceMeshAssociations ()
 Returns true if associations between faces and meshes should be generated. More...
 
bool GetUVCoordinates () const
 Returns true if the UV coordinates on B-Rep faces should be retrieved during mesh generation. More...
 
bool & GetUVCoordinates ()
 Returns true if the UV coordinates on B-Rep faces should be retrieved during mesh generation. More...
 
bool PreserveVisualizationMesh () const
 Returns true if the existing visualization mesh must be preserved before using a computational mesher. More...
 
bool & PreserveVisualizationMesh ()
 Returns true if the existing visualization mesh must be preserved before using a computational mesher. More...
 
const internal::Base_MeshAlgoFactory & ComputationalMeshAlgo () const
 Returns a computational mesher algorithm. More...
 
internal::Base_MeshAlgoFactory & ComputationalMeshAlgo ()
 Sets a computational mesher algorithm. More...
 
ModelAlgo_BRepMesherParametersoperator= (const ModelAlgo_BRepMesherParameters &theOther)
 Assigment operator. More...
 
internal::ModelAlgo_BRepMesherParametersImpl * Impl () const
 Returns an implementation object (reserved for internal use).
 

Detailed Description

Defines parameters used by the B-Rep mesher.

Contains parameters used by the visualization mesher and optionally a reference to the computational mesher (see SetComputationalMeshAlgo() and ComputationalMeshAlgo()).

Parameters can be set to and retrieved from the mesher using ModelAlgo_BRepMesher::Parameters().

Examples
meshing/lods/main.cxx, meshing/mefisto/main.cxx, meshing/netgen/main.cxx, and meshing/visualizationmesher/main.cxx.

Member Enumeration Documentation

◆ Granularity

Defines target accuracy of the mesh to be generated.

Defines pre-defined values for chordal and angular deflections:

  Fine Medium Coarse
chordal deflection 0.004 (0.4%) 0.01 (1%) 0.05 (5%)
angular deflection 20 degrees 45 degrees 60 degrees

The pre-defined values are applied when invoking ModelAlgo_BRepMesherParameters::SetGranularity().

Chordal and angular deflections can also be set to explicitly specified values using ModelAlgo_BRepMesherParameters::SetChordalDeflection() and ModelAlgo_BRepMesherParameters::SetAngularDeflection() methods.

◆ TriangulatorVersion

Defines the version of the triangulator used by visualization mesher.

Version V1 (default) is generally faster and produces fewer triangles, V2 sometimes produces more accurate mesh but runs slower.

Constructor & Destructor Documentation

◆ ModelAlgo_BRepMesherParameters() [1/2]

cadex::ModelAlgo_BRepMesherParameters::ModelAlgo_BRepMesherParameters ( Granularity  theGranularity = Fine,
bool  theMergeFaceSets = true 
)

Constructor.

Sets default parameter values according to theGranularity.

See also
SetGranularity().

◆ ModelAlgo_BRepMesherParameters() [2/2]

cadex::ModelAlgo_BRepMesherParameters::ModelAlgo_BRepMesherParameters ( const ModelAlgo_BRepMesherParameters theOther)

Constructor.

Copies values from theOther (does not share internal implementation object).

Member Function Documentation

◆ AngularDeflection()

double cadex::ModelAlgo_BRepMesherParameters::AngularDeflection ( ) const

Returns angular deflection.

See also
SetAngularDeflection().

◆ ChordalDeflection()

double cadex::ModelAlgo_BRepMesherParameters::ChordalDeflection ( ) const

Returns chordal deflection.

Returns a relative or absolute value of the chordal deflection depending on the value returned by IsRelativeChordalDeflection().

See also
SetChordalDeflection().

◆ ComputationalMeshAlgo() [1/2]

internal::Base_MeshAlgoFactory & cadex::ModelAlgo_BRepMesherParameters::ComputationalMeshAlgo ( )

Sets a computational mesher algorithm.

See also
ComputationalMeshAlgo().

◆ ComputationalMeshAlgo() [2/2]

const internal::Base_MeshAlgoFactory & cadex::ModelAlgo_BRepMesherParameters::ComputationalMeshAlgo ( ) const

Returns a computational mesher algorithm.

By default returns a null object (see Base_MeshAlgoFactory::IsNull()).

Examples
meshing/mefisto/main.cxx, and meshing/netgen/main.cxx.

◆ GenerateFaceMeshAssociations() [1/2]

bool & cadex::ModelAlgo_BRepMesherParameters::GenerateFaceMeshAssociations ( )

Returns true if associations between faces and meshes should be generated.

By default returns false. If the value is set to true, then it will be possible to acquire a triangulation of a given Face from generated PolyRepresentation by calling to ModelData_PolyRepresentation::Triangulation() method.

◆ GenerateFaceMeshAssociations() [2/2]

bool cadex::ModelAlgo_BRepMesherParameters::GenerateFaceMeshAssociations ( ) const

Returns true if associations between faces and meshes should be generated.

By default returns false. If the value is set to true, then it will be possible to acquire a triangulation of a given Face from generated PolyRepresentation by calling to ModelData_PolyRepresentation::Triangulation() method.

◆ GetGranularity()

ModelAlgo_BRepMesherParameters::Granularity cadex::ModelAlgo_BRepMesherParameters::GetGranularity ( ) const

Returns a granularity value.

See also
SetGranularity().

◆ GetTriangulatorVersion()

ModelAlgo_BRepMesherParameters::TriangulatorVersion cadex::ModelAlgo_BRepMesherParameters::GetTriangulatorVersion ( ) const

Returns an internal version of the triangulator.

See also
TriangulatorVersion, SetTriangulatorVersion().

◆ GetUVCoordinates() [1/2]

bool & cadex::ModelAlgo_BRepMesherParameters::GetUVCoordinates ( )

Returns true if the UV coordinates on B-Rep faces should be retrieved during mesh generation.

This option is only taken into account if MergeFaceSets() is false. It is only used for visualization mesher and ignored for computational meshers.

If the value is set to true then UV coordinates of mesh nodes in parametric space domain of each B-Rep surface will be stored after mesh generation and can be accessed via ModelData_IndexedTriangleSet::UVCoordinate().

The default value is false.

For more details on retrieving UV coordinates refer to UV coordinates retrieval.

◆ GetUVCoordinates() [2/2]

bool cadex::ModelAlgo_BRepMesherParameters::GetUVCoordinates ( ) const

Returns true if the UV coordinates on B-Rep faces should be retrieved during mesh generation.

This option is only taken into account if MergeFaceSets() is false. It is only used for visualization mesher and ignored for computational meshers.

If the value is set to true then UV coordinates of mesh nodes in parametric space domain of each B-Rep surface will be stored after mesh generation and can be accessed via ModelData_IndexedTriangleSet::UVCoordinate().

The default value is false.

For more details on retrieving UV coordinates refer to UV coordinates retrieval.

◆ IsRelativeChordalDeflection()

bool cadex::ModelAlgo_BRepMesherParameters::IsRelativeChordalDeflection ( ) const

Returns whether ChordalDeflection() contains an absolute or relative value.

See also
SetIsRelativeChordalDeflection().

◆ IsRelativeMaxEdgeLength()

bool cadex::ModelAlgo_BRepMesherParameters::IsRelativeMaxEdgeLength ( ) const

Returns whether MaxEdgeLength() contains an absolute or relative value.

See also
SetIsRelativeMaxEdgeLength().

◆ MaxEdgeLength()

double cadex::ModelAlgo_BRepMesherParameters::MaxEdgeLength ( ) const

Returns maximum length of triangle's edges.

Returns a relative or absolute value of the maximum length of triangle's edges depending on the value returned by IsRelativeMaxEdgeLength().

See also
SetMaxEdgeLength().

◆ MergeFaceSets() [1/2]

bool & cadex::ModelAlgo_BRepMesherParameters::MergeFaceSets ( )

Returns true if the triangle sets from B-Rep faces should be merged.

The value is specified in the constructor and by default is true.

If the value is set to true then triangulations generated for B-Rep faces (ModelData_Face) in solid and sheet bodies will be merged, thereby providing water-tight topologically connected mesh (e.g. mesh nodes along face boundaries will be shared by triangles).

If the value is set to false then triangulations will be geometrically coincident but topologically disconnected, i.e. mesh nodes along face boundaries will be equal but will be duplicated in array of vertices.

Setting this value to false improves performance but slightly increases memory footprint (due to node duplication) and loses topological connectivity information.

◆ MergeFaceSets() [2/2]

bool cadex::ModelAlgo_BRepMesherParameters::MergeFaceSets ( ) const

Returns true if the triangle sets from B-Rep faces should be merged.

The value is specified in the constructor and by default is true.

If the value is set to true then triangulations generated for B-Rep faces (ModelData_Face) in solid and sheet bodies will be merged, thereby providing water-tight topologically connected mesh (e.g. mesh nodes along face boundaries will be shared by triangles).

If the value is set to false then triangulations will be geometrically coincident but topologically disconnected, i.e. mesh nodes along face boundaries will be equal but will be duplicated in array of vertices.

Setting this value to false improves performance but slightly increases memory footprint (due to node duplication) and loses topological connectivity information.

◆ operator=()

ModelAlgo_BRepMesherParameters & cadex::ModelAlgo_BRepMesherParameters::operator= ( const ModelAlgo_BRepMesherParameters theOther)

Assigment operator.

Copies data from theOther to this. Makes a deep copy of the parameters.

◆ PreserveVisualizationMesh() [1/2]

bool & cadex::ModelAlgo_BRepMesherParameters::PreserveVisualizationMesh ( )

Returns true if the existing visualization mesh must be preserved before using a computational mesher.

By default returns true. If the value is set to false, then the visualization mesh will always be regenerated before generating a computational mesh. The value is ignored when computing a visualization mesh.

See also
ComputationalMeshAlgo().

◆ PreserveVisualizationMesh() [2/2]

bool cadex::ModelAlgo_BRepMesherParameters::PreserveVisualizationMesh ( ) const

Returns true if the existing visualization mesh must be preserved before using a computational mesher.

By default returns true. If the value is set to false, then the visualization mesh will always be regenearted before generating a computational mesh. The value is ignored when computing a visualization mesh.

See also
ComputationalMeshAlgo().

◆ SetAngularDeflection()

void cadex::ModelAlgo_BRepMesherParameters::SetAngularDeflection ( double  theValue)

Sets angular deflection.

Specifies a maximum deviation (in radians) between tangents at two adjacent mesh nodes when tessellating an edge curve or between normals when tessellating a face surface.

Default value in radians is equal to 20 degrees.

Sets granularity to Custom.

Examples
meshing/visualizationmesher/main.cxx.

◆ SetChordalDeflection()

void cadex::ModelAlgo_BRepMesherParameters::SetChordalDeflection ( double  theValue)

Sets chordal deflection.

Specifies either a value relative to the body bounding box (if IsRelativeChordalDeflection() is true) or an absolute value of the maximum deflection of the visualization mesh.

Chordal deflection is basically a deviation of the triangles from the original surfaces or curves. Default value is 0.004 (0.4%) for IsRelativeChordalDeflection() true.

Note that in some cases the algorithm can produce more coarse triangulation.

Sets granularity to Custom.

See also
ChordalDeflection().
Examples
meshing/visualizationmesher/main.cxx.

◆ SetGranularity()

void cadex::ModelAlgo_BRepMesherParameters::SetGranularity ( Granularity  theVal)

Sets mesh granularity policy.

If theVal is Custom then does nothing.

Otherwise sets chordal and angular deflections according to the specified granularity value. Refer to the table in the description of the Granularity type. IsRelativeChordalDeflection() is set to true.

See also
GetGranularity().

◆ SetIsRelativeChordalDeflection()

void cadex::ModelAlgo_BRepMesherParameters::SetIsRelativeChordalDeflection ( bool  theValue)

Sets if ChordalDeflection() contains an absolute or relative value.

Specifies whether ChordalDeflection() contains an absolute (if false) or a relative to the shape bounding box (if true, by default) value of the deflection.

Sets granularity to Custom.

See also
IsRelativeChordalDeflection()

◆ SetIsRelativeMaxEdgeLength()

void cadex::ModelAlgo_BRepMesherParameters::SetIsRelativeMaxEdgeLength ( bool  theValue)

Sets if MaxEdgeLength() contains an absolute or relative value.

Specifies whether MaxEdgeLength() contains an absolute (if false, by default) or a relative to the shape bounding box (if true) value of the maximum length of triangle's edges.

Sets granularity to Custom.

See also
IsRelativeMaxEdgeLength()

◆ SetMaxEdgeLength()

void cadex::ModelAlgo_BRepMesherParameters::SetMaxEdgeLength ( double  theValue)

Sets maximum length of triangle's edges.

Specifies either a value relative to the body bounding box (if IsRelativeMaxEdgeLength() is true) or an absolute value of the maximum length of triangle's edges of the visualization mesh.

This parameter sets an upper bound for edges length of triangles generated by visualization mesher.

Sets granularity to Custom.

See also
MaxEdgeLength().

◆ SetTriangulatorVersion()

void cadex::ModelAlgo_BRepMesherParameters::SetTriangulatorVersion ( TriangulatorVersion  theValue)

Sets an internal version of the triangulator.

See also
TriangulatorVersion, GetTriangulatorVersion().