pub struct Vector {
pub x: f64,
pub y: f64,
pub z: f64,
}Expand description
Vector represents a point in ℝ³.
Fields§
§x: f64§y: f64§z: f64Implementations§
Source§impl Vector
impl Vector
pub fn new(x: f64, y: f64, z: f64) -> Self
Sourcepub fn approx_eq(&self, other: &Vector) -> bool
pub fn approx_eq(&self, other: &Vector) -> bool
approx_eq reports whether v and ov are equal within a small epsilon.
Sourcepub fn is_unit(&self) -> bool
pub fn is_unit(&self) -> bool
is_unit returns whether this vector is of approximately unit length.
Sourcepub fn cross(&self, other: &Self) -> Self
pub fn cross(&self, other: &Self) -> Self
cross returns the standard cross product of v and ov.
Sourcepub fn distance(&self, other: &Self) -> f64
pub fn distance(&self, other: &Self) -> f64
distance returns the Euclidean distance between v and ov.
Sourcepub fn ortho(&self) -> Self
pub fn ortho(&self) -> Self
ortho returns a unit vector that is orthogonal to v. ortho(-v) = -ortho(v) for all v.
Sourcepub fn largest_component(&self) -> Axis
pub fn largest_component(&self) -> Axis
largest_component returns the axis that represents the largest component in this vector.
Sourcepub fn smallest_component(&self) -> Axis
pub fn smallest_component(&self) -> Axis
smallest_component returns the axis that represents the smallest component in this vector.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Vector
impl<'de> Deserialize<'de> for Vector
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Vector> for PreciseVector
impl From<Vector> for PreciseVector
Source§impl Into<Vector> for PreciseVector
impl Into<Vector> for PreciseVector
Source§impl Ord for Vector
impl Ord for Vector
Source§impl PartialOrd for Vector
impl PartialOrd for Vector
impl Copy for Vector
impl Eq for Vector
impl StructuralPartialEq for Vector
Auto Trait Implementations§
impl Freeze for Vector
impl RefUnwindSafe for Vector
impl Send for Vector
impl Sync for Vector
impl Unpin for Vector
impl UnwindSafe for Vector
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