[][src]Struct vec3D::Vec3D

pub struct Vec3D {
    pub x: f64,
    pub y: f64,
    pub z: f64,
}

Fields

x: f64y: f64z: f64

Methods

impl Vec3D[src]

pub fn new(x: f64, y: f64, z: f64) -> Vec3D[src]

pub fn new_from_spherical_coordinates(
    r: f64,
    theta: f64,
    phi: f64
) -> Result<Vec3D, Vec3DError>
[src]

Creates a new 3D vector from spherical coordinates

  • r - radial distance
  • theta - polar angle
  • phi - azimuthal angle

Errors

Will return a Vec3DError if:

  • r < 0
  • theta < 0
  • theta > PI

pub fn new_from_cylindrical_coordinates(
    r: f64,
    phi: f64,
    z: f64
) -> Result<Vec3D, Vec3DError>
[src]

Creates a new 3D vector from cylindrical coordinates

  • r - radial distance
  • phi - angle
  • z - height along z-axis

Errors

Will return a Vec3DError if:

  • r < 0

pub fn zeros() -> Vec3D[src]

Returns a new vector with a value of 0.0 in each axis

pub fn ones() -> Vec3D[src]

Returns a new vector with a value of 1.0 in each axis

pub fn x_proj(&self) -> Vec3D[src]

Returns the projection of the vector in the x-axis

pub fn y_proj(&self) -> Vec3D[src]

Returns the projection of the vector in the y-axis

pub fn z_proj(&self) -> Vec3D[src]

Returns the projection of the vector in the z-axis

pub fn theta(&self) -> f64[src]

Returns the vector's theta value in spherical coordinates

pub fn phi(&self) -> f64[src]

Returns the vector's phi value in spherical/cylindrical coordinates

pub fn mag(&self) -> f64[src]

Returns the vector's magnitude

pub fn mag2(&self) -> f64[src]

Returns the vector's magnitude^2

pub fn norm(&self) -> Vec3D[src]

Returns a new vector of the current vector normalised

pub fn unit(&self) -> Vec3D[src]

Alias for Vec3D::norm

pub fn inner_product(&self, other: Vec3D) -> f64[src]

Returns the inner product of this vector with another vector

pub fn dot(&self, other: Vec3D) -> f64[src]

Alias for Vec3D::inner_product

pub fn distance_to(&self, other: Vec3D) -> f64[src]

Returns the distance between this vector and another vector

pub fn distance_to2(&self, other: Vec3D) -> f64[src]

Returns the distance^2 between this vector and another vector

pub fn cross(&self, other: Vec3D) -> Vec3D[src]

Returns the cross product of this vector with another vector

pub fn pseudo_rapidity(&self) -> f64[src]

Returns the pseudo-rapidity of the vector w.r.t the z-axis

See: https://en.wikipedia.org/wiki/Pseudorapidity

pub fn rotate_x(&mut self, angle: f64)[src]

Rotates the vector around the x-axis

pub fn rotated_x(&self, angle: f64) -> Vec3D[src]

Returns a new vector of the current vector rotated around the x-axis

pub fn rotate_y(&mut self, angle: f64)[src]

Rotates the vector around the y-axis

pub fn rotated_y(&self, angle: f64) -> Vec3D[src]

Returns a new vector of the current vector rotated around the y-axis

pub fn rotate_z(&mut self, angle: f64)[src]

Rotates the vector around the z-axis

pub fn rotated_z(&self, angle: f64) -> Vec3D[src]

Returns a new vector of the current vector rotated around the z-axis

pub fn approx_eq(self, other: Vec3D) -> bool[src]

Returns true if points are approximately equal

Trait Implementations

impl Eq for Vec3D[src]

impl Clone for Vec3D[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for Vec3D[src]

impl PartialEq<Vec3D> for Vec3D[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Add<Vec3D> for Vec3D[src]

type Output = Vec3D

The resulting type after applying the + operator.

impl Sub<Vec3D> for Vec3D[src]

type Output = Vec3D

The resulting type after applying the - operator.

impl Mul<f64> for Vec3D[src]

type Output = Vec3D

The resulting type after applying the * operator.

impl Div<f64> for Vec3D[src]

type Output = Vec3D

The resulting type after applying the / operator.

impl Neg for Vec3D[src]

type Output = Vec3D

The resulting type after applying the - operator.

impl AddAssign<Vec3D> for Vec3D[src]

impl SubAssign<Vec3D> for Vec3D[src]

impl MulAssign<f64> for Vec3D[src]

impl DivAssign<f64> for Vec3D[src]

impl Debug for Vec3D[src]

impl Display for Vec3D[src]

Auto Trait Implementations

impl Send for Vec3D

impl Sync for Vec3D

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]