C THIS SUBROUTINE CALCULATES THE ROTATIONAL MATRIX
C			BY DR. J.A.FIELD
C			   DEPT. OF ELECTRICAL ENGINEERING
	SUBROUTINE ROTER
	REAL N
	COMMON/GRXPQK/S11,S12,S13,S21,S22,S23,S31,S32,S33,T11,T22,T33
	COMMON/EYCEP/XO,YO,ZO,XC,YC,ZC,XV,YV,ZV
	ASTAR = XC - XO
	BSTAR = YC - YO
	CSTAR = ZC - ZO
	ESTAR = XV - XC
	FSTAR = YV - YC
	GSTAR = ZV - ZC
	H = SQRT(ASTAR*ASTAR +BSTAR*BSTAR +CSTAR*CSTAR)
	IF (H.EQ.0.0) STOP 123123
	A = ASTAR / H
	B = BSTAR / H
	C = CSTAR / H
	PSTAR = ESTAR*A + FSTAR*B + GSTAR*C
	N = SQRT(ESTAR*ESTAR +FSTAR*FSTAR +GSTAR*GSTAR -PSTAR*PSTAR)
	IF (N.EQ.0.0) STOP 123123
	E = ESTAR / N
	F = FSTAR / N
	G = GSTAR / N
	P = PSTAR / N
	S11 = B*G - C*F
	S12 = C*E - A*G
	S13 = A*F - B*E
	S21 = E - A*P
	S22 = F - B*P
	S23 = G - C*P
	S31 = A
	S32 = B
	S33 = C
	T11 = -(S11*XO + S12*YO + S13*ZO)
	T22 = -(S21*XO + S22*YO + S23*ZO)
	T33 = -(S31*XO + S32*YO + S33*ZO)
	RETURN
	END
