vhatip |
Table of contents
ProcedureVHATIP ( "V-Hat", 3-d unit vector along V, in place ) SUBROUTINE VHATIP ( V ) AbstractScale a three-dimensional vector to unit length. Required_ReadingNone. KeywordsVECTOR DeclarationsIMPLICIT NONE DOUBLE PRECISION V ( 3 ) Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- V I-O Vector to be normalized/unit vector. Detailed_InputV is any double precision, 3-dimensional vector. If this vector is the zero vector, this routine will detect it, and will not attempt to divide by zero. Detailed_OutputV is the unit vector in the direction of the input vector. If on input V represents the zero vector, then V will be returned as the zero vector. ParametersNone. ExceptionsError free. 1) The zero vector is returned if the input value of V is the zero vector. FilesNone. ParticularsThis routine is provided for situation where it is convenient to scale a vector to unit length in place rather than store the result in a separate variable. Note that the call CALL VHAT ( V, V ) is not permitted by the ANSI Fortran 77 standard; this routine can be called instead to achieve the same result. VHATIP determines the magnitude of V and then, if the magnitude is non-zero, divides each component of V by the magnitude. This process is highly stable over the whole range of 3-dimensional vectors. ExamplesThe following table shows how selected vectors are mapped to unit vectors V on input V on output ------------------ ------------------ (5, 12, 0) (5/13, 12/13, 0) (1D-7, 2D-7, 2D-7) (1/3, 2/3, 2/3) Restrictions1) There is no known case whereby floating point overflow may occur. Thus, no error recovery or reporting scheme is incorporated into this subroutine. Literature_ReferencesNone. Author_and_InstitutionN.J. Bachman (JPL) J. Diaz del Rio (ODC Space) H.A. Neilan (JPL) W.M. Owen (JPL) W.L. Taber (JPL) VersionSPICELIB Version 1.2.0, 20-AUG-2021 (JDR) Added IMPLICIT NONE statement. Edited the header to comply with NAIF standard. SPICELIB Version 1.1.0, 01-SEP-2005 (NJB) (HAN) (WMO) (WLT) |
Fri Dec 31 18:37:05 2021