Coordinate systems

Started by
4 comments, last by Diakon_Tristan 22 years, 8 months ago
Greetings! How can I convert a ray presented by the vectors "direction" and point into a coordinate system defined by a 4*4 matrix? How do I calculate these vectors that they are relative to the axes and the origin of the matrix?
Advertisement
Everything you could want and more is at http://www.makegames.com/3drotation/, about halfway down the page.

(Important things to note are the 3D rotation matrix and how to combine translations and rotations...)

~ Dragonus
Now I will work with formulas...

I have two 3d-vectors (v1, v2) and two 4*4 matrices (m1, m2).
I apply the following calculations:

1.) v1*m1=v2
2.) v2*m2=v1

How do I calculate m2 by the given m1? You see m2 undos the transformation of v1 by m1.
Given the following:

1.) v1*m1=v2
2.) v2*m2=v1


Simple algebra tells us this:

m2 = v1/v2
m1 = v2/v1

So, as you can see, m1 is the inverse of m2.
quote:Original post by TerranFury
Given the following:

1.) v1*m1=v2
2.) v2*m2=v1


Simple algebra tells us this:

m2 = v1/v2
m1 = v2/v1

So, as you can see, m1 is the inverse of m2.


Your analysis is only true for scalar mathematics. However, it does lead to the correct result. I won't bother explaining why, but basically division is not defined for matrices.

It is correct to write

v2*m2 = v1
=>(v1*m1)*m2 = v1
=>v1*(m1*m2) = v1

which is only true if: m1*m2 = I (the identity matrix), and this is true if m2 = m1-1.

As to how you compute the inverse of a matrix... there are many methods. There was a good thread recently on this very topic that outlined peoples favourite matrix inversion techniques. One suggestion... avoid the Adjoint method.

Timkin



Edited by - Timkin on August 20, 2001 2:49:39 AM
Well, the two methods I do know of are like this: Let''s say...

  A = [1 2]    [3 4]  


The first way of doing this is by setting up the matrix [A | I] and then row-reducing it...

  [A | I] = [1 2 | 1 0] -> [1  2 |  1 0] -> [1 2 |  1    0 ]          [3 4 | 0 1]    [0 -2 | -3 1]    [0 1 | 3/2 -1/2]-> [1 0 |  -2   1 ]   [0 1 | 3/2 -1/2]  


The part on the right half of the matrix when you''re done is A^-1.

They have a closed-equation way of doing it, but I don''t know the one for a 4x4 matrix.

Then there''s the adjoint. Kinda nasty on the math side, but it''ll be easier to code up on the computer side. Don''t remember it off the top of my head, but it''s not incredibly horrible as I remember...

Dragonus
Thought of the Moment
If F = ma, and Work = Fd, then does Work = mad?

This topic is closed to new replies.

Advertisement