Struct voxelize::Vec3

source ·
pub struct Vec3<T>(pub T, pub T, pub T);
Expand description

Vector3 implementation for Voxelize.

Tuple Fields§

§0: T§1: T§2: T

Implementations§

source§

impl<T: Copy> Vec3<T>

source

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

source§

impl<T> Vec3<T>
where T: Num + Copy,

source

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

Add self to another Vec3.

source

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

Subtract self by another Vec3.

source

pub fn copy(&mut self, other: &Self) -> &Self

Copy anther Vec3’s content to self.

source

pub fn set(&mut self, x: T, y: T, z: T) -> &Self

Set the data of this Vec3.

source

pub fn scale(&self, scale: T) -> Self

Scale all elements of self.

source

pub fn scale_and_add(&self, other: &Self, scale: T) -> Self

Add another scaled instance to self.

source

pub fn from_arr(arr: [T; 3]) -> Self

Instantiate a Vec3 instance from a 3-element array.

source§

impl<T> Vec3<T>
where T: Float,

source

pub fn len(&self) -> T

Length of the vector.

source

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

Get the maximum element of two vectors.

source

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

Get the minimum element of two vectors.

source§

impl Vec3<f32>

source

pub fn rotate_y(&self, origin: &Self, angle: f32) -> Self

Rotate this vector by an angle from an origin.

source

pub fn normalize(&self) -> Self

Normalize this vector.

source

pub fn sq_distance(&self, other: &Self) -> f32

Squared distance between two vectors.

source

pub fn set_mag(&mut self, mag: f32) -> &Self

source

pub fn limit(&mut self, mag: f32) -> &Self

Trait Implementations§

source§

impl<T: Num + Copy + Default> Add<&Vec3<T>> for &Vec3<T>

§

type Output = Vec3<T>

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<T: Num + Copy + Default> Add for Vec3<T>

§

type Output = Vec3<T>

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<T: Num + Copy + Default + AddAssign> AddAssign<[T; 3]> for Vec3<T>

source§

fn add_assign(&mut self, rhs: [T; 3])

Performs the += operation. Read more
source§

impl<T: Num + Copy + Default + AddAssign> AddAssign for Vec3<T>

source§

fn add_assign(&mut self, rhs: Vec3<T>)

Performs the += operation. Read more
source§

impl<T: Clone> Clone for Vec3<T>

source§

fn clone(&self) -> Vec3<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 Vec3<T>

source§

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

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

impl<T: Default> Default for Vec3<T>

source§

fn default() -> Vec3<T>

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

impl<'de, T> Deserialize<'de> for Vec3<T>
where T: Deserialize<'de>,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<T: Num + Copy + Default + DivAssign> DivAssign<T> for Vec3<T>

source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
source§

impl<T: Copy + 'static, U: AsPrimitive<T>> From<&[U; 3]> for Vec3<T>

source§

fn from(other: &[U; 3]) -> Self

Converts to this type from the input type.
source§

impl<T: Copy + 'static, U: AsPrimitive<T>> From<&Vec3<U>> for Vec3<T>

source§

fn from(other: &Vec3<U>) -> Self

Converts to this type from the input type.
source§

impl<T: Num + Clone> From<Vec<T>> for Vec3<T>

source§

fn from(vec: Vec<T>) -> Self

Construct a Vec3 instance from a primitive vector.

source§

impl<T: Hash> Hash for Vec3<T>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<T: Num + Clone> Index<usize> for Vec3<T>

source§

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

Index for accessing elements of this vector.

§

type Output = T

The returned type after indexing.
source§

impl<T: Num + Clone> IndexMut<usize> for Vec3<T>

source§

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

Index for accessing mutable elements of this vector.

source§

impl<T: Copy + 'static, U: AsPrimitive<T>> Into<[T; 3]> for Vec3<U>

source§

fn into(self) -> [T; 3]

Converts this type into the (usually inferred) input type.
source§

impl<T: Num + Copy + Default> Mul<&Vec3<T>> for &Vec3<T>

§

type Output = Vec3<T>

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<T: Num + Copy + Default> Mul<T> for &Vec3<T>

§

type Output = Vec3<T>

The resulting type after applying the * operator.
source§

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

Performs the * operation. Read more
source§

impl<T: Num + Copy + Default + MulAssign> MulAssign<T> for Vec3<T>

source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
source§

impl<T: Num + Copy + Default + MulAssign> MulAssign for Vec3<T>

source§

fn mul_assign(&mut self, rhs: Vec3<T>)

Performs the *= operation. Read more
source§

impl<T: PartialEq> PartialEq for Vec3<T>

source§

fn eq(&self, other: &Vec3<T>) -> 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> Serialize for Vec3<T>
where T: Serialize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T: Num + Copy + Default> Sub<&Vec3<T>> for &Vec3<T>

§

type Output = Vec3<T>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<T: Num + Copy + Default> Sub for Vec3<T>

§

type Output = Vec3<T>

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<T: Num + Copy + Default + SubAssign> SubAssign for Vec3<T>

source§

fn sub_assign(&mut self, rhs: Vec3<T>)

Performs the -= operation. Read more
source§

impl<T: Eq> Eq for Vec3<T>

source§

impl<T> StructuralPartialEq for Vec3<T>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for Vec3<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> CallHasher for T
where T: Hash + ?Sized,

source§

default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64
where H: Hash + ?Sized, B: BuildHasher,

source§

impl<C, M> ConvertSaveload<M> for C

§

type Data = C

(De)Serializable data representation for data type
§

type Error = Infallible

Error may occur during serialization or deserialization of component
source§

fn convert_into<F>( &self, _: F ) -> Result<<C as ConvertSaveload<M>>::Data, <C as ConvertSaveload<M>>::Error>
where F: FnMut(Entity) -> Option<M>,

Convert this data type into serializable form (Data) using entity to marker mapping function
source§

fn convert_from<F>( data: <C as ConvertSaveload<M>>::Data, _: F ) -> Result<C, <C as ConvertSaveload<M>>::Error>
where F: FnMut(M) -> Option<Entity>,

Convert this data from a deserializable form (Data) using entity to marker mapping function
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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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> TryDefault for T
where T: Default,

source§

fn try_default() -> Result<T, String>

Tries to create the default.
source§

fn unwrap_default() -> Self

Calls try_default and panics on an error case.
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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

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
source§

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

source§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> Event for T
where T: Send + Sync + 'static,

source§

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

source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,