Reason for 1x4 matrix for 3D points?

Started by
8 comments, last by ThrillKillKult 22 years, 1 month ago
In one of the tutorials on this site, it says that a 3D point can be represented as a 1x4 matrix, which in turn can be multiplied by 4x4 matrices to tranlate,rotate etc. My question is, why not a 1x3 matrix multiplied by a 3x3? Whats the 4 column for? Thanks!
Advertisement
Hi,

I think that you need 1x4 matrices to be able to translate your point.

There''s no 3x3 matrix which can translate your point. You can build 3x3 rotation matrices, scaling matrices, etc., but if you also want to translate your point, you need to add a 4th coordinate which value is always 1 (it''s not really a coordinate, you are ''cheating''). By doing so and augmenting your 3x3 matrices by a row and line, you can build also translation matrices.

Hope I was clear enough
the fourth element basically lets you treat addition as a multiplication. this allows you to treat all the transformations the same way.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
It''s called homogeneous coordinates. As CrazedGenius said, it''s used to perform translation with the fourth column (or row : depends on your notation M*V or V*M). Then you can combine in a matrix several transformations (rotation,scaling,translation...).
I know that I don't know nothing... Operation Ivy
you can use 4x3 matrices with 3x1 vectors, it''s sometimes faster..

rapso->greets();
The fourth element of the vector is the so-called w-coordinate. It multiplies the x, y, and z coordinates by a given value. The defaultvalue of w is 1.
Another reason is that many modern processors can load 16 bytes at a time into 16 byte/128 bit registers very quickly. But the blocks of 16 bytes have to be aligned on 16 byte boundaries.

For floats this means loading floats 4 at a time with 4-float boundaries. Even if you only need three x, y, and z coordinates it is usually quicker to load four at once than load three seperately. And as they have to be aligned to 4-float boudaries you save no memory by only loading and storing 3 at a time, unless you perform some relatively expensive packing.

The same applies to matrices: it''s not much more expensive to use 4x4 matrices than 3x3 matrices, and you gain the benefit of being able to work in homogeneous coordinates by doing so.
John BlackburneProgrammer, The Pitbull Syndicate
You also need the w coordinate for perspective projections. After applying the matrix, you homogeonize the coordinates by making all the w''s equal to 1.
And another thing... You know that linear transformations must map the 0 vector to itself. Since we often must translate the origin, it is obvious that we must somehow represent the origin with some other vector that isn''t 0, and one of the ways to do this is to make everything happen on the 4-d hyperplane w=1.
AH! ok, i see now, thanks alot dudes!

This topic is closed to new replies.

Advertisement