Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>We have to solve this exact same problem. Here's how I do it:</p> <p>Call the points P and W, so we have P1..P3 and W1..W3</p> <p>Construct three vectors in each space like so</p> <pre><code>A1 = P2-P1 A2 = P3-P1 A3 = A1 x A2 </code></pre> <p>and</p> <pre><code>B1 = W2-W1 B2 = W3-W1 B3 = B1 x B2 </code></pre> <p>These two pairs of three vectors each constitute a non-orthogonal basis, and you want to find how to represent your cartesian axes (x y and z) in one space so that you can find them in another. To do this construct a matrix so that its columns are the three vectors found above. Then invert this matrix, if this inversion fails, then the non-orthogonal basis does not span the space and the problem cannot be solved.</p> <p>Then pull the three columns out of the inverted matrix. These columns are the cartesian axes in terms of your non-orthogonal basis (V1, V2 and V3). From this we can reconstruct an orthogonal basis that will serve as a transformation matrix from the first space to the second. </p> <p>If we call this matrix R, and denote R[row, column] as our notation, then the rows (or columns, depending on how you use the matrix) of the final transformation matrix will be:</p> <pre><code>B1 * R[0,0] + B2* R[1,0] + B3 * R[2,0] B1 * R[0,1] + B2* R[1,1] + B3 * R[2,1] B1 * R[0,2] + B2* R[1,2] + B3 * R[2,2] </code></pre> <p>Now, because one of the columns of the original matrix before the inversion was the cross of the other two columns, it's probably possible to optimise the inversion of the matrix. I haven't bothered to do this - especially because in our case the three points P1..P3 don't change, and so the inverted matrix can be cached.</p> <p>This method has the advantage that if you have a half-decent matrix/vector library it's very simple to implement. And it doesn't use angles, which is always a good thing.</p>
    singulars
    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. This table or related slice is empty.
    1. 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