Skip to content

shz_vec2_normalize_or

Markdown
SHZ_INLINE shz_vec2_t shz_vec2_normalize_or(shz_vec2_t vec, shz_vec2_t alt) SHZ_NOEXCEPT;

Returns a normalized unit vector from the given 2D vector, or an alternate value.

NameTypeDescription
vecshz_vec2_tThe vector to normalize.
altshz_vec2_tThe vector to return when vec cannot be normalized.

The unit vector pointing in the same direction as vec, or alt.

Safely returns alt when vec has a magnitude of 0.0f and cannot be normalized.

shz_vec2_normalize, shz_vec2_normalize_safe