4

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.

Bla...
  • 481
  • 4
  • 12

2 Answers2

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 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$.

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} $$

Dan Hulme
  • 6,780
  • 1
  • 16
  • 35
  • Please check my maths, people. I haven't done this since I was an undergrad. :-) – Dan Hulme Jul 05 '17 at 10:33
  • 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 Jul 05 '17 at 10:37
  • 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 Jul 05 '17 at 10:44
  • I would say its easier to understand as it has a more straightforward visual interpretation. Assuming you know how affine matrices work – joojaa Jul 05 '17 at 10:57
  • $a$ is the point? I haven't fully understand it. So, what's next after I know the three basis vectors? – Bla... Jul 05 '17 at 11:20
  • 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... Jul 05 '17 at 11:23
  • Ah, I think I understand your solution.. – Bla... Jul 05 '17 at 11:39
3

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.

You can pretty easily use affine transformation matrices 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.

joojaa
  • 8,437
  • 1
  • 24
  • 47