pub struct Vector3D { /* private fields */ }Expand description
A 3D vector with x, y, and z components represented as f64.
Implementations§
Source§impl Vector3D
Implements methods and operator overloading for Vector3D.
impl Vector3D
Implements methods and operator overloading for Vector3D.
Sourcepub fn forward() -> Vector3D
pub fn forward() -> Vector3D
Returns the unit vector pointing forward (0.0, 0.0, -1.0).
In a right-handed coordinate system where -z is forward.
§Returns
Vector3D- The forward unit vector.
Sourcepub fn magnitude_squared(&self) -> f64
pub fn magnitude_squared(&self) -> f64
Returns the squared magnitude of the vector.
Avoids a square root, making it faster for comparison-only use cases.
§Returns
f64- The squared magnitude of the vector.
Sourcepub fn normalized(&self) -> Vector3D
pub fn normalized(&self) -> Vector3D
Returns a normalized (unit length) copy of this vector.
Returns the zero vector if the magnitude is zero.
§Returns
Vector3D- The normalized vector.
Sourcepub fn distance_to(&self, other: Vector3D) -> f64
pub fn distance_to(&self, other: Vector3D) -> f64
Sourcepub fn distance_squared_to(&self, other: Vector3D) -> f64
pub fn distance_squared_to(&self, other: Vector3D) -> f64
Sourcepub fn direction_to(&self, other: Vector3D) -> Vector3D
pub fn direction_to(&self, other: Vector3D) -> Vector3D
Sourcepub fn rotated_by(&self, quaternion: Quaternion) -> Vector3D
pub fn rotated_by(&self, quaternion: Quaternion) -> Vector3D
Source§impl Vector3D
impl Vector3D
pub fn get_x(&self) -> f64
pub fn get_mut_x(&mut self) -> &mut f64
pub fn set_x(&mut self, val: f64) -> &mut Self
pub fn get_y(&self) -> f64
pub fn get_mut_y(&mut self) -> &mut f64
pub fn set_y(&mut self, val: f64) -> &mut Self
pub fn get_z(&self) -> f64
pub fn get_mut_z(&mut self) -> &mut f64
pub fn set_z(&mut self, val: f64) -> &mut Self
Trait Implementations§
Source§impl AddAssign for Vector3D
Implements in-place vector addition.
impl AddAssign for Vector3D
Implements in-place vector addition.
Source§fn add_assign(&mut self, other: Vector3D)
fn add_assign(&mut self, other: Vector3D)
Performs the
+= operation. Read moreimpl Copy for Vector3D
Source§impl Interpolable for Vector3D
Implements Interpolable for Vector3D.
impl Interpolable for Vector3D
Implements Interpolable for Vector3D.
Source§impl MulAssign<f64> for Vector3D
Implements in-place scalar multiplication.
impl MulAssign<f64> for Vector3D
Implements in-place scalar multiplication.
Source§fn mul_assign(&mut self, scalar: f64)
fn mul_assign(&mut self, scalar: f64)
Performs the
*= operation. Read moreSource§impl PartialOrd for Vector3D
impl PartialOrd for Vector3D
impl StructuralPartialEq for Vector3D
Auto Trait Implementations§
impl Freeze for Vector3D
impl RefUnwindSafe for Vector3D
impl Send for Vector3D
impl Sync for Vector3D
impl Unpin for Vector3D
impl UnsafeUnpin for Vector3D
impl UnwindSafe for Vector3D
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