Generating an Arbitrary Point on a Face

Is there a simple routine to generate an arbitrary point that is guaranteed to be on the surface of a face (within the restriction of the face)? Nothing in the API is leaping out at me.

Bearloga's picture

This task is hardly formalized (there can be many variants how to implement it with various performance and robustness). You need to write your own method that fits your needs. E.g., think of issuing a ray from a vertex to inside the face, intersect this ray with a boundary, and take some middle point.

Marco Balen's picture

Hello Spencer,

I think you can use the "GeomAPI_ProjectPointOnSurf" class. If your surface is a plane using this class you can get the "nearest point" inside the bound of the surface (if it is bounded).

Try a code like this :

gp_Pnt ThePoint=.....;
GeomAPI_ProjectPointOnSurf TheProjection(ThePoint, TheSurface);
if (TheProjection.NbPoints()) ThePoint=TheProjection.NearestPoint();

I hope this can help you

Bye

Evgeny Lodyzhehsky's picture

Dear Spencer Burton.

Try to have a look how it was made in visualisation classes of the Draw.
A face is visualized by means of iso-curves. These iso-curves lay down on surface of the face where there is a material of the face.
So, any point from any iso-curve of such kind will be that you want.