View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

# Coordinate systems

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

5 replies to this topic

### #1Diakon_Tristan  Members

Posted 16 August 2001 - 07:51 AM

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?

### #2Dragonus  Members

Posted 17 August 2001 - 10:23 AM

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

### #3Diakon_Tristan  Members

Posted 17 August 2001 - 10:16 PM

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.

### #4TerranFury  Members

Posted 19 August 2001 - 01:37 PM

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.

### #5Timkin  Members

Posted 19 August 2001 - 07:47 PM

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

### #6Dragonus  Members

Posted 20 August 2001 - 02:53 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?

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.