Flat polygons embedded in three-space can be transformed into a congruent planar polygon as follows. First, translate the starting vertex
to (0, 0, 0) by subtracting it from each vertex of the polygon. Then find the normal
to the polygon by taking the cross
product of the first and last vertices. Now, let
be the rotation matrix for Euler
angles
,
, and
, and solve
(1)
|
for
and
(after first expressing sines in terms of cosines using
. The result is
(2)
| |||
(3)
|
The signs are chosen as follows:
(4)
| |||
(5)
|
Plugging these back in and applying to the original polygon then gives a polygon whose vertices all have one component zero. This component can then be dropped. The
only special cases which need to be taken into account are , in which case the polygon is parallel to the
-plane and the third components can be immediately dropped.
The second occurs when
,
in which case there is no component of the normal vector along the x-axis,
so the Euler rotation will not work. However, simply picking a different starting
vertex from which to calculate the normal resolves this degenerate case.