pub struct Vec3 { /* private fields */ }Expand description
Finite vector or point in a right-handed 3D coordinate space.
Construction and arithmetic are fallible so finite inputs cannot silently produce NaN or infinity at the visual-state boundary.
Implementations§
Source§impl Vec3
impl Vec3
Sourcepub fn new(x: f32, y: f32, z: f32) -> Result<Self, Pseudo3dError>
pub fn new(x: f32, y: f32, z: f32) -> Result<Self, Pseudo3dError>
Builds a vector from finite caller-defined world components.
Sourcepub fn checked_add(self, other: Self) -> Result<Self, Pseudo3dError>
pub fn checked_add(self, other: Self) -> Result<Self, Pseudo3dError>
Adds two vectors while rejecting a finite-input overflow.
Sourcepub fn checked_sub(self, other: Self) -> Result<Self, Pseudo3dError>
pub fn checked_sub(self, other: Self) -> Result<Self, Pseudo3dError>
Subtracts two vectors while rejecting a finite-input overflow.
Sourcepub fn checked_scale(self, scale: f32) -> Result<Self, Pseudo3dError>
pub fn checked_scale(self, scale: f32) -> Result<Self, Pseudo3dError>
Multiplies every component by a finite scalar.
Sourcepub fn checked_dot(self, other: Self) -> Result<f32, Pseudo3dError>
pub fn checked_dot(self, other: Self) -> Result<f32, Pseudo3dError>
Computes a dot product using wider intermediates and rejects an f32 overflow.
Sourcepub fn checked_cross(self, other: Self) -> Result<Self, Pseudo3dError>
pub fn checked_cross(self, other: Self) -> Result<Self, Pseudo3dError>
Computes a cross product using wider intermediates.
Sourcepub fn normalized(self) -> Result<Self, Pseudo3dError>
pub fn normalized(self) -> Result<Self, Pseudo3dError>
Returns a unit vector without overflowing on large finite components.
Trait Implementations§
impl Copy for Vec3
impl StructuralPartialEq for Vec3
Auto Trait Implementations§
impl Freeze for Vec3
impl RefUnwindSafe for Vec3
impl Send for Vec3
impl Sync for Vec3
impl Unpin for Vec3
impl UnsafeUnpin for Vec3
impl UnwindSafe for Vec3
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
Mutably borrows from an owned value. Read more