C++ Retrieve UV local coordinate from constrained-to-surface point?

Hi,

I’m retrieving a point constrained to a surface using CRhinoGetPoint::Constrain(). Is it possible to, besides the 3D coordinate, get its corresponding 2D value in parameter space?

Thanks,
Pablo

Hi @Pablo_Garcia-Amorena,

Once you have a 3d point, you can always calculate the closest 2d point using ON_Surface::GetClosestPoint.

Since your in a GetPoint getter, you can also do this:

CRhinoGetPoint gp;
// TODO....
gp.GetPoint();
if (gp.CommandResult() == CRhinoCommand::success)
{
  double u = ON_UNSET_VALUE, v = ON_UNSET_VALUE;
  if (gp.PointOnSurface(&u, &v))
  {
    // TODO....
  }
}

– Dale

Great! Thank you Dale.

Pablo