shz_vec3_normalize_safe
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.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
vec | shz_vec3_t | The vector to normalize. |
Returns
Section titled “Returns”The unit vector pointing in the same direction as vec, or a zero vector.
Details
Section titled “Details”Safely returns a zero vector when vec has a magnitude of 0.0f and cannot be normalized.
Naming and requirements
Section titled “Naming and requirements”_safe: Guards degenerate input (zero-length vectors, zero denominators) at a small cost. (Naming and Suffixes)
Availability
Section titled “Availability”- C++ equivalent:
shz::vec3::direction_safe,shz::vec3::normalize_safe,shz::vec3::normalized_safe - Type-generic form:
shz_vec_normalize_safe() - Back-ends: SH4: shared C implementation · SW: portable C · SPU: shared C implementation
- Defined in:
sh4zam/shz_vector.h:728 - Module: Vector, section "Magnitude"