[−][src]Struct geng_core::prelude::Vec3
3-d vector.
Fields
x: T
y: T
z: T
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>(self, f: F) -> Vec3<U> where
F: Fn(T) -> U,
[src]
F: Fn(T) -> U,
impl<T> Vec3<T> where
T: Num + Copy,
[src]
T: Num + Copy,
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]
T: Float,
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]
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[..]
.
Trait Implementations
impl<T> Add<Vec3<T>> for Vec3<T> where
T: Add<T, Output = T>,
[src]
T: Add<T, Output = T>,
type Output = Vec3<T>
The resulting type after applying the +
operator.
fn add(self, rhs: Vec3<T>) -> Vec3<T>
[src]
impl<T> AddAssign<Vec3<T>> for Vec3<T> where
T: AddAssign<T>,
[src]
T: AddAssign<T>,
fn add_assign(&mut self, rhs: Vec3<T>)
[src]
impl<U> AsUniform for Vec3<U> where
[U; 3]: Uniform,
[src]
[U; 3]: Uniform,
impl<T> Clone for Vec3<T> where
T: Clone,
[src]
T: Clone,
impl<T> Copy for Vec3<T> where
T: Copy,
[src]
T: Copy,
impl<T> Debug for Vec3<T> where
T: Debug,
[src]
T: Debug,
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>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Vec3<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
[src]
__deserializer: __D
) -> Result<Vec3<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl<T> Display for Vec3<T> where
T: Display,
[src]
T: Display,
impl<T> Div<T> for Vec3<T> where
T: Copy + Div<T, Output = T>,
[src]
T: Copy + Div<T, Output = T>,
type Output = Vec3<T>
The resulting type after applying the /
operator.
fn div(self, rhs: T) -> Vec3<T>
[src]
impl<T> DivAssign<T> for Vec3<T> where
T: Copy + DivAssign<T>,
[src]
T: Copy + DivAssign<T>,
fn div_assign(&mut self, rhs: T)
[src]
impl<T> Eq for Vec3<T> where
T: Eq,
[src]
T: Eq,
impl<T> From<[T; 3]> for Vec3<T>
[src]
impl<T> Hash for Vec3<T> where
T: Hash,
[src]
T: Hash,
fn hash<__H>(&self, state: &mut __H) where
__H: Hasher,
[src]
__H: Hasher,
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<T> Mul<T> for Vec3<T> where
T: Copy + Mul<T, Output = T>,
[src]
T: Copy + Mul<T, Output = T>,
type Output = Vec3<T>
The resulting type after applying the *
operator.
fn mul(self, rhs: T) -> Vec3<T>
[src]
impl Mul<Vec3<f32>> for f32
[src]
type Output = Vec3<f32>
The resulting type after applying the *
operator.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
fn mul(self, rhs: Vec3<usize>) -> Vec3<usize>
[src]
impl<T> MulAssign<T> for Vec3<T> where
T: Copy + MulAssign<T>,
[src]
T: Copy + MulAssign<T>,
fn mul_assign(&mut self, rhs: T)
[src]
impl<T> Neg for Vec3<T> where
T: Neg<Output = T>,
[src]
T: Neg<Output = T>,
impl<T> PartialEq<Vec3<T>> for Vec3<T> where
T: PartialEq<T>,
[src]
T: PartialEq<T>,
impl<T> Serialize for Vec3<T> where
T: Serialize,
[src]
T: Serialize,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
[src]
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
impl<T> StructuralEq for Vec3<T>
[src]
impl<T> StructuralPartialEq for Vec3<T>
[src]
impl<T> Sub<Vec3<T>> for Vec3<T> where
T: Sub<T, Output = T>,
[src]
T: Sub<T, Output = T>,
type Output = Vec3<T>
The resulting type after applying the -
operator.
fn sub(self, rhs: Vec3<T>) -> Vec3<T>
[src]
impl<T> SubAssign<Vec3<T>> for Vec3<T> where
T: SubAssign<T>,
[src]
T: SubAssign<T>,
fn sub_assign(&mut self, rhs: Vec3<T>)
[src]
impl<T> Trans for Vec3<T> where
T: Trans,
[src]
T: Trans,
fn create_schema() -> Schema
[src]
fn write_to(&self, writer: &mut dyn Write) -> Result<(), Error>
[src]
fn read_from(reader: &mut dyn Read) -> Result<Vec3<T>, Error>
[src]
impl VertexAttribute for Vec3<f32>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Vec3<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Vec3<T> where
T: Send,
T: Send,
impl<T> Sync for Vec3<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Vec3<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Vec3<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,
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> Diff for T where
T: 'static + PartialEq<T> + Send + Copy + Sync + for<'de> Deserialize<'de> + Serialize + Trans,
[src]
T: 'static + PartialEq<T> + Send + Copy + Sync + for<'de> Deserialize<'de> + Serialize + Trans,
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
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.
fn to_owned(&self) -> T
[src]
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Uniform for T where
T: AsUniform,
[src]
T: AsUniform,
fn apply(&self, gl: &Context, info: &UniformInfo)
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,