Normalizing Transformation

  1. Translate VRP to origin.
  2. Rotate the VRC system such that the VPN (n-axis)becomes the z-axis, the u-axis becomes the x-axis and the v-axis becomes the y-axis.
  3. Translate so that the CoP given by the PRP is at the origin.
  4. Shear such that the center line of the view volume becomes the z-axis.
  5. Scale so that the view volume becomes the cannonized view volume: y = z, y = -z, x=z, x = -z, z = zmin, z = zmax.

1. Translate VRP to origin

   1	   0	   0	   -VRPx)
   0	   1	   0	   -VRPy)
   0	   0	   1	   -VRPz)
   0	   0	   0	       1)

2. Rotate VRC

We want to take u into (1, 0, 0)
		v into (0, 1, 0)
		n into (0, 0, 1)

First derive n, u, and v from user input:
n = VPN / ||VPN||
u = (Vup x n) / ||Vup x n||
v = n x u

2. Rotate VRC (cont.)

  (ux	   uy	   uz	   0)
  (vx	   vy	   vz	   0)
  (nx	   ny	   nz	   0)
  (0	    0	    0	   1)

3. Translate so that the CoP given by the PRP is at the origin.

   (1   0   0   -PRPX)
   (0   1   1   -PRPy)
   (0   0   1   -PRPz)
   (0   0   0    1   )

4. Shear such that the center line of the view volume becomes the z-axis.

Center line of window lies along the vector [CW - PRP], this is the direction of projection, DoP.

	((umax + umin)/2)		(	PRPx	)
CW =	((vmax + vmin)/2)	PRP=	(	PRPy	)
	(	0       )		(	PRPz	)
	(	1	)		(	1	)

		  ((umax + umin)/2 -   PRPx	)
DoP = [CW-PRP] =  ((vmax + vmin)/2 -   PRPy	)
		  (	 0	   -   PRPz	)
		  (	 1	                )

The shear matrix must take this direction of projection and shear it to the z-axis , DoP' = [0, 0, DoPz].

	(	1	0	SHx	0 ) We want SH*DoP = DoP'
SH =	(	0	1	SHy	0 )
	(	0	0	1	0 )
	(	0	0	0	1 )

	(   1	   0	   SHx	   0 )	 ((umax + umin)/2  -   PRPx ) = (0)
	(   0	   1	   SHy	   0 )	 ((vmax + vmin)/2  -   PRPy ) = (0)
	(   0	   0	   1	   0 )	 (0	           -   PRPz ) =	(DoPz)
	(   0	   0	   0	   1 )	 (1	           -       1) =	(1)
				   
SHx = -DoPx/DoPz, SHy = -DoPy/DoPz

5. Scale

Scale is done in two steps:
1.  First scale in x and y.
       xscale = 2PRPz/(umax - umin).
       yscale = 2PRPz/(vmax - vmin).

2.  Scale everything uniformly such that the back clipping
    plane becomes z = 1.
       xscale = 1 / (PRPz + B)
       yscale = 1 / (PRPz + B)
       zscale = 1 / (PRPz + B)

Total Composite Transformation

Nper = Sper SHper T(-PRP) R T(-VRP)