View Full Version : Normalizing a Matrix

Fernando

06-03-2002, 06:18 PM

Hi guys! This is a simple question, but I have to ask...

How do I normalize a Matrix?

I have searched on the WEB and saw a lot of different formulas to do this, and now I'm getting confused!

Can anyone explain this to me?

Thank you a lot!

Fernando

Fernando,

What do you expect to achieve by normalizing a matrix?

I know how to normalize vectors, but AFAIK there's no such equivalent for matrices (they don't have a 'size' that can be used to reduce its elements in such a way that this size becomes 1).

And 'normalizing' the individual rows or columns of a matrix results in another matrix with a not-so-obvious relation if any to the original matrix.

Jean-Marc

Fernando

06-04-2002, 02:26 AM

Thank JML!

Let me explain!

I'm trying to make my own function of gluProject.

In the Blue Book, there is a explanation in how to do that. I have extremely sure I did all the things were wrote there, but it didn't work.

Then I think it is because I didn't normalize my vectors (like you told me).

How DO I normalize then?

Thank you!

Fernando

Jeeeez

06-04-2002, 10:05 AM

To normalize a vector

v1=(x0,y0,z0)

d=sqrt(x0*x0 + y0*y0 + z0*z0)

x1=x0/d

y1=y0/d

z1=z0/d

this is your new normalized vector (x1,y1,z1)

check this article out: http://www.gamedev.net/reference/articles/article1089.asp

hope that helps

Jeremy

Fernando

06-04-2002, 02:08 PM

Helped a lot, Thank you Jeeeez!

Gavin

06-05-2002, 06:28 AM

Hmmmmm, random guesses here....

vec normalised = vec / |vec|

so maybe

mat norm = mat/|mat|

saying that a matrix can;t have a size......

well

|mat| =determinant Mat

Batti

06-05-2002, 06:41 AM

|mat| =determinant Mat

Hi!

We discussed that in math. I had the same idea once, too, and your equation above would have simplified a prove incredibly.

But..Iīm sorry, |mat| is not defined (if I remember it correctly, at least it does not work like that)

Have a nice day

Batti

edit: But I maybe wrong http://www.opengl.org/discussion_boards/ubb/smile.gif

[This message has been edited by Batti (edited 06-05-2002).]

gumby

06-05-2002, 01:10 PM

Actually, there are definitions for several

different matrix norms.

A norm must only satisfy 3 properties:

1. |A| > 0

2. |kA| = |k| |A|

3. |A+B| <= |A|+|B|

What I imagine you are really wanting to do is reorthogonalize the column vectors of a transformation matrix( which has become "unnormalized" by repeated multiplication).

If this is what you mean, look up "Gram-Schmidt orthogonalization".

Batti

06-06-2002, 12:41 AM

Hi!

So how is |mat| defined? If it really equals det mat, Iīm gonna paint my teacherīs house green and eat his dog.

Never could I stand him.

gumby

06-06-2002, 07:35 AM

There are several matrix norms, just like there are several for vectors. The simplest is the Frobenius norm which is just the sqrt of the sum of the squares for real-valued matrices. Some of the other norms are functions of the eigenvalues of the matrix. Haven't seen one in terms of the determinant though.

Thank you for your help guys!

But I have a question...

What is the correct way?

this?

var = (x * x + y * y + z * z);

vector.x = vector.x / var;

vector.y = vector.y / var;

vector.z = vector.z / var;

or this?

vector.x = vector.x / vector.w;

vector.y = vector.y / vector.w;

vector.z = vector.z / vector.w;

(where 'w' is the forth item of vector)

I'm asking this because I've seem people using this two forms.

Thank you again

Fernando

gumby

06-06-2002, 10:55 AM

The first is normalization. The second looks like it

is meant to be perspective division.

nickels

06-07-2002, 07:50 AM

Matrix norm:

A be a matrix.

|A| = max{|Ax| such that |x| == 1}

Here |x| and |Ax| is the vector norm.

I forget the name of this norm, but it is a pretty common one. I think it is the p-norm.

Only mathematicians care about such things. Vector norms are enough for GL.

Also, Fernando, the first norm is the vector norm. The second is normalizing from homogenous coordinates. Since the real world is only 3-d, only the first three matter, to some extent. However, if the fourth place is not 1 (can be made one by your second algorithm), the first three numbers are not correct.

[This message has been edited by nickels (edited 06-07-2002).]

Powered by vBulletin® Version 4.2.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.