Struct s2::r3::vector::Vector [−][src]
Vector represents a point in ℝ³.
Fields
x: f64
y: f64
z: f64
Methods
impl Vector
[src]
impl Vector
pub fn new(x: f64, y: f64, z: f64) -> Self
[src]
pub fn new(x: f64, y: f64, z: f64) -> Self
pub fn approx_eq(&self, other: &Vector) -> bool
[src]
pub fn approx_eq(&self, other: &Vector) -> bool
approx_eq reports whether v and ov are equal within a small epsilon.
pub fn norm(&self) -> f64
[src]
pub fn norm(&self) -> f64
norm returns the vector's norm.
pub fn norm2(&self) -> f64
[src]
pub fn norm2(&self) -> f64
norm2 returns the square of the norm.
pub fn normalize(&self) -> Self
[src]
pub fn normalize(&self) -> Self
normalize returns a unit vector in the same direction as v.
pub fn dot(&self, other: &Self) -> f64
[src]
pub fn dot(&self, other: &Self) -> f64
dot returns the standard dot product of v and ov.
pub fn is_unit(&self) -> bool
[src]
pub fn is_unit(&self) -> bool
is_unit returns whether this vector is of approximately unit length.
pub fn abs(&self) -> Self
[src]
pub fn abs(&self) -> Self
abs returns the vector with nonnegative components.
pub fn cross(&self, other: &Self) -> Self
[src]
pub fn cross(&self, other: &Self) -> Self
cross returns the standard cross product of v and ov.
pub fn distance(&self, other: &Self) -> f64
[src]
pub fn distance(&self, other: &Self) -> f64
distance returns the Euclidean distance between v and ov.
pub fn angle(&self, other: &Self) -> Angle
[src]
pub fn angle(&self, other: &Self) -> Angle
angle returns the angle between v and ov.
pub fn ortho(&self) -> Self
[src]
pub fn ortho(&self) -> Self
ortho returns a unit vector that is orthogonal to v. ortho(-v) = -ortho(v) for all v.
pub fn largest_component(&self) -> Axis
[src]
pub fn largest_component(&self) -> Axis
largest_component returns the axis that represents the largest component in this vector.
pub fn smallest_component(&self) -> Axis
[src]
pub fn smallest_component(&self) -> Axis
smallest_component returns the axis that represents the smallest component in this vector.
Trait Implementations
impl Clone for Vector
[src]
impl Clone for Vector
fn clone(&self) -> Vector
[src]
fn clone(&self) -> Vector
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for Vector
[src]
impl Copy for Vector
impl PartialEq for Vector
[src]
impl PartialEq for Vector
fn eq(&self, other: &Vector) -> bool
[src]
fn eq(&self, other: &Vector) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Vector) -> bool
[src]
fn ne(&self, other: &Vector) -> bool
This method tests for !=
.
impl PartialOrd for Vector
[src]
impl PartialOrd for Vector
fn partial_cmp(&self, other: &Vector) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Vector) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
fn lt(&self, other: &Vector) -> bool
[src]
fn lt(&self, other: &Vector) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
fn le(&self, other: &Vector) -> bool
[src]
fn le(&self, other: &Vector) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
fn gt(&self, other: &Vector) -> bool
[src]
fn gt(&self, other: &Vector) -> bool
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
fn ge(&self, other: &Vector) -> bool
[src]
fn ge(&self, other: &Vector) -> bool
This method tests greater than or equal to (for self
and other
) and is used by the >=
operator. Read more
impl Debug for Vector
[src]
impl Debug for Vector
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Add<Vector> for Vector
[src]
impl Add<Vector> for Vector
type Output = Vector
The resulting type after applying the +
operator.
fn add(self, other: Vector) -> Self::Output
[src]
fn add(self, other: Vector) -> Self::Output
Performs the +
operation.
impl<'a, 'b> Add<&'b Vector> for &'a Vector
[src]
impl<'a, 'b> Add<&'b Vector> for &'a Vector
type Output = Vector
The resulting type after applying the +
operator.
fn add(self, other: &'b Vector) -> Self::Output
[src]
fn add(self, other: &'b Vector) -> Self::Output
add returns the standard vector sum of v and ov.
impl Sub<Vector> for Vector
[src]
impl Sub<Vector> for Vector
type Output = Vector
The resulting type after applying the -
operator.
fn sub(self, other: Vector) -> Self::Output
[src]
fn sub(self, other: Vector) -> Self::Output
sub returns the standard vector difference of v and ov.
impl<'a, 'b> Sub<&'b Vector> for &'a Vector
[src]
impl<'a, 'b> Sub<&'b Vector> for &'a Vector
type Output = Vector
The resulting type after applying the -
operator.
fn sub(self, other: &'b Vector) -> Self::Output
[src]
fn sub(self, other: &'b Vector) -> Self::Output
Performs the -
operation.
impl Mul<Vector> for Vector
[src]
impl Mul<Vector> for Vector
type Output = Vector
The resulting type after applying the *
operator.
fn mul(self, other: Vector) -> Self::Output
[src]
fn mul(self, other: Vector) -> Self::Output
Performs the *
operation.
impl<'a, 'b> Mul<&'a Vector> for &'b Vector
[src]
impl<'a, 'b> Mul<&'a Vector> for &'b Vector
type Output = Vector
The resulting type after applying the *
operator.
fn mul(self, other: &'a Vector) -> Self::Output
[src]
fn mul(self, other: &'a Vector) -> Self::Output
Performs the *
operation.
impl<'a> Mul<f64> for &'a Vector
[src]
impl<'a> Mul<f64> for &'a Vector
type Output = Vector
The resulting type after applying the *
operator.
fn mul(self, m: f64) -> Self::Output
[src]
fn mul(self, m: f64) -> Self::Output
mul returns the standard scalar product of v and m.
impl Mul<f64> for Vector
[src]
impl Mul<f64> for Vector