PDA

View Full Version : Matrix Multiplication

Syslock
07-21-2002, 06:52 PM
Is matrix multiplication dependent on whether the coordinate system
is LH or RH?

In other words, I would be using row vectors for a LH system, and
column vectors for a RH system.

Take this example:

for( INT i=0; i < 4; i++ )
for( INT j=0; j < 4; j++ )
for( INT k=0; k < 4; k++ )
M(i, j) += A(i, k) * B(k, j);

Can this function be used for both types of systems?

I'm just trying to track down some problems am I having with my math library.

[This message has been edited by Syslock (edited 07-21-2002).]

SirKnight
07-21-2002, 07:51 PM
Well i only work with the right handed system but yes the matrices for both systems will be a little different. I remember reading something about the rotation matrix and how it looks different for RH and LH. I think it was on flipcode or gamedev.net. One of those two sites i read this on. It's not likes its a HUGE diffrence though. Just a sign difference pretty much.

-SirKnight

V-man
07-21-2002, 09:26 PM
Yes, I think the difference would be in the values you put in the matrix.

The way matrices are multiplies is always

AB = C

RH or LH is relavent to coordinate systems.

V-man

kieranatwork
07-22-2002, 01:27 AM
Originally posted by Syslock:
Can this function be used for both types of systems?

Yes.

Syslock
07-22-2002, 08:01 AM
So, if I was trying to import a file with a strange coordinate system,
I couldn't use my matrix math library on it unless I correct it beforehand?

fresh
07-22-2002, 08:52 AM
Yes you'll have to convert it first. Once you do, your matrix library should work fine. Also both post and pre-multiplication are OK,depending on what your goal is. Both have meaning. If A and B are transform matrices and v is a column vector, then

(A * B) * v, means first apply B to v then A
(B * A) * v , means first apply A to v then B