Skip to content

shz_vec4_normalize_safe

Markdown
SHZ_INLINE shz_vec4_t shz_vec4_normalize_safe(shz_vec4_t vec) SHZ_NOEXCEPT;

SAFELY returns a normalized unit vector from the given 4D vector.

NameTypeDescription
vecshz_vec4_tThe vector to normalize.

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

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

  • _safe: Guards degenerate input (zero-length vectors, zero denominators) at a small cost. (Naming and Suffixes)

shz_vec4_normalize, shz_vec4_normalize_or