With homogeneous coordinates, there are four components to represent a 3d vertex or a 3d vector :
- if w != 0 , ( x , y , z , w ) represents the vertex ( x/w , y/w , z/w )
- if w = 0 , it represents all the vectors colinear to the vector ( x , y , z ). [ i.e. : a * ( x , y , z ) , a in lR* ]
So for a vertex ( x , y , z ) transformed into ( x' , y' , z' ) with Transform :
- ( X , Y , Z , W ) = ( x , y , z , 1 ) * Transform
- ( x' , y' , z' ) = ( X , Y , Z ) / W
For the vertices, the w component is usually initially set to 1 so that the w division is not needed in rotations, translations, scalings, and any combination of them.
With this assumption, the w division is necessary only when Transform is (or 'contains') a projection matrix.