unorm_c

Index Page unorm_c
A B C D E F G H I J K L M N O P Q R S T U V W X
Procedure Abstract Required_Reading Keywords Brief_I/O Detailed_Input | Detailed_Output Parameters Exceptions Files Particulars Examples | Restrictions Literature_References Author_and_Institution Version Index_Entries
#### Procedure
       void unorm_c ( ConstSpiceDouble     v1[3],
                      SpiceDouble          vout[3],
                      SpiceDouble        * vmag    )
#### Abstract
       Normalize a double precision 3-vector and return its magnitude.
#### Required_Reading
       None.
#### Keywords
       VECTOR
#### Brief_I/O
       VARIABLE  I/O  DESCRIPTION
       --------  ---  --------------------------------------------------
       v1         I     Vector to be normalized.
       vout       O     Unit vector v1 / |v1|.
                        If v1 is the zero vector, then vout will also
                        be zero. vout can overwrite v1.
       vmag       O     Magnitude of v1, i.e. |v1|.
#### Detailed_Input
       v1      This variable may contain any 3-vector, including the
                zero vector.
#### Detailed_Output
       vout    This variable contains the unit vector in the direction
               of v1.  If v1 is the zero vector, then vout will also be
               the zero vector.
       vmag    This is the magnitude of v1.
#### Parameters
       None.
#### Exceptions
       Error free.
#### Files
       None
#### Particulars
       unorm_c references a function called vnorm_c (which itself is
       numerically stable) to calculate the norm of the input vector v1.
       If the norm is equal to zero, then each component of the output
       vector vout is set to zero.  Otherwise, vout is calculated by
       dividing v1 by the norm.
#### Examples
       The following table shows how selected v1 implies vout and mag.

       v1                    vout                   mag
       ------------------    ------------------     ------
       (5, 12, 0)            (5/13, 12/13, 0)       13
       (1D-7, 2D-7, 2D-7)    (1/3, 2/3, 2/3)        3D-7
#### Restrictions
       None
#### Literature_References
       None
#### Author_and_Institution
       W.M. Owen       (JPL)
       W.L. Taber      (JPL)
#### Version
       -CSPICE Version 1.1.0, 22-OCT-1998 (NJB)

          Made input vector const.

       CSPICE Version 1.0.0, 17-OCT-1997   (EDW)
#### Index_Entries
       3-dimensional unit vector and norm
#### Link to routine unorm_c source file unorm_c.c

    Thu Apr 16 08:59:27 2009