Struct static_math::vector3::V3 [−][src]
pub struct V3<T>(_);
Implementations
impl<T> V3<T>[src]
pub const fn new(input: [T; 3]) -> Self[src]
create a new V3 from a static array
pub fn new_from(a: T, b: T, c: T) -> Self[src]
create a new V3 from numbers
impl<T: Num + Copy> V3<T>[src]
pub fn zeros() -> Self[src]
create a V3 with all elements zero
pub fn ones() -> Self[src]
create a V3 with all elements one
pub fn cross(&self, rhs: Self) -> Self[src]
calculate the cross product
pub fn x_axis() -> Self[src]
pub fn y_axis() -> Self[src]
pub fn z_axis() -> Self[src]
impl<T: Num + Copy + PartialOrd> V3<T>[src]
impl<T: Num + Copy + Signed + Sum> V3<T>[src]
impl<T: Float> V3<T>[src]
pub fn norm2(&self) -> T[src]
calculate the euclidean norm of the V3
pub fn normalize(&self) -> Result<Self, VectorErrors>[src]
normalize the current V3
Methods from Deref<Target = [T; 3]>
pub fn as_slice(&self) -> &[T][src]
array_methods)Returns a slice containing the entire array. Equivalent to &s[..].
pub fn as_mut_slice(&mut self) -> &mut [T][src]
array_methods)Returns a mutable slice containing the entire array. Equivalent to
&mut s[..].
pub fn each_ref(&self) -> [&T; N][src]
array_methods)Borrows each element and returns an array of references with the same
size as self.
Example
#![feature(array_methods)] let floats = [3.1, 2.7, -1.0]; let float_refs: [&f64; 3] = floats.each_ref(); assert_eq!(float_refs, [&3.1, &2.7, &-1.0]);
This method is particularly useful if combined with other methods, like
map. This way, you can avoid moving the original
array if its elements are not Copy.
#![feature(array_methods, array_map)] let strings = ["Ferris".to_string(), "♥".to_string(), "Rust".to_string()]; let is_ascii = strings.each_ref().map(|s| s.is_ascii()); assert_eq!(is_ascii, [true, false, true]); // We can still access the original array: it has not been moved. assert_eq!(strings.len(), 3);
pub fn each_mut(&mut self) -> [&mut T; N][src]
array_methods)Borrows each element mutably and returns an array of mutable references
with the same size as self.
Example
#![feature(array_methods)] let mut floats = [3.1, 2.7, -1.0]; let float_refs: [&mut f64; 3] = floats.each_mut(); *float_refs[0] = 0.0; assert_eq!(float_refs, [&mut 0.0, &mut 2.7, &mut -1.0]); assert_eq!(floats, [0.0, 2.7, -1.0]);
Trait Implementations
impl<T: Num + Copy> Add<V3<T>> for V3<T>[src]
type Output = Self
The resulting type after applying the + operator.
fn add(self, rhs: Self) -> Self[src]
impl<T: Num + Copy> AddAssign<V3<T>> for V3<T>[src]
fn add_assign(&mut self, other: Self)[src]
impl<T: Clone> Clone for V3<T>[src]
impl<T: Copy> Copy for V3<T>[src]
impl<T: Debug> Debug for V3<T>[src]
impl<T> Deref for V3<T>[src]
impl<T> DerefMut for V3<T>[src]
impl<T: Num + Display> Display for V3<T>[src]
impl<T: Num + Copy> Div<T> for V3<T>[src]
type Output = Self
The resulting type after applying the / operator.
fn div(self, rhs: T) -> Self::Output[src]
impl<T> From<[T; 3]> for V3<T>[src]
impl<T: Num + Copy> Mul<M33<T>> for V3<T>[src]
type Output = V3<T>
The resulting type after applying the * operator.
fn mul(self, rhs: M33<T>) -> V3<T>[src]
impl<T: Num + Copy> Mul<T> for V3<T>[src]
type Output = Self
The resulting type after applying the * operator.
fn mul(self, rhs: T) -> Self::Output[src]
impl<T: Num + Copy> Mul<V3<T>> for M33<T>[src]
type Output = V3<T>
The resulting type after applying the * operator.
fn mul(self, rhs: V3<T>) -> V3<T>[src]
impl<T: Num + Copy> Mul<V3<T>> for V3<T>[src]
impl<T: Num + Copy + Signed> Mul<V3<T>> for Quaternion<T>[src]
type Output = V3<T>
The resulting type after applying the * operator.
fn mul(self, rhs: V3<T>) -> Self::Output[src]
impl<T: Num + Copy + Signed> Neg for V3<T>[src]
impl<T: PartialEq> PartialEq<V3<T>> for V3<T>[src]
impl<T> StructuralPartialEq for V3<T>[src]
impl<T: Num + Copy> Sub<V3<T>> for V3<T>[src]
type Output = Self
The resulting type after applying the - operator.
fn sub(self, rhs: Self) -> Self[src]
impl<T: Num + Copy> SubAssign<V3<T>> for V3<T>[src]
fn sub_assign(&mut self, other: Self)[src]
impl<T: Num + Copy> Zero for V3<T>[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for V3<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for V3<T> where
T: Send,
T: Send,
impl<T> Sync for V3<T> where
T: Sync,
T: Sync,
impl<T> Unpin for V3<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for V3<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,