#### Archived

This topic is now archived and is closed to further replies.

# From one space to another

This topic is 5586 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, anyone could explain how to transform one vector to another space ? Thanks bye

##### Share on other sites
Not a lot of info there. But here goes...

If it''s a linear transformation, multiply the vector by the matrix representing your linear transform. Note that the origin will always stay fixed for a linear map since
f( x + y ) = f( x ) + f( y )

If it''s affine, you could use homogenous coordinates and matrices, or you could add an affine translation after multiplying by a matrix.

If it''s orthonormal (i.e. distance & angle preserving), the determinant of the matrix will be +/-1, and all rows/columns will be linearly independent. All rotations are orthonormal (det 1), reflections are det -1 and hence will invert the geometry of your space.

##### Share on other sites
a transpose of the orientation matrix would suffice (3x3 transpose involving the three basis vectors). a transpose is a reflection along the diagonal of the matrix.

position is treated differently,

px = -I * P
py = -J * P
pz = -K * P

(* being dot products, and IJKP are the basis vectors and position of the matrix you''re inverting).

note that if the matrix contains scaling or shearing, this won''t work..

##### Share on other sites
Anyone has C source code that could share with me about to compute the inverse of a 4x4 matrix ?

Thanks, i''ll really appreciate.
Bye

##### Share on other sites
Ok, if you have the basis vectors of the space you want to transform into, and it''s reletive position from this vector, then you can transform into it by multiplying it by the matrix:
[Sx,Ux,Fx,Tx][Sy,Uy,Fy,Ty][Sz,Uz,Fz,Tz][0,0,0,1]

Where the S, U, and F vectors ( side up and front ) are the basis vectors of the new space ( should be orthonormal, otherwise you''ll get some funky warping going on ), and T is the translation vector.

Easy

Death of one is a tragedy, death of a million is just a statistic.

Thanks

• ### Forum Statistics

• Total Topics
628698
• Total Posts
2984275

• 20
• 10
• 13
• 13
• 11