<blockquote>
  <p>FYI, the 3 other points lie on a plane</p>
</blockquote>

<p>Of course they do. Any set of three points defines a plane (except in the degenerate case joojaa mentions, where they lie on many planes). If the points are $p$, $q$, and $r$, then $(q - p) \wedge (r - p)$ is the normal to the plane; call it $n$.</p>

<p>This plane defines a co-ordinate system. If you make it the XY plane, then $z = a \dot\ n$. You can also project $a$ onto the plane to get the other two co-ordinates: $x = (a - p) \dot\ (q - p)$ and $y = (a - p) \dot\ (r - p)$.</p>

<p>Note that the co-ordinate system I've described here is pretty rubbish: it isn't even orthogonal. It's good enough to uniquely identify a point, as long as you're careful about all the signs.</p>

<p>But if you want an orthonormal basis, you can construct it from this one. First, instead of $q - p$ and $r - p$, normalize those vectors. Then $n$ will also have length 1, and the $x$ axis will also be normal. The last problem is the $y$ axis, which is not orthogonal to the $x$ axis. You can get a better $y$ axis by crossing the other two and normalizing, and while you're doing that you might as well also choose the order to ensure the basis is right-handed. Your three basis vectors are as follows:</p>

<p>$$
\begin{eqnarray}
\hat{z} &amp; = &amp; \frac{n}{|n|} \\
\hat{x} &amp; = &amp; \frac{q - p}{|q - p|} \\
\hat{y} &amp; = &amp; \hat{z} \wedge \hat{x}
\end{eqnarray}
$$</p>

CC BY-SA 3.0
2017-07-05T10:33:35.887Z
Please check my maths, people. I haven't done this since I was an undergrad. :-)
Dan Hulme
CC BY-SA 3.0
2017-07-05T10:37:05.617Z
Well yes i would just construct a affine matrix with a crossed and normalized 3 axis does much the same but with less thinking, and then just matrix multiply. Anyway your missing one normalize.
joojaa
CC BY-SA 3.0
2017-07-05T10:44:14.790Z
Yeah, doing it by a matrix would have been simpler but maybe harder to understand. Thinking about each vector separately lets you approach the problem a piece at a time instead of all at once.
Dan Hulme
CC BY-SA 3.0
2017-07-05T10:57:24.770Z
I would say its easier to understand as it has a more straightforward visual interpretation. Assuming you know how affine matrices work
joojaa
CC BY-SA 3.0
2017-07-05T11:20:49.957Z
$a$ is the point? I haven't fully understand it. So, what's next after I know the three basis vectors?
Bla...
CC BY-SA 3.0
2017-07-05T11:23:34.937Z
Just to elaborate, initially I have the info for all four points. My goal is to find where point $A$ is when the other three points changing position and orientation.
Bla...
CC BY-SA 3.0
2017-07-05T11:39:59.103Z
Ah, I think I understand your solution..
Bla...
CC BY-SA 3.0
2017-07-05T10:33:21.623Z
2017-07-05T10:42:50.280Z
2017-07-05T10:42:50.280Z
Dan Hulme
<p>What you're looking for is closest point on a plane for the 3rd direction but since @DanHulme described this I would not repeat it.</p>

<p>You can pretty easily use <a href="https://en.wikipedia.org/wiki/Affine_transformation" rel="nofollow noreferrer"><em>affine transformation matrices</em></a> for this. Making a fully defined affine transform from 3 points is a pretty normal operation.</p>

<p>The standard way is to just use a cross product to produce a third axis (possibly normalized, but whether or not you want to do that depends on application) this way you have 2 axes on the plane and one perpendicular to the plane. </p>

<p>To form the matrix say you have the vectors $\vec a$, $\vec b$ and $\vec c$ then you formulate the matrix. Then you calculate the vector from a to b $\vec v_{b-a}$ by subtracting $\vec a$ from $\vec b$, and a second vector $\vec v_{c-a}$ by subtracting $\vec a$ from $\vec c$. So basically 2 spanning vectors pointing out from $\vec a$. Then you formulate this as a matrix.</p>

<p>\begin{bmatrix}
\vec v_{b-a} \\
\vec v_{c-a} \\
\left|\vec v_{b-a} \times \vec v_{c-a}\right|\\
\vec a
\end{bmatrix}</p>

<p>Thats about it. Some more maths to orthogonalize the thing.</p>

CC BY-SA 3.0
2017-07-05T11:14:45.263Z
Then, how do you get the point A?
Bla...
CC BY-SA 3.0
2017-07-05T11:23:40.433Z
Just to elaborate, initially I have the info for all four points. My goal is to find where point $A$ is when the other three points changing position and orientation.
Bla...
CC BY-SA 3.0
2017-07-05T11:40:22.087Z
Ah I think I understand your point.
Bla...
CC BY-SA 3.0
2017-07-05T10:56:23.460Z
2017-07-05T11:32:44.437Z
2017-07-05T11:32:44.437Z
joojaa
<p>Is it possible to describe a position of a point $A$ (in 3D) w.r.t. the position and orientation of 3 other points? If so, how?</p>

<p>FYI, the 3 other points lie on a plane, whereas the point $A$ is not on the plane.</p>

