Skip to content

shz_vec3_normalize_safe

Markdown
SHZ_INLINE shz_vec3_t shz_vec3_normalize_safe(shz_vec3_t vec) SHZ_NOEXCEPT;

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

NameTypeDescription
vecshz_vec3_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_vec3_normalize, shz_vec3_normalize_or