Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First of all, unless in your plane equation, d=0, there is no <a href="http://en.wikipedia.org/wiki/Linear_transformation" rel="noreferrer">linear transformation</a> you can apply. You need to instead perform an <a href="http://en.wikipedia.org/wiki/Affine_transformation" rel="noreferrer">affine transformation</a>.</p> <p>One way to do this is to determine an angle and vector about which to rotate to make your pointset lie in a plane parallel to the XY plane (ie. the Z component of your transformed pointset to all have the same values). Then you simply drop the Z component.</p> <p>For this, let <B>V</B> be the normalized plane normal for the plane containing your points. For convenience define from your plane equation above Ax+By+Cz+d=0:</p> <pre><B>V</b> = (A, B, C) <B>V'</b> = <B>V</b> / ||<B>V</b>|| = (A', B', C') <B>Z</b> = (0, 0, 1)</pre> <p>where</p> <pre>A' = A / ||<B>V</B>|| B' = B / ||<B>V</B>|| C' = C / ||<B>V</B>|| ||<B>V</B>|| = (A<sup>2</sup>+B<sup>2</sup>+C<sup>2</sup>)<sup>1/2</sup></pre> <p>The angle will simply be:</p> <pre>&theta; = cos<sup>-1</sup>(<B>Z</B>∙<B>V</B> / ||<B>V</B>||) = cos<sup>-1</sup>(<B>Z</B>∙<B>V'</B>) = cos<sup>-1</sup>(C')</pre> <p>The axis <b>R</b> about which to rotate is just the cross product of the normalized plane normal <b>V'</b> and <B>Z</B>. That is</p> <pre><b>R</b> = <b>V'</b>×<b>Z</b> = (B', -A', 0)</pre> <p>You can now use this angle / axis pair to build the <a href="http://en.wikipedia.org/wiki/Quaternion_rotation" rel="noreferrer">quaternion rotation</a> needed to rotate all of the points in your dataset to a plane parallel to the XY plane. Then, a I said earlier, just drop the Z component to perform an orthogonal projection onto the XY plane.</p> <p><i>Update: </i> antonakos makes a good point about normalizing the <b>R</b> before using an API taking axis / angle pairs.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload