[][src]Struct geng_core::prelude::Vec3

#[repr(C)]pub struct Vec3<T> {
    pub x: T,
    pub y: T,
    pub z: T,
}

3-d vector.

Fields

x: Ty: Tz: T

Implementations

impl<T> Vec3<T>[src]

pub fn extend(self, w: T) -> Vec4<T>[src]

pub fn map<U, F>(self, f: F) -> Vec3<U> where
    F: Fn(T) -> U, 
[src]

impl<T> Vec3<T> where
    T: Num + Copy
[src]

pub fn dot(a: Vec3<T>, b: Vec3<T>) -> T[src]

Calculate dot product of two vectors.

Examples

use batbox::*;
assert_eq!(Vec3::dot(vec3(1, 2, 3), vec3(3, 4, 5)), 26);

pub fn cross(a: Vec3<T>, b: Vec3<T>) -> Vec3<T>[src]

Calculate cross product of two vectors.

Examples

use batbox::*;
assert_eq!(Vec3::cross(vec3(1, 2, 3), vec3(3, 4, 5)), vec3(-2, 4, -2));

impl<T> Vec3<T> where
    T: Float
[src]

pub fn normalize(self) -> Vec3<T>[src]

Normalize a vector.

Examples

use batbox::*;
let v: Vec3<f64> = vec3(1.0, 2.0, 3.0);
assert!((v.normalize().len() - 1.0).abs() < 1e-5);

pub fn len(self) -> T[src]

Calculate length of a vector.

pub fn clamp(self, max_len: T) -> Vec3<T>[src]

Trait Implementations

impl<T> Add<Vec3<T>> for Vec3<T> where
    T: Add<T, Output = T>, 
[src]

type Output = Vec3<T>

The resulting type after applying the + operator.

impl<T> AddAssign<Vec3<T>> for Vec3<T> where
    T: AddAssign<T>, 
[src]

impl<U> AsUniform for Vec3<U> where
    [U; 3]: Uniform
[src]

type Uniform = [U; 3]

impl<T> Clone for Vec3<T> where
    T: Clone
[src]

impl<T> Copy for Vec3<T> where
    T: Copy
[src]

impl<T> Debug for Vec3<T> where
    T: Debug
[src]

impl<T> Deref for Vec3<T>[src]

type Target = [T; 3]

The resulting type after dereferencing.

impl<T> DerefMut for Vec3<T>[src]

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

impl<T> Display for Vec3<T> where
    T: Display
[src]

impl<T> Div<T> for Vec3<T> where
    T: Copy + Div<T, Output = T>, 
[src]

type Output = Vec3<T>

The resulting type after applying the / operator.

impl<T> DivAssign<T> for Vec3<T> where
    T: Copy + DivAssign<T>, 
[src]

impl<T> Eq for Vec3<T> where
    T: Eq
[src]

impl<T> From<[T; 3]> for Vec3<T>[src]

impl<T> Hash for Vec3<T> where
    T: Hash
[src]

impl<T> Mul<T> for Vec3<T> where
    T: Copy + Mul<T, Output = T>, 
[src]

type Output = Vec3<T>

The resulting type after applying the * operator.

impl Mul<Vec3<f32>> for f32[src]

type Output = Vec3<f32>

The resulting type after applying the * operator.

impl Mul<Vec3<f64>> for f64[src]

type Output = Vec3<f64>

The resulting type after applying the * operator.

impl Mul<Vec3<i16>> for i16[src]

type Output = Vec3<i16>

The resulting type after applying the * operator.

impl Mul<Vec3<i32>> for i32[src]

type Output = Vec3<i32>

The resulting type after applying the * operator.

impl Mul<Vec3<i64>> for i64[src]

type Output = Vec3<i64>

The resulting type after applying the * operator.

impl Mul<Vec3<i8>> for i8[src]

type Output = Vec3<i8>

The resulting type after applying the * operator.

impl Mul<Vec3<isize>> for isize[src]

type Output = Vec3<isize>

The resulting type after applying the * operator.

impl Mul<Vec3<u16>> for u16[src]

type Output = Vec3<u16>

The resulting type after applying the * operator.

impl Mul<Vec3<u32>> for u32[src]

type Output = Vec3<u32>

The resulting type after applying the * operator.

impl Mul<Vec3<u64>> for u64[src]

type Output = Vec3<u64>

The resulting type after applying the * operator.

impl Mul<Vec3<u8>> for u8[src]

type Output = Vec3<u8>

The resulting type after applying the * operator.

impl Mul<Vec3<usize>> for usize[src]

type Output = Vec3<usize>

The resulting type after applying the * operator.

impl<T> MulAssign<T> for Vec3<T> where
    T: Copy + MulAssign<T>, 
[src]

impl<T> Neg for Vec3<T> where
    T: Neg<Output = T>, 
[src]

type Output = Vec3<T>

The resulting type after applying the - operator.

impl<T> PartialEq<Vec3<T>> for Vec3<T> where
    T: PartialEq<T>, 
[src]

impl<T> Schematic for Vec3<T> where
    T: Schematic + 'static, 
[src]

impl<T> Serialize for Vec3<T> where
    T: Serialize
[src]

impl<T> Sub<Vec3<T>> for Vec3<T> where
    T: Sub<T, Output = T>, 
[src]

type Output = Vec3<T>

The resulting type after applying the - operator.

impl<T> SubAssign<Vec3<T>> for Vec3<T> where
    T: SubAssign<T>, 
[src]

impl<T> Trans for Vec3<T> where
    T: Trans
[src]

impl VertexAttribute for Vec3<f32>[src]

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SetParameter for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Uniform for T where
    T: AsUniform
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,