About BRepMesh::Discret

I want to use Discret to perform triangulation.
This is the argument list:
const Standard_Real defle,
const TopoDS_Shape& shape,
const Standard_Real angl,
const Standard_Boolean ws,
const Standard_Boolean inshape,
const Standard_Boolean relative,
const Standard_Boolean shapetrigu
Can anyone tell me the meanings of ws, inshape, shapetrigu.

And Here is my code:
Handle (BRepMesh_Discret) mesh = new BRepMesh_Discret(

but it can not be complied because "there is no constructor for this class" Can anyone tell me how to solve this problem.

Many thanks

Rob Bachrach's picture

ws stands for WithShare. This controls whether adjacent faces will use the same edge mesh. If WithShare is false, adjacent faces may be meshed differently at the shared edges (usually not desireable).

If relative is true, the size of the mesh on an edge will be scaled by the length of the edge (so smaller edges have smaller mesh edges).

If shapetrigu is true will reuse an existing triangulation on the shape, if possible, to generate the new triangulation.

The constructor you are calling for BRepMesh_Discret does exist (assuming asolid is a TopoDS_Shape). Is it possible that you are not including the right header files?

Hengxing Yang's picture

Thank you very much. Problem solved. And can you explain how the deflection changes the length of the edge?

Rob Bachrach's picture

The deflection only comes into play with curved edges and surfaces. It simply specifies the maximum distance between the mesh (edge or face) and the actual geometry. Just imagine the chord of a circle. The deflection is the distance between the chord and the perimeter of the circle. As deflection is increased, larger portions of the curve can be approximated as a straight line and larger portions of a curved surface can be approximated by a triangle. Therefore, larger values of deflection lead to larger edges on the mesh.

Hengxing Yang's picture

thank you again. I think that length of edges is not what I want to control. do you know how can I control the maximum length of edges of triangles.

Hengxing Yang's picture

I mean directly control the length of edges.

Rob Bachrach's picture

I don't believe it's possible with the supplied OCC meshers. You would probably need to either purchase a mesher like ExpressMesh from OCC or integrate a free mesher into your application like NETGEN.