Struct thin_engine::prelude::DVec4

source ·
pub struct DVec4 {
    pub x: f64,
    pub y: f64,
    pub z: f64,
    pub w: f64,
}
Expand description

a vector made from a x, y, z and w coordinate.

Fields§

§x: f64§y: f64§z: f64§w: f64

Implementations§

source§

impl DVec4

source

pub const ZERO: DVec4 = _

a zero vector

source

pub const ONE: DVec4 = _

a vector full of ones

source

pub const X: DVec4 = _

the x axis

source

pub const Y: DVec4 = _

the y axis

source

pub const Z: DVec4 = _

the z axis

source

pub const W: DVec4 = _

the w axis

source

pub fn new(x: f64, y: f64, z: f64, w: f64) -> DVec4

source

pub fn splat(value: f64) -> DVec4

create a vector where x, y and z equals value.

source

pub fn truncate(&self) -> DVec3

source

pub fn length_squared(self) -> f64

the length of the vector before being square rooted.

source

pub fn length(self) -> f64

length of the vector.

source

pub fn distance_squared(self, other: DVec4) -> f64

distance between two vectors before being square rooted.

source

pub fn distance(self, other: DVec4) -> f64

distance between two vectors.

source

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

get the dot product of 2 vectors. equal to the cosign of the angle between vectors.

source

pub fn scale(self, scalar: f64) -> DVec4

multiplies each value by the scalar.

source

pub fn normalise(self) -> DVec4

makes the length of the vector equal to 1.0 on fail returns dvec4 of zeros

source

pub fn transform(self, matrix: &Mat4) -> DVec4

transforms vector by the matrix

Trait Implementations§

source§

impl Add for DVec4

source§

fn add(self, rhs: DVec4) -> <DVec4 as Add>::Output

Performs the + operation. Read more
§

type Output = DVec4

The resulting type after applying the + operator.
source§

impl AddAssign for DVec4

source§

fn add_assign(&mut self, rhs: DVec4)

Performs the += operation. Read more
source§

impl AsUniformValue for DVec4

source§

fn as_uniform_value(&self) -> UniformValue<'_>

Builds a UniformValue.
source§

impl Clone for DVec4

source§

fn clone(&self) -> DVec4

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 DVec4

source§

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

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

impl Div for DVec4

source§

fn div(self, rhs: DVec4) -> <DVec4 as Div>::Output

Performs the / operation. Read more
§

type Output = DVec4

The resulting type after applying the / operator.
source§

impl DivAssign for DVec4

source§

fn div_assign(&mut self, rhs: DVec4)

Performs the /= operation. Read more
source§

impl From<[f32; 4]> for DVec4

source§

fn from(value: [f32; 4]) -> DVec4

Converts to this type from the input type.
source§

impl From<[f64; 4]> for DVec4

source§

fn from(value: [f64; 4]) -> DVec4

Converts to this type from the input type.
source§

impl From<(f64, f64, f64, f64)> for DVec4

source§

fn from(value: (f64, f64, f64, f64)) -> DVec4

Converts to this type from the input type.
source§

impl From<Vec4> for DVec4

source§

fn from(value: Vec4) -> DVec4

Converts to this type from the input type.
source§

impl Mul for DVec4

source§

fn mul(self, rhs: DVec4) -> <DVec4 as Mul>::Output

Performs the * operation. Read more
§

type Output = DVec4

The resulting type after applying the * operator.
source§

impl MulAssign for DVec4

source§

fn mul_assign(&mut self, rhs: DVec4)

Performs the *= operation. Read more
source§

impl Neg for DVec4

§

type Output = DVec4

The resulting type after applying the - operator.
source§

fn neg(self) -> <DVec4 as Neg>::Output

Performs the unary - operation. Read more
source§

impl PartialEq for DVec4

source§

fn eq(&self, other: &DVec4) -> 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 PartialOrd for DVec4

source§

fn partial_cmp(&self, other: &DVec4) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Rem for DVec4

source§

fn rem(self, rhs: DVec4) -> <DVec4 as Rem>::Output

Performs the % operation. Read more
§

type Output = DVec4

The resulting type after applying the % operator.
source§

impl RemAssign for DVec4

source§

fn rem_assign(&mut self, rhs: DVec4)

Performs the %= operation. Read more
source§

impl Sub for DVec4

source§

fn sub(self, rhs: DVec4) -> <DVec4 as Sub>::Output

Performs the - operation. Read more
§

type Output = DVec4

The resulting type after applying the - operator.
source§

impl SubAssign for DVec4

source§

fn sub_assign(&mut self, rhs: DVec4)

Performs the -= operation. Read more
source§

impl Copy for DVec4

source§

impl StructuralPartialEq for DVec4

Auto Trait Implementations§

§

impl Freeze for DVec4

§

impl RefUnwindSafe for DVec4

§

impl Send for DVec4

§

impl Sync for DVec4

§

impl Unpin for DVec4

§

impl UnwindSafe for DVec4

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> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> CloneToUninit for T
where T: Copy,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> Content for T
where T: Copy,

§

type Owned = T

A type that holds a sized version of the content.
source§

unsafe fn read<F, E>(size: usize, f: F) -> Result<T, E>
where F: FnOnce(&mut T) -> Result<(), E>,

Prepares an output buffer, then turns this buffer into an Owned. User-provided closure F must only write to and not read from &mut Self.
source§

fn get_elements_size() -> usize

Returns the size of each element.
source§

fn to_void_ptr(&self) -> *const ()

Produces a pointer to the data.
source§

fn ref_from_ptr<'a>(ptr: *mut (), size: usize) -> Option<*mut T>

Builds a pointer to this type from a raw pointer.
source§

fn is_size_suitable(size: usize) -> bool

Returns true if the size is suitable to store a type like this.
source§

impl<T> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more