Welcome to the L3 Harris Geospatial documentation center. Here you will find reference guides and help documents.
﻿
>  Docs Center  >  Libraries  >  Markwardt  >  UNITIZE

UNITIZE

UNITIZE

## Author

Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770
craigm@lheamail.gsfc.nasa.gov
UPDATED VERSIONs can be found on my WEB PAGE:
http://cow.physics.wisc.edu/~craigm/idl/idl.html

## Purpose

Construct a unit vector from a vector

Geometry

U = UNITIZE(V)

## Description

The function UNITIZE accepts any vector as input, and returns a
unit vector. The returned vector has the same direction as V but
a unit magnitude. (using L2 norm)
Mostly commonly UNITIZE will be used on 3-vectors. The input V
may either be a single 3-vector (i.e. DBLARR(3)) or it may be an
array of N 3-vectors, (i.e. DBLARR(3,N)). The returned array will
have the same structure as V.
UNITIZE also works on vectors with arbitrary numbers of
components. All that is required is that the vector components be
the first dimension of the input array V.

## Inputs

V - input array, commonly a 3-vector for a single vector, or a 3xN
array for N vectors. It is also possible to pass any array
DBLARR(M,n1,n2,n3,...).

## Returns

The resulting unitized vector or vectors. The output has the same
dimension as the input, V.

NONE

## Example

print, unitize([3d,4d,0d])
==> [0.6, 0.8, 0.0]

UNITVECANG, ANGUNITVEC, CROSSP, QTNORMALIZE

## Modification History

Written, 1999, CM
Converted to more general dimension, 2012-10-02, CM
Documented, 2012-10-02, CM
\$Id: unitize.pro,v 1.5 2012/10/02 12:28:47 cmarkwar Exp \$

© 2020 Harris Geospatial Solutions, Inc. |  Legal