(u,v) grid of a face extends beyond its edges

I have a face (Geom_BSplineSurface) and I want to draw points or lines in a sort of grid pattern inside that face.

I tried getting the bounds of the face and simply iterating through that (from min to max); I also tried creating iso lines (with ​ShapeAnalysis_Surface::UIso and VIso). In both cases, the grid goes beyond the limits of the face (see attached screenshot).

It seems like the face is trimmed somehow, but I can't figure out how to get information on that trim to get the proper u,v parameters to stay inbounds.

Also, if I have other types of faces, like Geom_CylindricalSurface, I simply cannot get the UV bounds, and I also want to get a grid of points in them. I would like a method to do that without having to treat each type of surface differently.

 

Any ideas?

Thank you,

 

Note: In the screenshot, the purple area is the triangulation of the face, and the yellow and cyan lines are ISO curves created with something like this:

ShapeAnalysis_Surface sas(surface);
 
double u1,u2,v1,v2;
sas.Bounds(u1,u2,v1,v2);
 
for (int i = 0; i <= 12; i++)
{
    Handle(Geom_Curve) curveU = sas.UIso(u1 + (u2-u1)*((double)i/12));

//...

//same thing with sas.VIso, using v1 and v2

 

Attachments: 
Forum supervisor's picture

Hello Samuel,

As you might know, Open CASCADE Technology implements Boundary Representation concept to describe 3D objects (shapes).

In this concept, boundary of a 3D object is defined by a set of shells composed of connected faces. In its turn, boundary of a face is described by a set of wires composed of connected edges.

That is, boundary of a face, in general case, is a complex set of contours, not just a simple rectangle in (u,v) space, and that should be taken into account building various points distributions on a face. Depending on the purpose, various methods can be recommended to build such points distribution.

For example, our CAM Library component provides Geodesic algorithm that can be used to compute equidistant contours in the domain of a face. Then, these contours can be sampled using algorithm that computes equidistant points along a curve.

You are welcome to contact us for further recommendations and offers.

Best regards,

Sergey