#### Archived

This topic is now archived and is closed to further replies.

# Homogenous coord in vectors/matrices

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

## Recommended Posts

I''m having trouble understanding why a homogenous coordinate is used in vectors. I really don''t understand what the homogenous coord is used for in matrices either; every site I''ve looked at has just said "There should always be a 1 here; if you do that you don''t have to worry about it" etc. Well, now I''m implementing Vector and Matrix classes, and I''m not sure how to go about performing operations on the homogenous coord. If I perform {5,5,5,1} - {4,4,4,1} should the output be {1,1,1,0}? Or does w always stay at 1? Any advice/relevant links would be appreciated.

##### Share on other sites
Im not sure about this but i think the fourth component is a scale factor for example:

(1, 2, 3, 0.5) = (2, 4, 6, 1) = (6, 12, 18, 3)

if you dont know what it is then you probably dont need it and youd be better to always assume it to be 1 as the sites say.

##### Share on other sites
{5,5,5,1} means "the class of vectors of R^4 that are proportional to (5,5,5,1)". Similarly for {4,4,4,1}. The set of all these classes is known as P(R^4). Now, substracting two sets of elements of R^4 doesn''t make much sense. Actually, there is no good definition for an addition in P(R^4).

When dealing with affinities (typical transformation matrices in computer graphics are affinities), you can see them as projective transformations that preserve infinity. Points of R^3 are mapped to points of P(R^4) by (x,y,z)|->{x,y,z,1} for this purpose. But operations are defined in R^3, not in P(R^4).

In practical words: put the 1 at the end just for performing the transformation. Do everything else in R^3.

##### Share on other sites
alvaro is right, it does not make much sense adding/subtracting vectors of P(R^3) because their lengths do not matter in the first place due to duality and the fact that vectors in projective spaces are defined only up to a scale factor.
[x y z w] = [ax ay az aw]
But if you want to compute the affine or Euclidian completion/equivalence of
[5 5 5 1] - [4 4 4 1]
then I''d convert the vectors to affine/Euclidian coordinates first:
[5/1 5/1 5/1]-[4/1 4/1 4/1]=[5 5 5]-[4 4 4]=[1 1 1]

Note: This yields a point in the vector space of R^3.

1. 1
Rutin
22
2. 2
3. 3
4. 4
5. 5

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

• Total Topics
633308
• Total Posts
3011293
• ### Who's Online (See full list)

There are no registered users currently online

×