Struct chikage::vec::vec3f64::Vec3f64

source ·
pub struct Vec3f64 {
    pub coords: [f64; 3],
}
Expand description

A three dimensional vector.

Fields§

§coords: [f64; 3]

Implementations§

source§

impl Vec3f64

source

pub fn new(coords: [f64; 3]) -> Self

Create a new vector with user defined components.

source

pub fn zero() -> Self

Create a new vector with all components equal to 0.0.

source

pub fn ones() -> Self

Create a new vector with all components equal to 1.0.

source

pub fn mag(&self) -> f64

The magnitude of the vector (also known as length).

source

pub fn mag_squared(&self) -> f64

The magnitude of the vector (also known as length), but squared. This is faster to compute than mag() and useful in some situations.

source

pub fn norm(&mut self)

Normalizes self This makes the vector a unit vector.

source

pub fn normed(&self) -> Self

Return self but as a normalized vector. This returns a unit vector.

source

pub fn dot(&self, other: Self) -> f64

Calculate the dot product between self and other.

Trait Implementations§

source§

impl Add for Vec3f64

§

type Output = Vec3f64

The resulting type after applying the + operator.
source§

fn add(self, rhs: Vec3f64) -> Self::Output

Performs the + operation. Read more
source§

impl AddAssign for Vec3f64

source§

fn add_assign(&mut self, rhs: Vec3f64)

Performs the += operation. Read more
source§

impl Clone for Vec3f64

source§

fn clone(&self) -> Vec3f64

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Vec3f64

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Div<f64> for Vec3f64

§

type Output = Vec3f64

The resulting type after applying the / operator.
source§

fn div(self, scalar: f64) -> Self::Output

Performs the / operation. Read more
source§

impl DivAssign<f64> for Vec3f64

source§

fn div_assign(&mut self, scalar: f64)

Performs the /= operation. Read more
source§

impl Index<usize> for Vec3f64

§

type Output = f64

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<usize> for Vec3f64

source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
source§

impl Mul<Vec3f64> for Mat3f64

§

type Output = Vec3f64

The resulting type after applying the * operator.
source§

fn mul(self, v: Vec3f64) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<Vec3f64> for f64

§

type Output = Vec3f64

The resulting type after applying the * operator.
source§

fn mul(self, v: Vec3f64) -> Self::Output

Performs the * operation. Read more
source§

impl Mul<f64> for Vec3f64

§

type Output = Vec3f64

The resulting type after applying the * operator.
source§

fn mul(self, scalar: f64) -> Self::Output

Performs the * operation. Read more
source§

impl MulAssign<f64> for Vec3f64

source§

fn mul_assign(&mut self, scalar: f64)

Performs the *= operation. Read more
source§

impl Sub for Vec3f64

§

type Output = Vec3f64

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Vec3f64) -> Self::Output

Performs the - operation. Read more
source§

impl SubAssign for Vec3f64

source§

fn sub_assign(&mut self, rhs: Vec3f64)

Performs the -= operation. Read more
source§

impl Copy for Vec3f64

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.