Using Lens Transformation to Draw 3D images on Screen

Draft. Used in some 3D applets.                   
                   
		       
	              basis in              
	              base space V
	                 /y            .  y' 
	                /          .    
	      Z,z|     /        .   basis in function's
	         |    /      .      domain space V'
	         |   / a  .
	         |  /  .
	         | /. 
	  -------|----------------- x,X
	         |.
	         |   . 
	         |      . 
	         |         .
	         |            . x'
	         
	
	         f: V' |--> |R
	    
        
        Counter clockwise rotation in plane xy: 
                   x = cx' - sy'   
                   y = sx' + cy'
                   z =           z'
                   s=sin(alpha)                  

                   or r=Tr'.            
                                   
                   Lens transformation in linear approximation,
                   x<<x0, z<<z0, y<<y0 (isometry?):
                   
                   (X'',Y'') ~ (x+x0,z+z0)(1-y/y0)
                   
                   x<<x0, z<<z0, y<<y0 (isometry?)
                   and with omitting constant members:                   
                   
                   (X'',Y'') = const' * (x-by*,-gy+z)
                        
                   or R''~Lr
                   
                   L ~ 1  b   0   =  K appended  0 
                       0  g   1                  1

                   b=-x0/y0
                   g=-z0/y0
                               
                   (X'',Y'') are relative to screen's center.

          Final coordinates: 
                   X=xCenter+X''
                   Y=yCenter-Y''     
                   

          Horizontal circles.
          ------------------
          
          The radius h circle in |R^2 will have equation:
            (QA,QA)=h^2 on screen,
            Q =  1  -b/g  =  K^-1
                 0   1/g
            
            
            Consider horizontal vectors, (X,Y), first.
                     
            (QA,QA)= (ggXX-2gbXY +bbYY) + YY.

            To diagonalize the matrix Q, we will use method sketched here:
            http://landkey.net/d/z/Essays/BetweenCurvedHills/
            Note, we change notations:
            
            A=gg
            B=-gb
            C=1+bb
            M=(gg+bb+1)/2
            D=(gg-bb-1)/2
            GG=DD+BB=
            
            4(MM-GG)=-4ggbb + MM-DD =-4ggbb+4ggbb+4gg greater than 0 if g is not 0.
            Hence, following division is safe:            
            yCompression=ymax/xmax=sqrt(YCoeff/XCoeff)=sqrt( (M+G)/(M-G) )
            
            
Copyright (C) 2008 Konstantin Kirillov.