Homogenous coord in vectors/matrices
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.
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.
(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.
{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.
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.
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.
[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.
----------------------- }EPHERE{-----------------------
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement