JC_Title	VECTSP General 3-dimension vector geometry package, many routines CC_Args*C  Argument order is: INPUT _space_ OUTPUTJC_DESCRIPTION  The routine VECTSP is a general 3-dimension vector geometryMC package, with many routines.  Output argument may overwrite input argument C for routines:"C  VNORM, VSUB, VADD, VNEG, VSCALEC_Hist	H. Kieffer 1975$C  Revised 1982Jan12 84May24 84Oct26;C  H.Kieffer 85Apr12; change argument order from algebraic AC  1985 Oct17 Change variable symbols; document to NIMS standardsC_PauseFC  ** This is single precision version; to generate a double precisionHC  **   version, make the following changes throughout (more for VSUB84)C  **  REAL*4 > REAL*8C  **  SQRT > DSQRT !C  **  E0 > D0     E15.6 > D22.13,C  **  Make similar changes to documentation&	SUBROUTINE VADD (U,V, W)		! W = U + V)C_Title	VADD Add two vectors of length 3	C_Args&	REAL*4 U(3)	! [I] Vector to be added.&	REAL*4 V(3)	! [I] Vector to be added.;	REAL*4 W(3)	! [O] Sum of two vectors; may overwrite input.C_Keys	MATH VECTORBC_Desc	Add two vectors of length 3 to resulting in a third vector.C_Call	None.=C_Hist	85Oct17 H.Kieffer, U.S.G.S.,Flagstaff. See VECTSP.FOR C_Paus	DO 9 I=1,39		W(I)=U(I)+V(I)	RETURN	END(	SUBROUTINE VCROSS (U,V, W)		! W = U X V8C_Title	VCROSS Cross product of two vectors of length 3.C_Args!	REAL*4  U(3) ! [I] First vector."	REAL*4  V(3) ! [I] Second vector.<	REAL*4  W(3) ! [O] Cross product; must not overwrite input.C_Keys	MATH VECTOR4C_Desc  Calculates the cross product of two vectors.C_Call	0=C_Hist	85Oct17 H.Kieffer, U.S.G.S.,Flagstaff. See VECTSP.FOR C_Paus	W(1)=U(2)*V(3)-U(3)*V(2)	W(2)=U(3)*V(1)-U(1)*V(3)	W(3)=U(1)*V(2)-U(2)*V(1)	RETURN	END	SUBROUTINE VDOT (U,V, R)		CC_Title	VDOT Calculates the Dot product of two vectors of length 3.C_Args!	REAL*4  U(3) ! [I] First vector."	REAL*4  V(3) ! [I] Second vector.;	REAL*4  R    ! [O] Dot product of two vectors of length 3.C_Keys	MATH VECTORBC_Desc	Produces the dot product of two vectors of length 3, R=U.V.	C_Call		0=C_Hist	85Oct17 H.Kieffer, U.S.G.S.,Flagstaff. See VECTSP.FOR C_Paus&	R = U(1)*V(1) + U(2)*V(2) + U(3)*V(3)	RETURN	END"	SUBROUTINE VEQUAL (V, W)		! W = V9C_Title	VEQUAL Equate one vector of length 3, to another.C_Args#	REAL*4  V(3) ! [I] Initial vector )	REAL*4  W(3) ! [O] Vector equal to inputC_Keys	MATH VECTOR6C_Desc	Equates a vector of length 3 to another vector.C_Call	0=C_Hist	85Oct17 H.Kieffer, U.S.G.S.,Flagstaff. See VECTSP.FOR C_Paus	DO 13 I=1,3
13		W(I)=V(I)	RETURN	END	SUBROUTINE VNEG (V, W)			9C_Title	VNEG Negate each element of a vector of length 3.C_Args(	REAL*4  V(3) ! [I] Vector to be negatedO	REAL*4  W(3) ! [O] Vector of negated elements of vector U; may overwrite inputC_Keys	MATH VECTORGC_Desc  The input vector is negated, producing a negated output vector.C_Call	0=C_Hist	85Oct17 H.Kieffer, U.S.G.S.,Flagstaff. See VECTSP.FOR C_Paus	DO 10 I=1,310		W(I)=-V(I)	RETURN	END	SUBROUTINE VNORM (V, W)			-C_Title	VNORM Normalize a vector of length 3.C_Args+	REAL*4  V(3) ! [I] Vector to be normalized>	REAL*4  W(3) ! [O] Vector of unit length; may overwrite inputC_Keys	MATH VECTORDC_Desc  Normalizes a vector of size three unit length.  W = V / |V|.C_Call	0=C_Hist	85Oct17 H.Kieffer, U.S.G.S.,Flagstaff. See VECTSP.FOR C_Paus		REAL*4 E 	E = V(1)**2 + V(2)**2 + V(3)**2	E = 1.E0/SQRT(E)	DO 3 I=1,33		W(I) = E * V(I)	RETURN	END 	SUBROUTINE VPRINT(ID,V,IOP)*C_Title	VPRINT Print a vector of length 3.C_Args=	CHARACTER*(*)  ID    ! [I] Character variable identification'	REAL*4 V(3)	     ! [I] Vector to print2	INTEGER  IOP	     ! [I] Logical unit for printer	C_Keys	MATH VECTORIC_Desc  Prints a vector of length three to the logical unit specified by C       the user.C_Call	0=C_Hist	85Oct17 H.Kieffer, U.S.G.S.,Flagstaff. See VECTSP.FOR C_Paus	WRITE(IOP,34) ID,V*34	FORMAT('0VPRINT DUMP OF: ',A/5X,3E15.6)	RETURN	END(	SUBROUTINE VSCALE (R,V, W)		! W = R * V;C_Title	VSCALE Multiply a vector of length 3 by a constant.C_Args%	REAL*4  R	! [I] Constant multiplier./	REAL*4  V(3)    ! [I] Vector to be multiplied.R	REAL*4  W(3)	! [O] Product of a vector and a constant; may overwrite input vectorC_Keys	MATH VECTORPC_Desc  Multplies a one dimensional array of length 3 by a constant R producing (C       a third one dimensional array W.C_Call	0=C_Hist	85Oct17 H.Kieffer, U.S.G.S.,Flagstaff. See VECTSP.FOR C_Paus	DO 11 I=1,311		W(I)=R*V(I)	RETURN	END	SUBROUTINE VSUB (U,V, W)=C_Title	VSUB Take the difference of two vectors, of length 3.C_Args&	REAL*4  U(3)   ! [I] Vector, initial -	REAL*4  V(3)   ! [I] Vector to be subtractedJ	REAL*4  W(3)   ! [O] Difference of two input vectors; may overwrite inputC_Keys	MATH VECTOR8C_Desc	Difference of two vectors of length 3.	W = U - V.C_Call	0=C_Hist	85Oct17 H.Kieffer, U.S.G.S.,Flagstaff. See VECTSP.FOR C_Paus	DO 8 I=1,38		W(I)=U(I)-V(I)	RETURN	END	SUBROUTINE VSUB84 (U,V, W)		LC_Title	VSUB84 Find the 4-byte difference of two 8-byte vectors of length 3.C_Args"	REAL*8  U(3)	! [I] Initial vector,	REAL*8  V(3)	! [I] Vector to be subtracted E	REAL*4  W(3)	! [O] Difference of two input vectors; single precisionC_Keys	MATH VECTORMC_Desc  Performs a single precision difference of 2 double precision vectors GC       of length 3 resulting in a single precision vector. W = U - V. C_Call	0=C_Hist	85Oct17 H.Kieffer, U.S.G.S.,Flagstaff. See VECTSP.FOR C_Paus		DO I=1,3		W(I)=U(I)-V(I)		ENDDO	RETURN	END9	SUBROUTINE VUNIT (N, U)			! U = UNIT VECTOR ALONG AXIS NC_Title	VUNIT C_Args5	INTEGER  N	! [I] Axis along which vector will point.+	REAL*4  U(3)	! [O] Unit vector along axis.C_Keys	MATH VECTOREC_Desc  Creates a unit vector of length three along a cartesian axis.DC     If N is not 1 through 3 then the module returns a zero vector.C_Call	0=C_Hist	85Oct17 H.Kieffer, U.S.G.S.,Flagstaff. See VECTSP.FOR C_End	DO 12 I=1,3
12		U(I)=0.E0#	IF (N.GE.1 .AND. N.LE.3) U(N)=1.E0	RETURN	END