<p>This is only a rough idea, though I hope it may inspire better answers.</p>

<p>The closest point on a surface is as far as I know always forms together with the red point a line that is orthogonal to the surface.</p>

<p>If you know which yellow vertices form the surface that the green point lies on, this is easy. You could just formulate the normal form of the surface (which is piecewise linear so it works out) formulate the orthogonal line to the surface that goes through the red point and solve for the intersection point. Though I don't have the exact math here, this step should be easy to look up.</p>

<p>Now the problem is: Which linear piece of your surface is the closest one.
Either you calculate the green-point candidates for all linear pieces and also the distance and take the closest one, or you find some other possibly faster way for this.
For that I don't have a more clever idea.</p>

CC BY-SA 3.0
2016-08-03T13:33:50.740Z
Yes, normal at witness point P must have same direction as vector S-P (where S is slave point, or red one on the picture above), but surface can have several such points (If it's folded, and point is inside), and we will have to choose closest from ones with "good" normal. Anyway thanks for answer.
Ibraim Ganiev
CC BY-SA 3.0
2016-08-02T12:19:18.660Z
2016-08-02T12:19:18.660Z
Dragonseel
<p>I have rectangular matrix of 3d points sampled from a parametric surface. In my program this matrix provides base points for bilinear interpolation of surface (In any (u,v) point it returns 3d point interpolated from neighboring sampled values). Now I want to find closest point on surface from any other point in 3d space, considering values "between" sampled points of grid.</p>

<p>I'll attach picture with example on 2d curve. Here yellow points are sampled points, red point - point to which we want to find closest, and green - point which we need to find as closest (witness point). <a href="https://i.sstatic.net/YKLGT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/YKLGT.png" alt="enter image description here"></a></p>

<algorithm><computational-geometry><interpolation>
Find closest point on surface interpolated by 2d matrix of points
Ibraim Ganiev
# Find closest point on surface interpolated by 2d matrix of points

(Asked by: username_0 on 2016-08-01)

I have rectangular matrix of 3d points sampled from a parametric surface. In my program this matrix provides base points for bilinear interpolation of surface (In any (u,v) point it returns 3d point interpolated from neighboring sampled values). Now I want to find closest point on surface from any other point in 3d space, considering values "between" sampled points of grid.

I'll attach picture with example on 2d curve. Here yellow points are sampled points, red point - point to which we want to find closest, and green - point which we need to find as closest (witness point). [![enter image description here](https://i.sstatic.net/YKLGT.png)](https://i.sstatic.net/YKLGT.png)

**Tags:** algorithm, computational-geometry, interpolation


---

## 1 answers

### Answer by username_1 on 2016-08-02. Score: 2

This is only a rough idea, though I hope it may inspire better answers.

The closest point on a surface is as far as I know always forms together with the red point a line that is orthogonal to the surface.

If you know which yellow vertices form the surface that the green point lies on, this is easy. You could just formulate the normal form of the surface (which is piecewise linear so it works out) formulate the orthogonal line to the surface that goes through the red point and solve for the intersection point. Though I don't have the exact math here, this step should be easy to look up.

Now the problem is: Which linear piece of your surface is the closest one.
Either you calculate the green-point candidates for all linear pieces and also the distance and take the closest one, or you find some other possibly faster way for this.
For that I don't have a more clever idea.

> **Comments:**
> **username_0**: Yes, normal at witness point P must have same direction as vector S-P (where S is slave point, or red one on the picture above), but surface can have several such points (If it's folded, and point is inside), and we will have to choose closest from ones with "good" normal. Anyway thanks for answer.  

---

