Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a plane in 3D space that formed from 3 poin $P_1=(x_1, y_1, z_1)$, $P_2=(x_2, y_2, z_2)$, $P_3=(x_3, y_3, z_3)$

I want to rotate and transform this points (equally related plane) into 2D space (Avoiding $z$ axis but save distance and relations in 2D plane).

share|cite|improve this question
To clarify, you want to rotate the plane containing the points $P_1,\,P_2,\,P_3$ into the $xy$ plane. – Daryl Apr 29 '13 at 8:08
up vote 2 down vote accepted

As a first step, I'd move $P_1$ to the origin, so that the points become $P_1=(0,0,0)$, $P_2=(x_2-x_1, y_2-y_1, z_2-z_1)$, $P_3=(x_3-x_1, y_3-y_1, z_3-z_1)$. From there it's just a question of applying a rotation matrix.

A rotation matrix $\mathbf{R}$ which preserves all distances and shapes etc is given by

$$ \mathbf{R}=\left( \begin{array} [c]{ccc}% e_{1}^{x} & e_{2}^{x} & e_{3}^{x}\\ e_{1}^{y} & e_{2}^{y} & e_{3}^{y}\\ e_{1}^{z} & e_{2}^{z} & e_{3}^{z}% \end{array} \right) $$

where the vectors $\left( e_{1}^{\alpha},e_{2}^{\alpha},e_{3}^{\alpha }\right) $ for $\alpha\in\left\{ x,y,z\right\} $ are orthogonal and of unit length, i.e.

$$ \sum_{i=1}^{3}e_{i}^{\alpha}e_{i}^{\beta}=\left\{ \begin{array} [c]{ccc}% 1 & & \alpha=\beta\\ 0 & & \alpha\neq\beta \end{array} \right. .% $$

Applying $\mathbf{R}$, your rotated points $P_{i}^{\prime}=\left( x_{i}^{\prime},y_{i}^{\prime},z_{i}^{\prime}\right) $ are given by

$$ \left( \begin{array} [c]{c}% x_{i}^{\prime}\\ y_{i}^{\prime}\\ z_{i}^{\prime}% \end{array} \right) =\mathbf{R}\left( \begin{array} [c]{c}% x_{i}\\ y_{i}\\ z_{i}% \end{array} \right) $$

I suggest making the top row of $\mathbf{R}$ the unit vector in the direction from $P_{1}$ to $P_{2}$, i.e.

$$ \left( \begin{array} [c]{c}% e_{1}^{x}\\ e_{2}^{x}\\ e_{3}^{x}% \end{array} \right) =\frac{1}{\sqrt{\left( x_{1}-x_{2}\right) ^{2}+\left( y_{1}% -y_{2}\right) ^{2}+\left( z_{1}-z_{2}\right) ^{2}}}\left( \begin{array} [c]{c}% x_{1}-x_{2}\\ y_{1}-y_{2}\\ z_{1}-z_{2}% \end{array} \right) $$

which would mean that the line from $P_{1}$ to $P_{2}$ gets mapped into the $x$-axis.

Working out what you could use for the second and third rows of $\mathbf{R}$ is now just a question of solving some simple linear equations, to make sure that the line from $P_{1}$ to $P_{3}$ has no z component.

To solve for $\left( e_{1}^{z},e_{2}^{z},e_{3}^{z}\right)$, the vector $e_{i}^{z}$ must have a zero dot-product with both $e_{i}^{x}$ and $\left( x_{3}-x_{1},y_{3}-y_{1},z_{3}-z_{1}\right) $, so the equations are

$$ \begin{align*} e_{1}^{x}e_{1}^{z}+e_{2}^{x}e_{2}^{z}+e_{3}^{x}e_{3}^{z} & =0\\ \left( x_{3}-x_{1}\right) e_{1}^{z}+\left( y_{3}-y_{1}\right) e_{2}% ^{z}+\left( z_{3}-z_{1}\right) e_{3}^{z} & =0 \end{align*} $$


$$ \left( \begin{array} [c]{c}% e_{1}^{z}\\ e_{2}^{z}\\ e_{3}^{z}% \end{array} \right) =\lambda_{z}\left( \begin{array} [c]{c}% \left( z_{3}-z_{1}\right) e_{2}^{x}-\left( y_{3}-y_{1}\right) e_{3}^{x}\\ \left( x_{3}-x_{1}\right) e_{3}^{x}-\left( z_{3}-z_{1}\right) e_{1}^{x}\\ \left( y_{3}-y_{1}\right) e_{1}^{x}-\left( x_{3}-x_{1}\right) e_{2}^{x}% \end{array} \right) $$

for some $\lambda_z$, which should be determined so that $e_{i}^{z}$ is a vector of unit length. Finally $e_{i}^{y}$ can be determined as the vector which is perpendicular to both $e_{i}^{x}$ and $e_{i}^{z}$, i.e.

$$ \left( \begin{array} [c]{c}% e_{1}^{y}\\ e_{2}^{y}\\ e_{3}^{y}% \end{array} \right) =\lambda_{y}\left( \begin{array} [c]{c}% e_{3}^{z}e_{2}^{x}-e_{2}^{z}e_{3}^{x}\\ e_{1}^{z}e_{3}^{x}-e_{3}^{z}e_{1}^{x}\\ e_{2}^{z}e_{1}^{x}-e_{1}^{z}e_{2}^{x}% \end{array} \right) $$

where again $\lambda_{y}$ is determined so that $e_{i}^{y}$ is a vector of unit length.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.