Skip to content

editor / unit

Function: unit() ​

unit(vector): Vector

Defined in: math/unit.ts:17

Vector of length 1 with the direction of a vector.

Formula: v̂ = v / ‖v‖, defined for a nonzero vector; the zero vector (an edge of length 0, Q15) has no direction and gives (0, 0), never a division by zero (convention of DERIV-fillet-arc step 1; the cited definition covers nonzero vectors only).

Parameters ​

vector ​

Vector

direction to normalize

Returns ​

Vector

the unit vector, or (0, 0) for the zero vector

Kind ​

math

See ​

REF-MATHWORLD-UNIT-VECTOR