Problem projecting points on BrepFace

Hello,

I am working on a script in C++ to project some points on a BrepFace. Right now, I am using the GetClosestPoint method of the ON_BrepFace class. However, this method is giving me wrong points on the surface (compared to the result obtained using the command Project directly on Rhino which is correct). Do you know why this difference could occur and how to overcome this problem?

Thanks in advance,

Andrés Uribe

ps: Here are some images explaining the problem

Hi Andrés,

There is a fundamental difference between projecting and finding the closest point.

The closest point is finding the point on a surface closest to the test point.

Projecting is finding the point on a surface by intersecting it with an infinite line through the point at a given direction.

image

I’m not sure if openNURBS has Point Projection functionality.

HTH
-Willem

for projecting I think you can use:
https://developer.rhino3d.com/api/cpp/class_o_n___ray_shooter.html

@Willem Thanks for your reply. Now it seems to be more clear. :slight_smile:

Hi @auribe,

The standalone openNURBS toolkit does not have the ability to project points onto surface, as this is a curve-surface intersection operation and the standalone toolkit does not include intersection calculations.

That said, if you writing a plug-in using the Rhino C/C++ SDK, then you can project points on to surfaces or Breps using RhinoProjectPointsToBreps. See rhinoSdkUtilities.h for details.

– Dale