pub struct Vector3 {
pub x: f64,
pub y: f64,
pub z: f64,
}
Fields§
§x: f64
§y: f64
§z: f64
Implementations§
Source§impl Vector3
impl Vector3
Sourcepub fn is_zero(&self) -> bool
pub fn is_zero(&self) -> bool
Uses f64::EPSILON
to deduct if the length of the vector is zero.
This is to avoid any small rounding errors.
Sourcepub fn distance_to(&self, other: Vector3) -> f64
pub fn distance_to(&self, other: Vector3) -> f64
Returns the distance from self
to another vector.
Sourcepub fn cross(&self, other: &Vector3) -> Vector3
pub fn cross(&self, other: &Vector3) -> Vector3
Returns the cross product of self
and another vector.
Sourcepub fn angle(&self, other: &Vector3) -> f64
pub fn angle(&self, other: &Vector3) -> f64
Returns the angle between self
and another vector in radians.
Sourcepub fn angle_deg(&self, other: &Vector3) -> f64
pub fn angle_deg(&self, other: &Vector3) -> f64
Returns the angle between self
and another vector in degrees.
Trait Implementations§
impl Copy for Vector3
Auto Trait Implementations§
impl Freeze for Vector3
impl RefUnwindSafe for Vector3
impl Send for Vector3
impl Sync for Vector3
impl Unpin for Vector3
impl UnwindSafe for Vector3
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