[−][src]Struct batbox::Vec3
3 dimensional vector.
Fields
x: T
x
coordinate of the vector
y: T
y
coordinate of the vector
z: T
z
coordinate of the vector
Implementations
impl<T> Vec3<T>
[src]
pub fn xy(self) -> Vec2<T>
[src]
pub fn extend(self, w: T) -> Vec4<T>
[src]
pub fn map<U, F: Fn(T) -> U>(self, f: F) -> Vec3<U>
[src]
impl<T: Copy + Num> Vec3<T>
[src]
pub fn dot(a: Self, b: Self) -> 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: Self, b: Self) -> Self
[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: Float> Vec3<T>
[src]
pub fn normalize(self) -> Self
[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) -> Self
[src]
Trait Implementations
impl<T: Add<Output = T>> Add<Vec3<T>> for Vec3<T>
[src]
type Output = Self
The resulting type after applying the +
operator.
pub fn add(self, rhs: Self) -> Self
[src]
impl<T: AddAssign> AddAssign<Vec3<T>> for Vec3<T>
[src]
pub fn add_assign(&mut self, rhs: Self)
[src]
impl<T: Clone> Clone for Vec3<T>
[src]
impl<T: Copy> Copy for Vec3<T>
[src]
impl<T: Debug> Debug for Vec3<T>
[src]
impl<T> Deref for Vec3<T>
[src]
impl<T> DerefMut for Vec3<T>
[src]
impl<'de, T> Deserialize<'de> for Vec3<T> where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
pub fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl<T: Display> Display for Vec3<T>
[src]
impl<T: Copy + Div<Output = T>> Div<T> for Vec3<T>
[src]
type Output = Self
The resulting type after applying the /
operator.
pub fn div(self, rhs: T) -> Self
[src]
impl<T: Copy + DivAssign> DivAssign<T> for Vec3<T>
[src]
pub fn div_assign(&mut self, rhs: T)
[src]
impl<T: Eq> Eq for Vec3<T>
[src]
impl<T> From<[T; 3]> for Vec3<T>
[src]
impl<T: Hash> Hash for Vec3<T>
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T: Copy + Mul<Output = T>> Mul<T> for Vec3<T>
[src]
type Output = Self
The resulting type after applying the *
operator.
pub fn mul(self, rhs: T) -> Self
[src]
impl Mul<Vec3<f32>> for f32
[src]
type Output = Vec3<f32>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Vec3<f32>) -> Vec3<f32>
[src]
impl Mul<Vec3<f64>> for f64
[src]
type Output = Vec3<f64>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Vec3<f64>) -> Vec3<f64>
[src]
impl Mul<Vec3<i16>> for i16
[src]
type Output = Vec3<i16>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Vec3<i16>) -> Vec3<i16>
[src]
impl Mul<Vec3<i32>> for i32
[src]
type Output = Vec3<i32>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Vec3<i32>) -> Vec3<i32>
[src]
impl Mul<Vec3<i64>> for i64
[src]
type Output = Vec3<i64>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Vec3<i64>) -> Vec3<i64>
[src]
impl Mul<Vec3<i8>> for i8
[src]
type Output = Vec3<i8>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Vec3<i8>) -> Vec3<i8>
[src]
impl Mul<Vec3<isize>> for isize
[src]
type Output = Vec3<isize>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Vec3<isize>) -> Vec3<isize>
[src]
impl Mul<Vec3<u16>> for u16
[src]
type Output = Vec3<u16>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Vec3<u16>) -> Vec3<u16>
[src]
impl Mul<Vec3<u32>> for u32
[src]
type Output = Vec3<u32>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Vec3<u32>) -> Vec3<u32>
[src]
impl Mul<Vec3<u64>> for u64
[src]
type Output = Vec3<u64>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Vec3<u64>) -> Vec3<u64>
[src]
impl Mul<Vec3<u8>> for u8
[src]
type Output = Vec3<u8>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Vec3<u8>) -> Vec3<u8>
[src]
impl Mul<Vec3<usize>> for usize
[src]
type Output = Vec3<usize>
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Vec3<usize>) -> Vec3<usize>
[src]
impl<T: Copy + MulAssign> MulAssign<T> for Vec3<T>
[src]
pub fn mul_assign(&mut self, rhs: T)
[src]
impl<T: Neg<Output = T>> Neg for Vec3<T>
[src]
impl<T: PartialEq> PartialEq<Vec3<T>> for Vec3<T>
[src]
impl<T> Serialize for Vec3<T> where
T: Serialize,
[src]
T: Serialize,
pub fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<T> StructuralEq for Vec3<T>
[src]
impl<T> StructuralPartialEq for Vec3<T>
[src]
impl<T: Sub<Output = T>> Sub<Vec3<T>> for Vec3<T>
[src]
type Output = Self
The resulting type after applying the -
operator.
pub fn sub(self, rhs: Self) -> Self
[src]
impl<T: SubAssign> SubAssign<Vec3<T>> for Vec3<T>
[src]
pub fn sub_assign(&mut self, rhs: Self)
[src]
impl<T> Trans for Vec3<T> where
T: Trans,
T: Trans,
T: Trans,
T: Trans,
[src]
T: Trans,
T: Trans,
T: Trans,
T: Trans,
Auto Trait Implementations
impl<T> RefUnwindSafe for Vec3<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
impl<T> Send for Vec3<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for Vec3<T> where
T: Sync,
[src]
T: Sync,
impl<T> Unpin for Vec3<T> where
T: Unpin,
[src]
T: Unpin,
impl<T> UnwindSafe for Vec3<T> where
T: UnwindSafe,
[src]
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> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
pub fn __clone_box(&self, Private) -> *mut ()
[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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,