Surface normal
The relationship between the normal (x,y,z) in Euclidean space
and the normal (
,
) in polar coordinate.
    
=arccos(z) 
    
=atan2(y,
        x) 
Where the following conditions hold.
    - 0

<
 
    - 0

<2
 
    - sqrt(x2+y2+z2)=1
 
    
 is the
        angle between z axis and the normal 
    
 is the
        direction from positive z axis to the normal 
    
 is the
        angle between x axis and the vector where the normal is
        projected to xy plane 
    
 is the
        direction from positive x axis to positive y axis 
    - atan2(y,x) is a function which calculates arctan(y/x)
            - It is the same for atan2() in ANSI C
 
            - If x==0 then atan2 returns 0
 
            - atan2 returns the value between -
 to 
 
            - So, add 2
 if atan2 returns a negative value 
        
     
Back