Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here are my two cents. Hope it helps.</p> <p>If I understand correctly, you want to rotate <em>3D</em> system of coordinates and then project it orthogonally onto a given <em>2D</em> plane (<em>2D</em> plane is defined with respect to the original, unrotated <em>3D</em> system of coordinates). </p> <p>"Rotating and projecting <em>3D</em> system of coordinates" is "rotating three <em>3D</em> basis vectors and projecting them orthogonally onto a <em>2D</em> plane so they become <em>2D</em> vectors with respect to <em>2D</em> basis of the plane". Let the original <em>3D</em> vectors be unprimed and the resulting <em>2D</em> vectors be primed. Let <strong>{e1, e2, e3} = {e1..3}</strong> be <em>3D</em> orthonormal basis (which is given), and <strong>{e1', e2'} = {e1..2'}</strong> be <em>2D</em> orthonormal basis (which we have to define). Essentially, we need to find such operator <strong>PR</strong> that <strong>PR * v = v'</strong>.</p> <p>While we can talk a lot about linear algebra, operators and matrix representation, it'd be too long of a post. It'll suffice to say that :</p> <ol> <li>For both <em>3D</em> rotation and <em>3D->2D</em> projection operators there are real matrix representations (linear transformations; <em>2D</em> is subspace of <em>3D</em>). </li> <li>These are two transformations applied consequently, i.e. <strong>PR * v = P * R * v = v'</strong>, so we need to find rotation matrix <strong>R</strong> and projection matrix <strong>P</strong>. Clearly, after we rotated <strong>v</strong> using <strong>R</strong>, we can project the result vector <strong>vR</strong> using <strong>P</strong>.</li> <li>You have the rotation matrix <strong>R</strong> already, so we consider it is a given <em>3x3</em> matrix. So for simplicity we will talk about projecting vector <strong>vR = R * v</strong>.</li> <li>Projection matrix <strong>P</strong> is a <em>2x3</em> matrix with <em>i</em>-th column being a projection of <em>i</em>-th <em>3D</em> basis vector <strong>ei</strong> onto <strong>{e1..2'}</strong> basis.</li> </ol> <p>Let's find <strong>P</strong> projection matrix such as a <em>3D</em> vector <strong>vR</strong> is linearly transformed into <em>2D</em> vector <strong>v'</strong> on a <em>2D</em> plane with an orthonormal basis <strong>{e1..2'}</strong>.</p> <p>A <em>2D</em> plane can be easily defined by a vector normal to it. For example, from the figures in the OP, it seems that our <em>2D</em> plane (the plane of the paper) has normal unit vector <strong>n = <em>1/sqrt(3)</em> * ( 1, 1, 1 )</strong>. We need to find a <em>2D</em> basis in the <em>2D</em> plane defined by this <strong>n</strong>. Since any two linearly independent vectors lying in our <em>2D</em> plane would form such basis, here are infinite number of such basis. From the problem's geometry and for the sake of simplicity, let's impose two additional conditions: first, the basis should be orthonormal; second, should be visually appealing (although, this is somewhat a subjective condition). As it can be easily seen, such basis is formed trivially in the primed system by setting <strong>e1' = ( 1, 0 )' = <em>x'</em></strong>-axis (horizontal, positive direction from left to right) and <strong>e2' = ( 0, 1 )' = <em>y'</em></strong>-axis (vertical, positive direction from bottom to top).</p> <p>Let's now find this <strong>{e1', e2'}</strong> <em>2D</em> basis in <strong>{e1..3}</strong> <em>3D</em> basis. </p> <ol> <li>Let's denote <strong>e1'</strong> and <strong>e2'</strong> as <strong>e1"</strong> and <strong>e2"</strong> in the original basis. Noting that in our case <strong>e1"</strong> has no <strong>e3</strong>-component (<strong><em>z</em></strong>-component), and using the fact that <strong>n <em>dot</em> e1" = 0</strong>, we get that <strong>e1' = ( 1, 0 )' -> e1" = ( -1/sqrt(2), 1/sqrt(2), 0 )</strong> in the <strong>{e1..3}</strong> basis. Here, <strong><em>dot</em></strong> denotes dot-product.</li> <li>Then <strong>e2" = n <em>cross</em> e1" = ( -1/sqrt(6), -1/sqrt(6), 2/sqrt(6) )</strong>. Here, <strong><em>cross</em></strong> denotes cross-product.</li> </ol> <p>The <em>2x3</em> projection matrix <strong>P</strong> for the <em>2D</em> plane defined by <strong>n = <em>1/sqrt(3)</em> * ( 1, 1, 1 )</strong> is then given by:</p> <pre><code>( -1/sqrt(2) 1/sqrt(2) 0 ) ( -1/sqrt(6) -1/sqrt(6) 2/sqrt(6) ) </code></pre> <p>where first, second and third columns are transformed <strong>{e1..3}</strong> <em>3D</em> basis onto our <em>2D</em> basis <strong>{e1..2'}</strong>, i.e. <strong>e1 = ( 1, 0, 0 )</strong> from <em>3D</em> basis has coordinates <strong>( -1/sqrt(2), -1/sqrt(6) )</strong> in our <em>2D</em> basis, and so on.</p> <p>To verify the result we can check few obvious cases: </p> <ol> <li><strong>n</strong> is orthogonal to our <em>2D</em> plane, so there should be no projection. Indeed, <strong>P * n = P * ( 1, 1, 1 ) = 0</strong>.</li> <li><strong>e1</strong>, <strong>e2</strong> and <strong>e3</strong> should be transformed into their representation in <strong>{e1..2'}</strong>, namely corresponding column in <strong>P</strong> matrix. Indeed, <strong>P * e1 = P * ( 1, 0 ,0 ) = ( -1/sqrt(2), -1/sqrt(6) )</strong> and so on.</li> </ol> <p>To finalize the problem. We now constructed a projection matrix <strong>P</strong> from <em>3D</em> into <em>2D</em> for an arbitrarily chosen <em>2D</em> plane. We now can project any vector, previously rotated by rotation matrix <strong>R</strong>, onto this plane. For example, rotated original basis <strong>{R * e1, R * e2, R * e3}</strong>. Moreover, <em>we can multiply given</em> <strong>P</strong> <em>and</em> <strong>R</strong> <em>to get a rotation-projection transformation matrix</em> <strong>PR = P * R</strong>.</p> <p>P.S. C++ implementation is left as a homework exercise ;).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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