From one space to another

Started by
4 comments, last by _Rambo_ 21 years, 8 months ago
Hi, anyone could explain how to transform one vector to another space ? Thanks bye
Advertisement
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.
"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley
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..
--bart
Hi, thanks for your answers.
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
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.
If at first you don't succeed, redefine success.
Thanks

This topic is closed to new replies.

Advertisement