{
	proj.cal - calculate image projection vector

Example:
	cnt 512 512 | rcalc -f proj.cal -e 'x=$1;y=$2' \
	-e 'VPx=15.3;VPy=10.1;VPz=-3.3;' \
	-e 'VDx=.394;VDy=-.731;VDz=-.053;' \
	-e 'VH=30;VV=30;' -e '$1=VPx;$2=VPy;$3=VPz;' \
	-e '$4=PDx;$5=PDy;$6=PDz;' | rtrace [rtrace options]

}
				{ View Point }
VPx = 0; VPy = 0; VPz = 0;
				{ View Up }
VUx = 0; VUy = 0; VUz = 1;
				{ View Direction }
VDx = 0; VDy = 1; VDz = 0;
				{ View Horizontal and Vertical angles }
VH = 45; VV = 45;
				{ X and Y resolution }
X = 512; Y = 512;
				{ Projected Direction (computed) }
PDx = NVDx + h*IHx + v*IVx;
PDy = NVDy + h*IHy + v*IVy;
PDz = NVDz + h*IHz + v*IVz;
h = x - (X-1)/2; v = y - (Y-1)/2;
				{ Normalized View Direction }
NVDx = VDx/VDl; NVDy = VDy/VDl; NVDz = VDz/VDl;
VDl = sqrt(VDx*VDx + VDy*VDy + VDz*VDz);
				{ Increment Horizontal }
IHx = IHF*NTIHx; IHy = IHF*NTIHy; IHz = IHF*NTIHz;
NTIHx = TIHx/TIHl; NTIHy = TIHy/TIHl; NTIHz = TIHz/TIHl;
TIHx = VDy*VUz-VDz*VUy; TIHy = VDz*VUx-VDx*VUz; TIHz = VDx*VUy-VDy*VUx;
TIHl = sqrt(TIHx*TIHx + TIHy*TIHy + TIHz*TIHz);
IHF = 2*tan(PI/180/2*VH)/X;
				{ Increment Vertical }
IVx = IVF*(NTIHy*NVDz-NTIHz*NVDy);
IVy = IVF*(NTIHz*NVDx-NTIHx*NVDz);
IVz = IVF*(NTIHx*NVDy-NTIHy*NVDx);
IVF = 2*tan(PI/180/2*VV)/Y;

PI = 3.14159265358979323846;
