#[repr(C)]pub struct Vec3Fix {
pub x: Fix128,
pub y: Fix128,
pub z: Fix128,
}Expand description
3D vector using Fix128 components
Fields§
§x: Fix128X component
y: Fix128Y component
z: Fix128Z component
Implementations§
Source§impl Vec3Fix
impl Vec3Fix
Sourcepub fn checked_scale(self, s: Fix128) -> Option<Self>
pub fn checked_scale(self, s: Fix128) -> Option<Self>
各成分を s 倍し、どれか 1 成分でも範囲外なら None を返す
Fix128::checked_mul の Vec3Fix 版 発散検出の投入点
(積分 position += velocity*dt と速度導出) で使う
Source§impl Vec3Fix
impl Vec3Fix
Sourcepub fn from_f32(x: f32, y: f32, z: f32) -> Self
pub fn from_f32(x: f32, y: f32, z: f32) -> Self
Create from f32 components (for SDF bridge) Create from f32 components (for SDF bridge, not deterministic!)
Sourcepub fn length_squared(self) -> Fix128
pub fn length_squared(self) -> Fix128
Squared length (no sqrt)
Sourcepub fn normalize(self) -> Self
pub fn normalize(self) -> Self
Normalize to unit length.
Returns Self::ZERO for zero-length vectors. Use Self::try_normalize
when you need to distinguish a zero-length input from a valid unit vector.
Sourcepub fn try_normalize(self) -> Option<Self>
pub fn try_normalize(self) -> Option<Self>
Try to normalize, returning None for zero-length vectors.
Sourcepub fn normalize_with_length(self) -> (Self, Fix128)
pub fn normalize_with_length(self) -> (Self, Fix128)
Normalize and return both the unit vector and the original length.
Avoids double sqrt when both normalized direction and distance are needed.
Returns (Self::ZERO, Fix128::ZERO) if the vector is zero-length.
Sourcepub fn checked_add(self, rhs: Self) -> Option<Self>
pub fn checked_add(self, rhs: Self) -> Option<Self>
成分ごとの Fix128::checked_add (+ と同じ和、どれかの成分が
|·| ≥ 2⁶³ なら None)
§Claims
Someの時はself + rhsと bit 一致する- 位置の加算のように wrap が反対側の端への移動になる経路だけが使う
Sourcepub fn checked_dot(self, rhs: Self) -> Option<Fix128>
pub fn checked_dot(self, rhs: Self) -> Option<Fix128>
Sourcepub fn checked_length_squared(self) -> Option<Fix128>
pub fn checked_length_squared(self) -> Option<Fix128>
Self::length_squared の範囲検査版 (|v|² ≥ 2⁶³ で None)
Some の時は length_squared と bit 一致する
Sourcepub fn checked_length(self) -> Option<Fix128>
pub fn checked_length(self) -> Option<Fix128>
Self::length の範囲検査版 (|v| ≥ 2³¹·⁵ で None)
Some の時は length と bit 一致する 範囲外でも長さが要るなら
Self::checked_length_scaled を使う
Sourcepub fn checked_normalize(self) -> Option<Self>
pub fn checked_normalize(self) -> Option<Self>
Self::try_normalize の範囲検査版
長さ 0 と |v| ≥ 2³¹·⁵ (長さの 2 乗が範囲外) のどちらも None
Some の時は try_normalize と bit 一致する 範囲外でも向きが要るなら
Self::try_normalize_scaled を使う
Sourcepub fn checked_length_scaled(self) -> Option<Fix128>
pub fn checked_length_scaled(self) -> Option<Fix128>
2 乗が範囲外になる大きさでも正しい長さ 結果自体が ≥ 2⁶³ (表せない)
時だけ None
§Claims
|v|² < 2⁶³(length_squaredが wrap しない範囲) ではlengthと bit 一致する (同じ式をそのまま使う)- それより大きい時は、最大成分を 2 の冪で
[2²⁹, 2³⁰)に寄せてから 2 乗するので wrap せず、相対誤差は約2⁻⁹²(成分の切り捨てとsqrtの floor) - 結果が
≥ 2⁶³(成分が2⁶²級) ならNone
Sourcepub fn try_normalize_scaled(self) -> Option<Self>
pub fn try_normalize_scaled(self) -> Option<Self>
2 乗が範囲外になる大きさでも向きを返す正規化 零ベクトルだけ None
§Claims
try_normalizeがSomeを返す入力ではtry_normalizeと bit 一致try_normalizeが範囲外 (|v| ≥ 2³¹·⁵) や長さの 2 乗の下位桁あふれ (|v| < 約 2⁻³²) でNoneを返す非零ベクトルには、最大成分を[2²⁹, 2³⁰)に寄せたベクトルを正規化して返す
Sourcepub fn dot_simd(self, rhs: Self) -> Fix128
pub fn dot_simd(self, rhs: Self) -> Fix128
SIMD-accelerated dot product — safe public entry point.
On x86_64 with the simd feature enabled this dispatches to the SSE2
path (dot_simd_sse2). On every other platform it falls back to the
scalar dot(). The result is bit-exact identical to dot() on every
platform.
Sourcepub fn length_squared_simd(self) -> Fix128
pub fn length_squared_simd(self) -> Fix128
Squared length using SIMD-accelerated dot product.
Equivalent to length_squared() but dispatches through dot_simd.
Result is bit-exact identical to length_squared().
Sourcepub fn cross_simd(self, rhs: Self) -> Self
pub fn cross_simd(self, rhs: Self) -> Self
Cross product through the simd feature’s API surface —
scalar-equivalent, bit-identical to cross() (see the module docs).
Trait Implementations§
impl Copy for Vec3Fix
impl Eq for Vec3Fix
impl StructuralPartialEq for Vec3Fix
Auto Trait Implementations§
impl Freeze for Vec3Fix
impl RefUnwindSafe for Vec3Fix
impl Send for Vec3Fix
impl Sync for Vec3Fix
impl Unpin for Vec3Fix
impl UnsafeUnpin for Vec3Fix
impl UnwindSafe for Vec3Fix
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more