3D Cartesian Transformation

176 Views Asked by At

I have a tetrahedron in a 3D Cartesian space. It has two orientations. I know the same three vertices positions (xyz) in the first orientation and the second orientation. I know the position of the fourth point (xyz) in one orientation, and want to calculate it in the second. I understand this requires using rotation matrices or quaterions. The rotation matrix method seems the most user friendly. There seem to be quite a few previous posts on this, which have provided some good insight into the best approach. It seems my approach should be along the following lines: (1) Work out the center of rotation for the object. (2) Work out the precise rotation of the object about the x,y and z axes, passing through this point. (3) Use a rotation matrix to derive the position of the fourth point in its new orientation. Would somebody be kind enough to confirm I am on the right lines with this approach? Many Thanks. James.

1

There are 1 best solutions below

0
On BEST ANSWER

Let's say your tetrahedron with the four known vertices (Lets call it $T_A$) is given by four points $\{\mathbf a_1, \mathbf a_2, \mathbf a_3, \mathbf a_4\}$ and the other (Lets call it $T_B$) has a face corresponding to the first three points defined by $\{\mathbf b_1, \mathbf b_2, \mathbf b_3 \}$. You want to find $\mathbf b_4$ which corresponds to the fourth vertex of $T_B$. Lets assume that we store the $x$, $y$, and $z$ values of each of these points in a $3\times 1$ vector as $[x, y, z]^T$. Let's denote the base coordinate system with subscript $0$. Let's assume that each tetrahedron has a local coordinate system attached to it denoted by subscript $A$ and $B$. Each of these local coordinate systems is defined as follows:

  • The origin of $A$ is given by $\mathbf a_1$ and the origin of $B$ is given by $\mathbf b_1$.
  • The local $x$-axis ($\mathbf x_A$ and $\mathbf x_B$) of each system points from $\mathbf a_1$ toward $\mathbf a_2$ for $A$, similarly for $B$.
  • The local $y$-axis ($\mathbf y_A$ and $\mathbf y_B$) of each system is co-planar with $x_A$ and $x_B$ respectively and in the plane swept out by $\mathbf a_2$ and $\mathbf b_2$ respectively.
  • The local $z$-axis ($\mathbf z_A$ and $\mathbf z_B$) is defined by $\mathbf x_A \times \mathbf y_A$ and by $\mathbf x_B \times \mathbf y_B$ respectively.

We can then define the needed axes as follows: $$\mathbf x_A = \frac{\mathbf a_2 - \mathbf a_1}{\|\mathbf a_2 - \mathbf a_1\|}$$ $$\mathbf z_A = \frac{\mathbf x_A \times (\mathbf a_3- \mathbf a_1)}{\|\mathbf x_A \times (\mathbf a_3- \mathbf a_1)\|}$$

$$\mathbf y_A = \mathbf z_A \times \mathbf x_A$$

Do the same for $B$.

Now we can define the rotation matrix from $A$ back to the base coordinate system as

$$\mathbf R_0^A = \left[ \begin{array}{ccc} \mathbf x_A & \mathbf y_A & \mathbf z_A \end{array} \right].$$

Again, do the same for $B$.

Now we define a homogeneous transformation from $A$ back to the base coordinate system as follows

$$\mathbf H_0^A = \left[ \begin{array}{cc} \mathbf R_0^A & \mathbf a_1 \\ \mathbf 0^T & 1 \end{array} \right].$$

Do the same for $B$.

Now to transfer a point represented in the frame $A$ to the base coordinate system, use the transformation as follows:

$$\mathbf v_0 = \mathbf H_0^A \left[ \begin{array}{c} \mathbf v_A \\ 1 \end{array} \right].$$

Finally we can compute our unknown point as follows

$$\left[ \begin{array}{c} \mathbf b_4 \\ 1 \end{array}\right] = \mathbf H_0^B (\mathbf H_0^A)^{-1} \left[ \begin{array}{c} \mathbf a_4 \\ 1 \end{array} \right].$$