*-- Author : R. Henderson 24/10/94 SUBROUTINE FPNDCA(TODIG,VDIG,TOCLS,VCLS,DIST) C------------------------------------------------------------ C----- FIND dca for the vectors a = todig + x*vdig C----- and the vectors b = tocls + x*vcls C------------------------------------------------------------ DOUBLE PRECISION AX(3,3),BTRIX(3),ADET,A1,A2,A3 DIMENSION TODIG(3),VDIG(3),TOCLS(3),VCLS(3),TCP(3) C------------------------------------------------------------ TCP(1) = VCLS(2)*VDIG(3) - VCLS(3)*VDIG(2) TCP(2) = VCLS(3)*VDIG(1) - VCLS(1)*VDIG(3) TCP(3) = VCLS(1)*VDIG(2) - VCLS(2)*VDIG(1) AX(1,1) = VCLS(1) AX(1,2) = VCLS(2) AX(1,3) = VCLS(3) AX(2,1) = -VDIG(1) AX(2,2) = -VDIG(2) AX(2,3) = -VDIG(3) AX(3,1) = TCP(1) AX(3,2) = TCP(2) AX(3,3) = TCP(3) ADET = AX(1,3)*(AX(2,2)*AX(3,1) - AX(2,1)*AX(3,2)) & - AX(2,3)*(AX(1,2)*AX(3,1) - AX(1,1)*AX(3,2)) & + AX(3,3)*(AX(1,2)*AX(2,1) - AX(2,2)*AX(1,1)) A1 = AX(1,3)*AX(2,2) - AX(1,2)*AX(2,3) A2 = AX(1,1)*AX(2,3) - AX(1,3)*AX(2,1) A3 = AX(1,2)*AX(2,1) - AX(1,1)*AX(2,2) BTRIX(1) = TOCLS(1) - TODIG(1) BTRIX(2) = TOCLS(2) - TODIG(2) BTRIX(3) = TOCLS(3) - TODIG(3) VMOD = TCP(1)**2 + TCP(2)**2 + TCP(3)**2 DIST = (A1*BTRIX(1) + A2*BTRIX(2) + A3*BTRIX(3))*SQRT(VMOD)/ADET RETURN END *