<p>Just to elaborate, initially I have the info for all four points. My goal is to find where point $A$ is when the other three points changing position and orientation.</p>

CC BY-SA 3.0
2017-07-05T10:04:28.607Z
Yes, 3 points in any dimension above 2 all lie on the same plane unless they are degenerate and lie on a line
joojaa
CC BY-SA 3.0
2017-07-05T10:50:31.123Z
Or even an infinite number of lines for the most degenerate case. (I'll show myself out)
Simon F
CC BY-SA 3.0
2017-07-05T11:00:05.600Z
@SimonF and planes ;)
joojaa
<computational-geometry>
How to describe a position of a point w.r.t the position and orientation of 3 other points
Bla...
# How to describe a position of a point w.r.t the position and orientation of 3 other points

(Asked by: username_0 on 2017-07-05)

Is it possible to describe a position of a point $A$ (in 3D) w.r.t. the position and orientation of 3 other points? If so, how?

FYI, the 3 other points lie on a plane, whereas the point $A$ is not on the plane.

Just to elaborate, initially I have the info for all four points. My goal is to find where point $A$ is when the other three points changing position and orientation.

**Tags:** computational-geometry

> **Comments:**
> **username_1**: Yes, 3 points in any dimension above 2 all lie on the same plane unless they are degenerate and lie on a line  
> **username_2**: Or even an infinite number of lines for the most degenerate case. (I'll show myself out)  
> **username_1**: @username_2 and planes ;)  

---

## 2 answers

### Answer by username_3 on 2017-07-05. Score: 5

> FYI, the 3 other points lie on a plane

Of course they do. Any set of three points defines a plane (except in the degenerate case username_1 mentions, where they lie on many planes). If the points are $p$, $q$, and $r$, then $(q - p) \wedge (r - p)$ is the normal to the plane; call it $n$.

This plane defines a co-ordinate system. If you make it the XY plane, then $z = a \dot\ n$. You can also project $a$ onto the plane to get the other two co-ordinates: $x = (a - p) \dot\ (q - p)$ and $y = (a - p) \dot\ (r - p)$.

Note that the co-ordinate system I've described here is pretty rubbish: it isn't even orthogonal. It's good enough to uniquely identify a point, as long as you're careful about all the signs.

But if you want an orthonormal basis, you can construct it from this one. First, instead of $q - p$ and $r - p$, normalize those vectors. Then $n$ will also have length 1, and the $x$ axis will also be normal. The last problem is the $y$ axis, which is not orthogonal to the $x$ axis. You can get a better $y$ axis by crossing the other two and normalizing, and while you're doing that you might as well also choose the order to ensure the basis is right-handed. Your three basis vectors are as follows:

$$
\begin{eqnarray}
\hat{z} & = & \frac{n}{|n|} \\
\hat{x} & = & \frac{q - p}{|q - p|} \\
\hat{y} & = & \hat{z} \wedge \hat{x}
\end{eqnarray}
$$

> **Comments:**
> **username_3**: Please check my maths, people. I haven't done this since I was an undergrad. :-)  
> **username_1**: Well yes i would just construct a affine matrix with a crossed and normalized 3 axis does much the same but with less thinking, and then just matrix multiply. Anyway your missing one normalize.  
> **username_3**: Yeah, doing it by a matrix would have been simpler but maybe harder to understand. Thinking about each vector separately lets you approach the problem a piece at a time instead of all at once.  
> **username_1**: I would say its easier to understand as it has a more straightforward visual interpretation. Assuming you know how affine matrices work  
> **username_0**: $a$ is the point? I haven't fully understand it. So, what's next after I know the three basis vectors?  
> **username_0**: Just to elaborate, initially I have the info for all four points. My goal is to find where point $A$ is when the other three points changing position and orientation.  
> **username_0**: Ah, I think I understand your solution..  

---

### Answer by username_1 on 2017-07-05. Score: 3

What you're looking for is closest point on a plane for the 3rd direction but since @username_3 described this I would not repeat it.

You can pretty easily use [*affine transformation matrices*](https://en.wikipedia.org/wiki/Affine_transformation) for this. Making a fully defined affine transform from 3 points is a pretty normal operation.

The standard way is to just use a cross product to produce a third axis (possibly normalized, but whether or not you want to do that depends on application) this way you have 2 axes on the plane and one perpendicular to the plane.

To form the matrix say you have the vectors $\vec a$, $\vec b$ and $\vec c$ then you formulate the matrix. Then you calculate the vector from a to b $\vec v\_{b-a}$ by subtracting $\vec a$ from $\vec b$, and a second vector $\vec v\_{c-a}$ by subtracting $\vec a$ from $\vec c$. So basically 2 spanning vectors pointing out from $\vec a$. Then you formulate this as a matrix.

\begin{bmatrix}
\vec v\_{b-a} \\
\vec v\_{c-a} \\
\left|\vec v\_{b-a} \times \vec v\_{c-a}\right|\\
\vec a
\end{bmatrix}

Thats about it. Some more maths to orthogonalize the thing.

> **Comments:**
> **username_0**: Then, how do you get the point A?  
> **username_0**: Just to elaborate, initially I have the info for all four points. My goal is to find where point $A$ is when the other three points changing position and orientation.  
> **username_0**: Ah I think I understand your point.  

---

