Jump to content
  • Advertisement
Sign in to follow this  

coordinates transformation

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement

In case that you really want to do more than calculating the reflection vector, and only translation and rotation but not scaling plays a role:

 

All your vectors are given in a space described by the identity matrix, i.e. with

   o = [ 0 0 0 1 ]t

   x = [ 1 0 0 0 ]t

   y = [ 0 1 0 0 ]t

   z = [ 0 0 1 0 ]t

 

The other space is described by

   o', x', y', z'

 

What you want is a transform M that maps the original space onto the given one:

   o' = M * o

   x' = M * x

   y' = M * y

   z' = M * z

 

Because each of oxyz has a single 1 and otherwise 0s as elements, and the 1 is stored at different rows, each of those mappings above just pick a single column from M:

   M * x = M * [ 1 0 0 0 ]t = M1st column

   M * y = M * [ 0 1 0 0 ]t = M2nd column

   M * z = M * [ 0 0 1 0 ]t = M3rd column

   M * o = M * [ 0 0 0 1 ]t = M4th column

 

In other words, the transform M is the matrix

   M := [ xyzo' ]

 

If you want to transform a vector v from the original into the mapped space, you have to apply

   v' = M * v

If you want to transform a vector v' from the mapped into the original space, you have to apply

   v = M-1 * v'

Edited by haegarr

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!