Skip to content

shz_vec2_normalize

Markdown
SHZ_INLINE shz_vec2_t shz_vec2_normalize(shz_vec2_t vec) SHZ_NOEXCEPT;

Returns a normalized unit vector from the given 2D vector.

NameTypeDescription
vecshz_vec2_tThe vector to normalize.

The unit vector pointing in the same direction as vec.

This is the fastest normalization routine, which does not check for a zero-length vector.

  • Results in a division-by-zero when vec has a magnitude of 0.0f.

shz_vec2_normalize_or, shz_vec2_normalize_safe