Closest Point on a Line / Plane to Another Point in Arbitrary Number of Dimensions

72 Views Asked by At

Let $A$ be a shape of dimension $N-1$ defined in an arbitrary number of dimensions $N$: $$c_0 + c_1n_1 + c_2n_2 + \cdots + c_{N-1}n_{N-1} = 0$$ where $n_1, n_2, n_3, \ldots , n_N$ are the axes.

Let $P$ be a point with coordinates $(p_1, p_2, p_3,\ldots,p_N)$.

Let $X$ be the point on shape $A$ that is closest to point $P$.

How would you find the coordinates of point $X$?

P.S. This is a step to find the reflection of point $P$ across shape $A$. Once the coordinates of $X$ are known, we can find the reflection of $P$: $$P' = (2x_1 - p_1, 2x_2 - p_2, 2x_3 - p_3, \ldots, 2x_N - p_N)$$

3

There are 3 best solutions below

0
On BEST ANSWER

Based on @Jack's answer, here is the complete solution.

Let the hyperplane $A$ be described by normal vector $w$ and offset $b$.

Let $L$ be the line parameterized like this: $P + w \cdot t$.

Substituting $L$ into the equation for $A$ and solving for the value of $t$ that results in $L$ intersecting $A$, we get this: $$t_x = - \frac{b + \sum_{1}^{N} p_i w_i}{\sum_{1}^{N} w_i^2}$$

The intersection between $A$ and $L$, then, or the closest point on $A$ to $P$, can be found by plugging $t_x$ into the equation of the line: $$X = P + w \cdot t_x$$

The reflection of $P$ across $A$, then, can be found through the equation $P' = 2 X - P$. After plugging $X$ in, we get the answer: $$P' = P + 2 t_x w$$

0
On

$A$ is a hyperplane which has a normal vector $v$.

Let $L$ be the line defined by the point $p$ and the vector $v$.

Find the intersection of $A$ and $L$.

0
On

Well for the reflection you can assume that point $\vec p$ (the reflected point), then you just plug in the $\frac{\vec p+\vec p_0}{2}$, ($\vec p_0$ is the initial point whose image is needed) into the equation of shape. Then observe $\vec p-\vec p_0$ perpendicular to any difference of any two points in the hyperplane. (These are obtained from laws of reflection which can be assumed the axiomatic definition for image in such abstract setting). The image might not be a single point rather be a space of N-3 dimension maybe.