Suppose I have two 3D triangles before & after a single rotation around an unknown axis. How would I go about finding this axis?
1 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|})$
-
$\begingroup$ Do I really need 3 correspondences, or is 2 enough? Additionally, how can I get the angle of rotation from this? $\endgroup$ Commented Mar 7, 2017 at 11:30
-
1$\begingroup$ 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. $\endgroup$ Commented Mar 7, 2017 at 11:35
-
$\begingroup$ 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. $\endgroup$ Commented Mar 7, 2017 at 11:41
-
1$\begingroup$ @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. $\endgroup$ Commented Mar 7, 2017 at 11:43
-
$\begingroup$ 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? $\endgroup$ Commented Mar 7, 2017 at 12:42