# bottom row of 4x4 matrix

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

## Recommended Posts

Could someone please tell me when the bottom row of a 4x4 matrix will not equal: 0 0 0 1 I know there must be instances when this is the case or you wouldn't have to normalize x, y, and z by dividing by w. However, I thought scaling and rotation only affect the first 3x3, and translation only affects the top 3 in the last column. Mike C. http://www.coolgroups.com/zoomer/

##### Share on other sites
In all isometric tranformations it will be 0001. Same with scaling each coordinate. Generally: in all linear 3D transformations + offsets.

When you do need to perform some other operations apart from multiplying and adding, as matrix/vector operations only do that, you do need to accumulate some info in w vector coordinate, to explicilty do something with it later (divide xyz/w, for example).

This is used in non-orthographic projections, for example.
Check out how it looks, in gl reference documentaiton.
/def

##### Share on other sites
What do you mean by isometric transformations?

I'm using OpenGL for a skeletal animation system, and I'm just doing scaling, rotation, and translation. The w coord is not equal to 1.

I did have a call to gluPerspective. Could that change it?

Right now, I'm getting the absolute value of a point like so:

GLfloat matrix[16];
glGetFloatv(GL_MODELVIEW_MATRIX, matrix);
newpoint.x = matrix[12]/matrix[15];
newpoint.y = matrix[13]/matrix[15];
newpoint.z = matrix[14]/matrix[15];

If I take out the /matrix[15], it doesn't work right.

Mike C.
http://www.coolgroups.com/zoomer/

Quote:
 Original post by defferIn all isometric tranformations it will be 0001. Same with scaling each coordinate. Generally: in all linear 3D transformations + offsets.When you do need to perform some other operations apart from multiplying and adding, as matrix/vector operations only do that, you do need to accumulate some info in w vector coordinate, to explicilty do something with it later (divide xyz/w, for example).This is used in non-orthographic projections, for example.Check out how it looks, in gl reference documentaiton./def

##### Share on other sites
Quote:
 Original post by mike74What do you mean by isometric transformations?

By definition - transformations saving distances between points.
dist(p,q) == dist(f(p),f(q))
So translations and rotations are ok.

Quote:
 I'm using OpenGL for a skeletal animation system, and I'm just doing scaling, rotation, and translation.

And that should suffice, skeletal animation consists only of linear transformations.

Quote:
 The w coord is not equal to 1.

'w' coord of... what? vector after transformations? Matrix column?

Quote:
 I did have a call to gluPerspective. Could that change it?

You should not normally use perspective transformations for anything other than rendering. IOW don't touch the result on GL_PROJECTION matrix stack.
If you called gluPerspective while having GL_MODELVIEW active, it will most likely cause a disaster. In other cases, you should not be directly concerned about 'w' coordinate at all.

Quote:
 Right now, I'm getting the absolute value of a point like so:GLfloat matrix[16];glGetFloatv(GL_MODELVIEW_MATRIX, matrix);newpoint.x = matrix[12]/matrix[15]; newpoint.y = matrix[13]/matrix[15];newpoint.z = matrix[14]/matrix[15];If I take out the /matrix[15], it doesn't work right.

So what is this all for afterall?

##### Share on other sites
By w coordinate, I mean the fourth element of the point vector, which is usually 1. So, does scaling affect the bottom row of the 4x4 matrix? Scaling does not seem to be an isometric transform but you implied it didn't affect the bottom row.

Mike C.
http://www.coolgroups.com/zoomer/

##### Share on other sites
Scaling is a linear transform. All linear transformations in 3D can be expressed using only 3x3 matrices. The rest part is obsolete then, thus is set to identity values.
Translation is not linear, but it's isometric, so doesn't affect the bottom row either.

##### Share on other sites
Well, does a concatenation of scaling, translation, and rotation affect the bottom row? I still don't see when it's affected.

Mike C.
http://www.coolgroups.com/zoomer/

##### Share on other sites
Take two matrices with botom row 0001 and multiply them. See what happens.

Quote:
 original post by mike74I still don't see when it's affected.

Why don't you simply debug your program? Usually all becomes clear then...

##### Share on other sites
Here's my matrix before calling gluPerspective(90.0f,1 ,0.1f,100.0f):

1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1

Here is it afterwards:

1 0 0 0
0 1 0 0
0 0 -1.002002 -0.200200
0 0 -1 0

Should gluPerspective be doing this weirdness to my matrix?

Mike C.
http://www.coolgroups.com/zoomer

##### Share on other sites
By isometric transforms deffer means that your matrix should be normalized as well as having the 3 axes orthogonal to each other.

Calling gluPerspective would not make your homogeneous(w) coord negative. Why it does that to you, I have no idea.
gluPerspective does this (I think ;*))

1. Subtract view from pos to get the inverse forward vec
2. Cross Up and forward to get the right vector
3. Normalize all the vectors
4. Fill the transpose of the object matrix, thereby making a camera matrix
5. Translate with negative translation

So basically deffer is right in saying that the matrix should be isotropic and would not affect your bottom row.

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5

• 9
• 14
• 9
• 9
• 9
• ### Forum Statistics

• Total Topics
632919
• Total Posts
3009208
• ### Who's Online (See full list)

There are no registered users currently online

×