<p>Take a point $P$ and it's rotated point $P'$.</p>

<p>Find the plan that runs through the middle between them $C = \frac{P+P'}{2}$ and is perpendicular to the line connecting them.</p>

<p>Do this for all 3 of them and find the line of the planes' intersection. That will be the rotation axis.</p>

<p>If all mid-planes are coplanar then you can use the planes of the triangles themselves.</p>

<p>To get the angle you can take a $P$ and $P'$ again and project them onto the axis.</p>

<p>Take a point $A$ on the axis and the direction $v$ of the axis. The projected point is $P_p=A+\frac{v \cdot (P-A)}{v\cdot v} v$. And then the angle is $acos(\frac{dot(P-P_p, P'-P_p)}{|P-P_p|* |P'-P_p|})$</p>

CC BY-SA 3.0
2017-03-07T11:30:49.107Z
Do I really need 3 correspondences, or is 2 enough?    

Additionally, how can I get the angle of rotation from this?
ginsunuva
CC BY-SA 3.0
2017-03-07T11:35:55.860Z
2 is enough but the third lets you verify that it's indeed a rotation. As for angle you can project the point and it's rotated point onto the axis get the direction to the points and dot product.
ratchet freak
CC BY-SA 3.0
2017-03-07T11:41:46.897Z
I guess two can have degenerate cases if they're coplanar with the axis of rotation, so three can help, but three can also be bad if they're still coplanar with the axis.  Like for a triangle on a door that rotates open, all the "midpoint-planes" are the same.
ginsunuva
CC BY-SA 3.0
2017-03-07T11:43:54.037Z
@ginsunuva there is a solution for that, see edit. The only remaining issue is a degenerate triangle which is parallel with the rotation axis but that has multiple solutions.
ratchet freak
CC BY-SA 3.0
2017-03-07T12:42:01.103Z
Great, also how do I actually do the project/find angle thing? How can I get two points to be in this new 2d coordinate system defined by the orthogonal plane to the rot-axis, so I can do a dot product?
ginsunuva
CC BY-SA 3.0
2017-03-07T11:08:32.130Z
2017-03-07T13:19:40.897Z
2017-03-07T13:19:40.897Z
ratchet freak
<p>Suppose I have two 3D triangles before &amp; after a single rotation around an unknown axis.
How would I go about finding this axis?</p>

<transformations><geometry><mathematics>
Calculate a rotation around an arbitrary axis
ginsunuva
# Calculate a rotation around an arbitrary axis

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

Suppose I have two 3D triangles before & after a single rotation around an unknown axis.
How would I go about finding this axis?

**Tags:** transformations, geometry, mathematics


---

## 1 answers

### Answer by username_1 on 2017-03-07. Score: 4 | Accepted answer

Take a point $P$ and it's rotated point $P'$.

Find the plan that runs through the middle between them $C = \frac{P+P'}{2}$ and is perpendicular to the line connecting them.

Do this for all 3 of them and find the line of the planes' intersection. That will be the rotation axis.

If all mid-planes are coplanar then you can use the planes of the triangles themselves.

To get the angle you can take a $P$ and $P'$ again and project them onto the axis.

Take a point $A$ on the axis and the direction $v$ of the axis. The projected point is $P\_p=A+\frac{v \cdot (P-A)}{v\cdot v} v$. And then the angle is $acos(\frac{dot(P-P\_p, P'-P\_p)}{|P-P\_p|\* |P'-P\_p|})$

> **Comments:**
> **username_0**: Do I really need 3 correspondences, or is 2 enough?      Additionally, how can I get the angle of rotation from this?  
> **username_1**: 2 is enough but the third lets you verify that it's indeed a rotation. As for angle you can project the point and it's rotated point onto the axis get the direction to the points and dot product.  
> **username_0**: I guess two can have degenerate cases if they're coplanar with the axis of rotation, so three can help, but three can also be bad if they're still coplanar with the axis.  Like for a triangle on a door that rotates open, all the "midpoint-planes" are the same.  
> **username_1**: @username_0 there is a solution for that, see edit. The only remaining issue is a degenerate triangle which is parallel with the rotation axis but that has multiple solutions.  
> **username_0**: Great, also how do I actually do the project/find angle thing? How can I get two points to be in this new 2d coordinate system defined by the orthogonal plane to the rot-axis, so I can do a dot product?  

---

