shz_vec4_normalize_or
SHZ_INLINE shz_vec4_t shz_vec4_normalize_or(shz_vec4_t vec, shz_vec4_t alt) SHZ_NOEXCEPT;Returns a normalized unit vector from the given 4D vector, or an alternate value.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
vec | shz_vec4_t | The vector to normalize. |
alt | shz_vec4_t | The vector to return when vec cannot be normalized. |
Returns
Section titled “Returns”The unit vector pointing in the same direction as vec, or alt.
Details
Section titled “Details”Safely returns alt when vec has a magnitude of 0.0f and cannot be normalized.
Availability
Section titled “Availability”- C++ equivalent:
shz::vec4::direction_or,shz::vec4::normalize_or,shz::vec4::normalized_or - Type-generic form:
shz_vec_normalize_or() - Back-ends: SH4: shared C implementation · SW: portable C · SPU: shared C implementation
- Defined in:
sh4zam/shz_vector.h:704 - Module: Vector, section "Magnitude"