Description Usage Arguments Value See Also Examples
Convert input vector to unit length
1 |
a |
The vector |
A vector in the same direction as the input vector, but of unit length Will "work" on vectors of any number of dimensions, although it should be noted it's designed for 3D space use. For expediency, the function doesn't check the input vector is non-zero in length, and will return a vector of NaN values in that case.
Other utils: Utils.CrossProduct
,
Utils.DotProduct
,
Utils.VectorLength
1 2 | Utils.UnitVector(c(1,2,3)) [1] 0.2672612 0.5345225 0.8017837
Utils.UnitVector(c(0,0,0)) [1] NaN NaN NaN
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.