[−][src]Struct vec3D::Vec3D
Fields
x: f64
y: f64
z: 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]
r: f64,
theta: f64,
phi: f64
) -> Result<Vec3D, Vec3DError>
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]
r: f64,
phi: f64,
z: f64
) -> Result<Vec3D, Vec3DError>
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
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(&self) -> 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]
fn eq(&self, other: &Vec3D) -> bool
[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.
fn add(self, other: Vec3D) -> Vec3D
[src]
impl Sub<Vec3D> for Vec3D
[src]
type Output = Vec3D
The resulting type after applying the -
operator.
fn sub(self, other: Vec3D) -> Vec3D
[src]
impl Mul<f64> for Vec3D
[src]
type Output = Vec3D
The resulting type after applying the *
operator.
fn mul(self, other: f64) -> Vec3D
[src]
impl Div<f64> for Vec3D
[src]
type Output = Vec3D
The resulting type after applying the /
operator.
fn div(self, other: f64) -> Vec3D
[src]
impl Neg for Vec3D
[src]
impl AddAssign<Vec3D> for Vec3D
[src]
fn add_assign(&mut self, other: Vec3D)
[src]
impl SubAssign<Vec3D> for Vec3D
[src]
fn sub_assign(&mut self, other: Vec3D)
[src]
impl MulAssign<f64> for Vec3D
[src]
fn mul_assign(&mut self, other: f64)
[src]
impl DivAssign<f64> for Vec3D
[src]
fn div_assign(&mut self, other: f64)
[src]
impl Debug for Vec3D
[src]
impl Display for Vec3D
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,