Struct noise::math::vectors::Vector3

source ·
pub struct Vector3<T> {
    pub x: T,
    pub y: T,
    pub z: T,
}

Fields§

§x: T§y: T§z: T

Implementations§

source§

impl<T> Vector3<T>

source

pub fn new(x: T, y: T, z: T) -> Self

source

pub fn numcast<D>(self) -> Option<Vector3<D>>
where T: NumCast, D: NumCast,

source§

impl<T: Copy> Vector3<T>

source

pub fn broadcast(value: T) -> Self

source

pub fn zero() -> Self
where T: Zero,

source

pub fn one() -> Self
where T: One,

source

pub fn into_array(self) -> [T; 3]

source

pub fn dot(self, other: Self) -> T
where T: Zero + AddAssign + Mul<Output = T>,

source

pub fn magnitude_squared(self) -> T
where T: Zero + AddAssign + Mul<Output = T>,

source

pub fn magnitude(self) -> T
where T: Zero + AddAssign + Real,

source

pub fn normalize(self) -> Self
where T: Zero + AddAssign + Real,

source

pub fn range_squared(self, other: Self) -> T
where T: Zero + AddAssign + Sub + Mul + Num,

source

pub fn range(self, other: Self) -> T
where T: Zero + AddAssign + Mul + Real,

source

pub fn apply<F>(&mut self, f: F)
where F: Fn(T) -> T,

source

pub fn min(self, other: Self) -> Self
where T: Ord,

source

pub fn max(self, other: Self) -> Self
where T: Ord,

source

pub fn ceil(self) -> Self
where T: Real,

source

pub fn floor_to_isize(self) -> Vector3<isize>
where T: Real,

source

pub fn sum(self) -> T
where T: Zero + AddAssign,

source

pub fn sqrt(self) -> Self
where T: Real,

source

pub fn map<F, U>(self, f: F) -> Vector3<U>
where F: Fn(T) -> U,

source§

impl<T: Copy> Vector3<T>

source

pub fn cross(&self, other: Self) -> Self
where T: Mul<Output = T> + Sub<Output = T>,

source

pub fn rotate_axis_angle(&self, axis: Self, angle: T) -> Self
where T: Copy + Real + AddAssign,

Trait Implementations§

source§

impl<T> Add<T> for Vector3<T>
where T: Copy + Add<Output = T>,

§

type Output = Vector3<T>

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<T> Add for Vector3<T>
where T: Add<Output = T>,

§

type Output = Vector3<T>

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<T> AddAssign<T> for Vector3<T>
where T: Copy + AddAssign,

source§

fn add_assign(&mut self, rhs: T)

Performs the += operation. Read more
source§

impl<T> AddAssign for Vector3<T>
where T: AddAssign,

source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
source§

impl<T: Clone> Clone for Vector3<T>

source§

fn clone(&self) -> Vector3<T>

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<T: Debug> Debug for Vector3<T>

source§

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

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

impl<T: Default> Default for Vector3<T>

source§

fn default() -> Vector3<T>

Returns the “default value” for a type. Read more
source§

impl<T> Div<T> for Vector3<T>
where T: Div<Output = T> + Copy,

§

type Output = Vector3<T>

The resulting type after applying the / operator.
source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
source§

impl<T> DivAssign<T> for Vector3<T>
where T: DivAssign + Copy,

source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
source§

impl<T> From<[T; 3]> for Vector3<T>
where T: Copy + Num,

source§

fn from(array: [T; 3]) -> Self

Converts to this type from the input type.
source§

impl<T> From<(T, T, T)> for Vector3<T>

source§

fn from(src: (T, T, T)) -> Self

Converts to this type from the input type.
source§

impl<T> From<Vector3<T>> for [T; 3]

source§

fn from(vector: Vector3<T>) -> Self

Converts to this type from the input type.
source§

impl<T> From<Vector3<T>> for (T, T, T)

source§

fn from(vector: Vector3<T>) -> Self

Converts to this type from the input type.
source§

impl<T> Mul<T> for Vector3<T>
where T: Mul<Output = T> + Copy,

§

type Output = Vector3<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
source§

impl<T> Mul for Vector3<T>
where T: Mul<Output = T> + Copy,

§

type Output = Vector3<T>

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self::Output

Performs the * operation. Read more
source§

impl<T> MulAssign<T> for Vector3<T>
where T: MulAssign + Copy,

source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
source§

impl<T> MulAssign for Vector3<T>
where T: MulAssign + Copy,

source§

fn mul_assign(&mut self, rhs: Self)

Performs the *= operation. Read more
source§

impl<T> PartialEq for Vector3<T>
where T: PartialEq,

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T> Sub<T> for Vector3<T>
where T: Copy + Sub<Output = T>,

§

type Output = Vector3<T>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<T> Sub for Vector3<T>
where T: Sub<Output = T>,

§

type Output = Vector3<T>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<T> SubAssign<T> for Vector3<T>
where T: Copy + SubAssign,

source§

fn sub_assign(&mut self, rhs: T)

Performs the -= operation. Read more
source§

impl<T> SubAssign for Vector3<T>
where T: SubAssign,

source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
source§

impl<T: Copy> Copy for Vector3<T>

source§

impl<T: Eq> Eq for Vector3<T>

Auto Trait Implementations§

§

impl<T> Freeze for Vector3<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Vector3<T>
where T: RefUnwindSafe,

§

impl<T> Send for Vector3<T>
where T: Send,

§

impl<T> Sync for Vector3<T>
where T: Sync,

§

impl<T> Unpin for Vector3<T>
where T: Unpin,

§

impl<T> UnwindSafe for Vector3<T>
where T: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where 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 T
where 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 T
where 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.