Vertex on Face

How can we create a vertex in the middle (or thegeometrical isobarycentre) of a Face and recuperate its coordinates?

Thomas Moreau's picture

Use the same way as before with methods:

GeomSurface::Bounds (Standard_Real& U1, Standard_Real& U2,Standard_Real& V1,Standard_Real& V2)

GeomSurface::Value((U1+U2)/2.0, (V1+V2)/2.0)

Sarah Benoliel's picture

Thanx for your answers!

We tried to implement the given functions: (We have a Face S) F = TopoDS::Face(S); surfaceSBFC = BRep_Tool::Surface(F); surfaceSBFC->Bounds(U1, U2, V1, V2); Milieu = surfaceSBFC->Value((U1+U2)/2.0, (V1+V2)/2.0);

But, when we create a box, the result of these functions applicated to one Face of this Box, is the centre of the infinite geometrical plane on which the Face is constructed, and not the middle of the Face (limited by its Wire). How can we correct this?

Thomas Moreau's picture

It's true. Some surfaces are bounded (for example bezier, bspline), others surfaces are not bounded (for example a plane). In this case, you should compute the face parameters from its wire.

For that, have a look at the package BRep_Tool. There are differents possibilities for you:




In your case, you can get the needed parameters from your 4 vertex of your plane (3 are enough) using BRep_Tool::Parameters().

I hope it will be helpful.

Regards, Thomas

Maxim ZVEREV's picture


You can use method BRepTools::UVBounds(aFace, Umin,Vmin,Umax,Vmax) to obtain UV bounds of your face (not the surface!). When you use aSurf->Bounds you always obtain UV bounds of the SURFACE, which of coarse, can be infinite. But what you need is to obtain UV bounds of the FACE, and above method will return exactly what you want.

Best regards,