Sign in to follow this  

Athithmetic on vectors in Homogeneous space....

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am wondering how we define basic arithmetic on homogeneous 4d vectors of the form {x, y, z, w}. For example do we extend vector addition as usual and simply add w components? If we do that then the addition of a vector plus an infinite vector results in a vector that isn't infinite. {1, 0, 0, 0} + {0, 1, 0, 1} = {1, 1, 0, 1} ?????

Share this post


Link to post
Share on other sites
A w coordinate of 0 indicates a vector. A w coordinate of 1 indicates a point. Addition two vectors to each other produces a vector. Adding a vector and a point together produces a new point.

Share this post


Link to post
Share on other sites
Well, what SiCrane said is not exactly what homogeneous coordinates are. In homogeneous coordinates, [1:0:0:0] and [2:0:0:0] are two representations of the same thing, and therefore a definition of an operation that yields different results for those two representations is not a good definition.

Homogeneous coordinates of the form [x:y:z:w] are not vectors; they are points of a three-dimensional projective space. Adding them doesn't make sense, but you can join points by lines, intersect lines, find the plane that contains a line and passes through some external point, etc. These operations work better in projective space than in affine space. For instance, a plane and a line that is not contained in it always have an intersection (i.e., there are no parallels).

[EDIT: I changed the unusual notation {x, y, z, w} for homogeneous coordinates (which usually would mean the set which contains exactly those elements) by the more common [x:y:z:w]; I have also seen simply [x,y,z,w]. ]

[Edited by - alvaro on January 6, 2008 7:31:20 PM]

Share this post


Link to post
Share on other sites
Even though your matrix works on 4D homogenized vectors, you are still dealing with 3D vectors. Addition, dot product, and cross product use their 3D definitions and do not explicitly define the fourth coordinate. If you're only working with with points then the fourth coordinate will always be one, but if you need to manipulate direction vectors then the fourth coordinate will sometimes be 0.

However, if you're not incredibly pressed for speed (or you don't perform the operation very much) you can represent direction vectors as two points, then transform both points and subtract to get the transformed direction. Then you can just assume all the fourth coordinates are 1, and this will actually remove a few multiplications from your transformation method.

That doesn't apply to normals though. They are a little bit different, and you'll have to do something different for them anyways:
http://www.unknownroad.com/rtfm/graphics/rt_normals.html

Share this post


Link to post
Share on other sites
As alvaro said homogenous coordinates are not vectors but points in the 3D projective space and you can’t add them in that way.

It’s possible to define a base of the projective space using n+2 points (in this case 5) and use that to define a sum in the projective space. It’s useful if you really need to work with points in the projective space but usually you can simply set the w components to 0 if you are working with vectors and 1 if you are working with points.

[Edited by - apatriarca on January 6, 2008 8:20:03 PM]

Share this post


Link to post
Share on other sites

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

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this