safeNormalize

Returns a vector whose length 1 from target vector. When the length is 0, returns zero vector.

Vector!(T, U)
safeNormalize
(
T
uint U
)
(
const Vector!(T, U) v
)
if (
__traits(isFloating, T)
)

Parameters

v Vector!(T, U)

target vector

Return Value

Type: Vector!(T, U)

normalized target vector if the length is greater than 0, otherwise zero vector

Meta