2

I am looking for an easy way to compute the minimum distance of a point to a nurbs surface with matlab. I am looking for the closest point => not an orthogonal projection. I have read about the concept of sampling to get a start and then do newton iteration but at the time this exceeds my matlab powers. Thanks for help.

Sandra C.
  • 21
  • 2
  • " closest point => not an orthogonal projection" what do you mean? Still, I have the feeling this is too broad, as you are asking for a whole algorithm. You'd need to do some research yourself! – Ander Biguri Jan 16 '17 at 17:11
  • @AnderBiguri, the 1D equivalent: vertical distance from point to line vs. distance from point to closest point on the line. That is orthogonal projection vs closest point. For a surface you can imagine the same thing. – Wolfie Jan 16 '17 at 17:45
  • Those are the same thing, aren't they? The closest distance from line to a point is an orthogonal from the line passing trhough the point. This is true in 3D also. At least in Euclidean space – Ander Biguri Jan 16 '17 at 18:45
  • @AnderBiguri I think this is a terminology mash up... imagine you had a line between (0,0) and (1,5). Clearly the distance between (1,0) and (1,5) is 5, this is the vertical distance and what I think the OP means by orthogonal projection. The closest point would form a right angle between (0,0), itself and (1,0) on the line. The first is orthogonal to the coord system, second creates orthogonal lines – Wolfie Jan 16 '17 at 23:31
  • Maybe the OP means the distance to a patch, which may end up on a side or a corner, not orthogonally. –  Jan 18 '17 at 18:18

1 Answers1

2

I am looking for the closest point => not an orthogonal projection.

The closest point on the surface is an orthogonal projection of your point in space onto the surface. Orthogonal in the sense that the line connecting point and projection is perpendicular to the tangent plane of the surface at the projected point.

A NURBS surface is parametrized by two parameters u and v. You can also compute how the position changes as u resp. v changes. To do this you compute the partial differentials. You should get a pair of tangent vectors which span the tangent plane. Now you want the difference between point on the plane and point in space to be orthogonal to both these vectors, i.e. have dot product zero. Which means you'll obtain two equations, one for the u direction and one for the v direction, which will help you find the u and v parameters you need.

Note however that this system of equations is likely highly non-linear. So get some good computer algebra or numerics software to find all the solutions, then compute the distance for each of them to pick the minimal one.

MvG
  • 57,380
  • 22
  • 148
  • 276