[−][src]Struct screen_layer::Vec2
This type is used to represent the coordinate, and width and height of a layer. Vector type suited for 2D spatial coordinates.
Fields
x: Ty: TImplementations
impl<T> Vec2<T>[src]
This type is used to represent the coordinate, and width and height of a layer.
impl<T> Vec2<T>[src]
This type is used to represent the coordinate, and width and height of a layer.
impl<T> Vec2<T>[src]
This type is used to represent the coordinate, and width and height of a layer.
pub fn broadcast(val: T) -> Vec2<T> where
T: Copy, [src]
T: Copy,
Broadcasts a single value to all elements of a new vector.
This function is also named splat() in some libraries, or
set1() in Intel intrinsics.
"Broadcast" was chosen as the name because it is explicit enough and is the same wording as the description in relevant Intel intrinsics.
assert_eq!(Vec4::broadcast(5), Vec4::new(5,5,5,5)); assert_eq!(Vec4::broadcast(5), Vec4::from(5));
pub fn zero() -> Vec2<T> where
T: Zero, [src]
T: Zero,
Creates a new vector with all elements set to zero.
assert_eq!(Vec4::zero(), Vec4::new(0,0,0,0)); assert_eq!(Vec4::zero(), Vec4::broadcast(0)); assert_eq!(Vec4::zero(), Vec4::from(0));
pub fn one() -> Vec2<T> where
T: One, [src]
T: One,
Creates a new vector with all elements set to one.
assert_eq!(Vec4::one(), Vec4::new(1,1,1,1)); assert_eq!(Vec4::one(), Vec4::broadcast(1)); assert_eq!(Vec4::one(), Vec4::from(1));
pub fn iota() -> Vec2<T> where
T: Zero + One + AddAssign<T> + Copy, [src]
T: Zero + One + AddAssign<T> + Copy,
Produces a vector of the first n integers, starting from zero,
where n is the number of elements for this vector type.
The iota (ι) function, originating from APL.
See this StackOverflow answer.
This is mostly useful for debugging purposes and tests.
assert_eq!(Vec4::iota(), Vec4::new(0, 1, 2, 3));
pub const fn elem_count(&self) -> usize[src]
Convenience method which returns the number of elements of this vector.
let v = Vec4::new(0,1,2,3); assert_eq!(v.elem_count(), 4);
pub const ELEM_COUNT: usize[src]
Convenience constant representing the number of elements for this vector type.
pub fn into_tuple(self) -> (T, T)[src]
Converts this into a tuple with the same number of elements by consuming.
pub fn into_array(self) -> [T; 2][src]
Converts this vector into a fixed-size array.
pub fn as_slice(&self) -> &[T][src]
View this vector as an immutable slice.
pub fn as_mut_slice(&mut self) -> &mut [T][src]
View this vector as a mutable slice.
pub fn from_slice(slice: &[T]) -> Vec2<T> where
T: Default + Copy, [src]
T: Default + Copy,
Collects the content of a slice into a new vector. Elements are initialized to their default values.
pub fn map<D, F>(self, f: F) -> Vec2<D> where
F: FnMut(T) -> D, [src]
F: FnMut(T) -> D,
Returns a memberwise-converted copy of this vector, using the given conversion closure.
let v = Vec4::new(0_f32, 1., 1.8, 3.14); let i = v.map(|x| x.round() as i32); assert_eq!(i, Vec4::new(0, 1, 2, 3));
Performing LERP on integer vectors by concisely converting them to floats:
let a = Vec4::new(0,1,2,3).map(|x| x as f32); let b = Vec4::new(2,3,4,5).map(|x| x as f32); let v = Vec4::lerp(a, b, 0.5_f32).map(|x| x.round() as i32); assert_eq!(v, Vec4::new(1,2,3,4));
pub fn map2<D, F, S>(self, other: Vec2<S>, f: F) -> Vec2<D> where
F: FnMut(T, S) -> D, [src]
F: FnMut(T, S) -> D,
Applies the function f to each element of two vectors, pairwise, and returns the result.
let a = Vec4::<u8>::new(255, 254, 253, 252); let b = Vec4::<u8>::new(1, 2, 3, 4); let v = a.map2(b, |a, b| a.wrapping_add(b)); assert_eq!(v, Vec4::zero()); let v = a.map2(b, u8::wrapping_add); assert_eq!(v, Vec4::zero());
pub fn map3<D, F, S1, S2>(self, a: Vec2<S1>, b: Vec2<S2>, f: F) -> Vec2<D> where
F: FnMut(T, S1, S2) -> D, [src]
F: FnMut(T, S1, S2) -> D,
Applies the function f to each element of three vectors, and returns the result.
let a = Vec4::<u8>::new(255, 254, 253, 252); let b = Vec4::<u8>::new(1, 2, 3, 4); let c = Vec4::<u8>::new(1, 2, 3, 4); let v = a.map3(b, c, |a, b, c| a.wrapping_add(b) + c); assert_eq!(v, c);
pub fn apply<F>(&mut self, f: F) where
T: Copy,
F: FnMut(T) -> T, [src]
T: Copy,
F: FnMut(T) -> T,
Applies the function f to each element of this vector, in-place.
let mut v = Vec4::new(0_u32, 1, 2, 3); v.apply(|x| x.count_ones()); assert_eq!(v, Vec4::new(0, 1, 1, 2));
pub fn apply2<F, S>(&mut self, other: Vec2<S>, f: F) where
T: Copy,
F: FnMut(T, S) -> T, [src]
T: Copy,
F: FnMut(T, S) -> T,
Applies the function f to each element of two vectors, pairwise, in-place.
let mut a = Vec4::<u8>::new(255, 254, 253, 252); let b = Vec4::<u8>::new(1, 2, 3, 4); a.apply2(b, |a, b| a.wrapping_add(b)); assert_eq!(a, Vec4::zero()); a.apply2(b, u8::wrapping_add); assert_eq!(a, b);
pub fn apply3<F, S1, S2>(&mut self, a: Vec2<S1>, b: Vec2<S2>, f: F) where
T: Copy,
F: FnMut(T, S1, S2) -> T, [src]
T: Copy,
F: FnMut(T, S1, S2) -> T,
Applies the function f to each element of three vectors, in-place.
let mut a = Vec4::<u8>::new(255, 254, 253, 252); let b = Vec4::<u8>::new(1, 2, 3, 4); let c = Vec4::<u8>::new(1, 2, 3, 4); a.apply3(b, c, |a, b, c| a.wrapping_add(b) + c); assert_eq!(a, c);
pub fn zip<S>(self, other: Vec2<S>) -> Vec2<(T, S)>[src]
"Zips" two vectors together into a vector of tuples.
let a = Vec4::<u8>::new(255, 254, 253, 252); let b = Vec4::<u8>::new(1, 2, 3, 4); assert_eq!(a.zip(b), Vec4::new((255, 1), (254, 2), (253, 3), (252, 4)));
pub fn as_<D>(self) -> Vec2<D> where
T: AsPrimitive<D>,
D: 'static + Copy, [src]
T: AsPrimitive<D>,
D: 'static + Copy,
Returns a memberwise-converted copy of this vector, using AsPrimitive.
Examples
let v = Vec4::new(0_f32, 1., 2., 3.); let i: Vec4<i32> = v.as_(); assert_eq!(i, Vec4::new(0, 1, 2, 3));
Safety
In Rust versions before 1.45.0, some uses of the as operator were not entirely safe.
In particular, it was undefined behavior if:
- A truncated floating point value cannot fit in the target integer type (#10184);
let x: u8 = (1.04E+17).as_(); // UB
- Or a floating point value does not fit in another floating point type (#15536).
let x: f32 = (1e300f64).as_(); // UB
pub fn numcast<D>(self) -> Option<Vec2<D>> where
T: NumCast,
D: NumCast, [src]
T: NumCast,
D: NumCast,
Returns a memberwise-converted copy of this vector, using NumCast.
let v = Vec4::new(0_f32, 1., 2., 3.); let i: Vec4<i32> = v.numcast().unwrap(); assert_eq!(i, Vec4::new(0, 1, 2, 3));
pub fn mul_add<V>(self, mul: V, add: V) -> Vec2<T> where
T: MulAdd<T, T, Output = T>,
V: Into<Vec2<T>>, [src]
T: MulAdd<T, T, Output = T>,
V: Into<Vec2<T>>,
Fused multiply-add. Returns self * mul + add, and may be implemented
efficiently by the hardware.
The compiler is often able to detect this kind of operation, so generally you don't need to use it. However, it can make your intent clear.
The name for this method is the one used by the same operation on primitive floating-point types.
let a = Vec4::new(0,1,2,3); let b = Vec4::new(4,5,6,7); let c = Vec4::new(8,9,0,1); assert_eq!(a*b+c, a.mul_add(b, c));
pub fn is_any_negative(&self) -> bool where
T: Signed, [src]
T: Signed,
Is any of the elements negative ?
This was intended for checking the validity of extent vectors, but can make sense for other types too.
pub fn are_all_positive(&self) -> bool where
T: Signed, [src]
T: Signed,
Are all of the elements positive ?
pub fn min<V>(a: V, b: V) -> Vec2<T> where
T: Ord,
V: Into<Vec2<T>>, [src]
T: Ord,
V: Into<Vec2<T>>,
Compares elements of a and b, and returns the minimum values into a new
vector, using total ordering.
let a = Vec4::new(0,1,2,3); let b = Vec4::new(3,2,1,0); let m = Vec4::new(0,1,1,0); assert_eq!(m, Vec4::min(a, b));
pub fn max<V>(a: V, b: V) -> Vec2<T> where
T: Ord,
V: Into<Vec2<T>>, [src]
T: Ord,
V: Into<Vec2<T>>,
Compares elements of a and b, and returns the maximum values into a new
vector, using total ordering.
let a = Vec4::new(0,1,2,3); let b = Vec4::new(3,2,1,0); let m = Vec4::new(3,2,2,3); assert_eq!(m, Vec4::max(a, b));
pub fn partial_min<V>(a: V, b: V) -> Vec2<T> where
T: PartialOrd<T>,
V: Into<Vec2<T>>, [src]
T: PartialOrd<T>,
V: Into<Vec2<T>>,
Compares elements of a and b, and returns the minimum values into a new
vector, using partial ordering.
let a = Vec4::new(0,1,2,3); let b = Vec4::new(3,2,1,0); let m = Vec4::new(0,1,1,0); assert_eq!(m, Vec4::partial_min(a, b));
pub fn partial_max<V>(a: V, b: V) -> Vec2<T> where
T: PartialOrd<T>,
V: Into<Vec2<T>>, [src]
T: PartialOrd<T>,
V: Into<Vec2<T>>,
Compares elements of a and b, and returns the maximum values into a new
vector, using partial ordering.
let a = Vec4::new(0,1,2,3); let b = Vec4::new(3,2,1,0); let m = Vec4::new(3,2,2,3); assert_eq!(m, Vec4::partial_max(a, b));
pub fn reduce_min(self) -> T where
T: Ord, [src]
T: Ord,
Returns the element which has the lowest value in this vector, using total ordering.
assert_eq!(-5, Vec4::new(0, 5, -5, 8).reduce_min());
pub fn reduce_max(self) -> T where
T: Ord, [src]
T: Ord,
Returns the element which has the highest value in this vector, using total ordering.
assert_eq!(8, Vec4::new(0, 5, -5, 8).reduce_max());
pub fn reduce_partial_min(self) -> T where
T: PartialOrd<T>, [src]
T: PartialOrd<T>,
Returns the element which has the lowest value in this vector, using partial ordering.
assert_eq!(-5_f32, Vec4::new(0_f32, 5., -5., 8.).reduce_partial_min());
pub fn reduce_partial_max(self) -> T where
T: PartialOrd<T>, [src]
T: PartialOrd<T>,
Returns the element which has the highest value in this vector, using partial ordering.
assert_eq!(8_f32, Vec4::new(0_f32, 5., -5., 8.).reduce_partial_max());
pub fn reduce_bitand(self) -> T where
T: BitAnd<T, Output = T>, [src]
T: BitAnd<T, Output = T>,
Returns the result of bitwise-AND (&) on all elements of this vector.
assert_eq!(true, Vec4::new(true, true, true, true).reduce_bitand()); assert_eq!(false, Vec4::new(true, false, true, true).reduce_bitand()); assert_eq!(false, Vec4::new(true, true, true, false).reduce_bitand());
pub fn reduce_bitor(self) -> T where
T: BitOr<T, Output = T>, [src]
T: BitOr<T, Output = T>,
Returns the result of bitwise-OR (|) on all elements of this vector.
assert_eq!(false, Vec4::new(false, false, false, false).reduce_bitor()); assert_eq!(true, Vec4::new(false, false, true, false).reduce_bitor());
pub fn reduce_bitxor(self) -> T where
T: BitXor<T, Output = T>, [src]
T: BitXor<T, Output = T>,
Returns the result of bitwise-XOR (^) on all elements of this vector.
assert_eq!(false, Vec4::new(true, true, true, true).reduce_bitxor()); assert_eq!(true, Vec4::new(true, false, true, true).reduce_bitxor());
pub fn reduce<F>(self, f: F) -> T where
F: FnMut(T, T) -> T, [src]
F: FnMut(T, T) -> T,
Reduces this vector with the given accumulator closure.
pub fn product(self) -> T where
T: Mul<T, Output = T>, [src]
T: Mul<T, Output = T>,
Returns the product of each of this vector's elements.
assert_eq!(1*2*3*4, Vec4::new(1, 2, 3, 4).product());
pub fn sum(self) -> T where
T: Add<T, Output = T>, [src]
T: Add<T, Output = T>,
Returns the sum of each of this vector's elements.
assert_eq!(1+2+3+4, Vec4::new(1, 2, 3, 4).sum());
pub fn average(self) -> T where
T: Add<T, Output = T> + Div<T, Output = T> + From<u8>, [src]
T: Add<T, Output = T> + Div<T, Output = T> + From<u8>,
Returns the average of this vector's elements.
assert_eq!(2.5_f32, Vec4::new(1_f32, 2., 3., 4.).average());
You should avoid using it on u8 vectors, not only because integer
overflows cause panics in debug mode, but also because of integer division, the result
may not be the one you expect.
// This causes a panic! let red = Vec4::new(255u8, 1, 0, 0); let grey_level = red.average(); assert_eq!(grey_level, 128);
You may want to convert the elements to bigger integers (or floating-point) instead:
let red = Vec4::new(255u8, 1, 128, 128); let red = red.map(|c| c as u16); let grey_level = red.average() as u8; assert_eq!(grey_level, 128); let red = red.map(|c| c as f32); let grey_level = red.average().round() as u8; assert_eq!(grey_level, 128);
pub fn sqrt(self) -> Vec2<T> where
T: Real, [src]
T: Real,
Returns a new vector which elements are the respective square roots of this vector's elements.
let v = Vec4::new(1f32, 2f32, 3f32, 4f32); let s = Vec4::new(1f32, 4f32, 9f32, 16f32); assert_eq!(v, s.sqrt());
pub fn rsqrt(self) -> Vec2<T> where
T: Real, [src]
T: Real,
Returns a new vector which elements are the respective reciprocal square roots of this vector's elements.
let v = Vec4::new(1f32, 0.5f32, 1f32/3f32, 0.25f32); let s = Vec4::new(1f32, 4f32, 9f32, 16f32); assert_eq!(v, s.rsqrt());
pub fn recip(self) -> Vec2<T> where
T: Real, [src]
T: Real,
Returns a new vector which elements are the respective reciprocal of this vector's elements.
let v = Vec4::new(1f32, 0.5f32, 0.25f32, 0.125f32); let s = Vec4::new(1f32, 2f32, 4f32, 8f32); assert_eq!(v, s.recip()); assert_eq!(s, v.recip());
pub fn ceil(self) -> Vec2<T> where
T: Real, [src]
T: Real,
Returns a new vector which elements are rounded to the nearest greater integer.
let v = Vec4::new(0_f32, 1., 1.8, 3.14); assert_eq!(v.ceil(), Vec4::new(0f32, 1f32, 2f32, 4f32));
pub fn floor(self) -> Vec2<T> where
T: Real, [src]
T: Real,
Returns a new vector which elements are rounded down to the nearest lower integer.
let v = Vec4::new(0_f32, 1., 1.8, 3.14); assert_eq!(v.floor(), Vec4::new(0f32, 1f32, 1f32, 3f32));
pub fn round(self) -> Vec2<T> where
T: Real, [src]
T: Real,
Returns a new vector which elements are rounded to the nearest integer.
let v = Vec4::new(0_f32, 1., 1.8, 3.14); assert_eq!(v.round(), Vec4::new(0f32, 1f32, 2f32, 3f32));
pub fn hadd(self, rhs: Vec2<T>) -> Vec2<T> where
T: Add<T, Output = T>, [src]
T: Add<T, Output = T>,
Horizontally adds adjacent pairs of elements in self and rhs into a new vector.
let a = Vec4::new(0, 1, 2, 3); let b = Vec4::new(4, 5, 6, 7); let h = Vec4::new(0+1, 2+3, 4+5, 6+7); assert_eq!(h, a.hadd(b));
pub fn partial_cmpeq<Rhs>(&self, rhs: &Rhs) -> Vec2<bool> where
T: PartialEq<T>,
Rhs: AsRef<Vec2<T>>, [src]
T: PartialEq<T>,
Rhs: AsRef<Vec2<T>>,
Compares each element of two vectors with the partial equality test, returning a boolean vector.
let u = Vec4::new(0,2,2,6); let v = Vec4::new(0,1,2,3); assert_eq!(u.partial_cmpeq(&v), Vec4::new(true, false, true, false));
pub fn partial_cmpne<Rhs>(&self, rhs: &Rhs) -> Vec2<bool> where
T: PartialEq<T>,
Rhs: AsRef<Vec2<T>>, [src]
T: PartialEq<T>,
Rhs: AsRef<Vec2<T>>,
Compares each element of two vectors with the partial not-equal test, returning a boolean vector.
let u = Vec4::new(0,2,2,6); let v = Vec4::new(0,1,2,3); assert_eq!(u.partial_cmpne(&v), Vec4::new(false, true, false, true));
pub fn partial_cmpge<Rhs>(&self, rhs: &Rhs) -> Vec2<bool> where
T: PartialOrd<T>,
Rhs: AsRef<Vec2<T>>, [src]
T: PartialOrd<T>,
Rhs: AsRef<Vec2<T>>,
Compares each element of two vectors with the partial greater-or-equal test, returning a boolean vector.
let u = Vec4::new(0,2,2,2); let v = Vec4::new(0,1,2,3); assert_eq!(u.partial_cmpge(&v), Vec4::new(true, true, true, false));
pub fn partial_cmpgt<Rhs>(&self, rhs: &Rhs) -> Vec2<bool> where
T: PartialOrd<T>,
Rhs: AsRef<Vec2<T>>, [src]
T: PartialOrd<T>,
Rhs: AsRef<Vec2<T>>,
Compares each element of two vectors with the partial greater-than test, returning a boolean vector.
let u = Vec4::new(0,2,2,6); let v = Vec4::new(0,1,2,3); assert_eq!(u.partial_cmpgt(&v), Vec4::new(false, true, false, true));
pub fn partial_cmple<Rhs>(&self, rhs: &Rhs) -> Vec2<bool> where
T: PartialOrd<T>,
Rhs: AsRef<Vec2<T>>, [src]
T: PartialOrd<T>,
Rhs: AsRef<Vec2<T>>,
Compares each element of two vectors with the partial less-or-equal test, returning a boolean vector.
let u = Vec4::new(0,2,2,2); let v = Vec4::new(0,1,2,3); assert_eq!(u.partial_cmple(&v), Vec4::new(true, false, true, true));
pub fn partial_cmplt<Rhs>(&self, rhs: &Rhs) -> Vec2<bool> where
T: PartialOrd<T>,
Rhs: AsRef<Vec2<T>>, [src]
T: PartialOrd<T>,
Rhs: AsRef<Vec2<T>>,
Compares each element of two vectors with the partial less-than test, returning a boolean vector.
let u = Vec4::new(0,2,2,2); let v = Vec4::new(0,1,2,3); assert_eq!(u.partial_cmplt(&v), Vec4::new(false, false, false, true));
pub fn cmpeq<Rhs>(&self, rhs: &Rhs) -> Vec2<bool> where
T: Eq,
Rhs: AsRef<Vec2<T>>, [src]
T: Eq,
Rhs: AsRef<Vec2<T>>,
Compares each element of two vectors with the partial equality test, returning a boolean vector.
let u = Vec4::new(0,2,2,6); let v = Vec4::new(0,1,2,3); assert_eq!(u.cmpeq(&v), Vec4::new(true, false, true, false));
pub fn cmpne<Rhs>(&self, rhs: &Rhs) -> Vec2<bool> where
T: Eq,
Rhs: AsRef<Vec2<T>>, [src]
T: Eq,
Rhs: AsRef<Vec2<T>>,
Compares each element of two vectors with the total not-equal test, returning a boolean vector.
let u = Vec4::new(0,2,2,6); let v = Vec4::new(0,1,2,3); assert_eq!(u.cmpne(&v), Vec4::new(false, true, false, true));
pub fn cmpge<Rhs>(&self, rhs: &Rhs) -> Vec2<bool> where
T: Ord,
Rhs: AsRef<Vec2<T>>, [src]
T: Ord,
Rhs: AsRef<Vec2<T>>,
Compares each element of two vectors with the total greater-or-equal test, returning a boolean vector.
let u = Vec4::new(0,2,2,2); let v = Vec4::new(0,1,2,3); assert_eq!(u.cmpge(&v), Vec4::new(true, true, true, false));
pub fn cmpgt<Rhs>(&self, rhs: &Rhs) -> Vec2<bool> where
T: Ord,
Rhs: AsRef<Vec2<T>>, [src]
T: Ord,
Rhs: AsRef<Vec2<T>>,
Compares each element of two vectors with the total greater-than test, returning a boolean vector.
let u = Vec4::new(0,2,2,6); let v = Vec4::new(0,1,2,3); assert_eq!(u.cmpgt(&v), Vec4::new(false, true, false, true));
pub fn cmple<Rhs>(&self, rhs: &Rhs) -> Vec2<bool> where
T: Ord,
Rhs: AsRef<Vec2<T>>, [src]
T: Ord,
Rhs: AsRef<Vec2<T>>,
Compares each element of two vectors with the total less-or-equal test, returning a boolean vector.
let u = Vec4::new(0,2,2,2); let v = Vec4::new(0,1,2,3); assert_eq!(u.cmple(&v), Vec4::new(true, false, true, true));
pub fn cmplt<Rhs>(&self, rhs: &Rhs) -> Vec2<bool> where
T: Ord,
Rhs: AsRef<Vec2<T>>, [src]
T: Ord,
Rhs: AsRef<Vec2<T>>,
Compares each element of two vectors with the total less-than test, returning a boolean vector.
let u = Vec4::new(0,2,2,2); let v = Vec4::new(0,1,2,3); assert_eq!(u.cmplt(&v), Vec4::new(false, false, false, true));
pub fn lerp_unclamped_precise<S>(
from: Vec2<T>,
to: Vec2<T>,
factor: S
) -> Vec2<T> where
T: Copy + One<Output = T> + Mul<T> + Sub<T, Output = T> + MulAdd<T, T, Output = T>,
S: Into<Vec2<T>>, [src]
from: Vec2<T>,
to: Vec2<T>,
factor: S
) -> Vec2<T> where
T: Copy + One<Output = T> + Mul<T> + Sub<T, Output = T> + MulAdd<T, T, Output = T>,
S: Into<Vec2<T>>,
Returns the linear interpolation of from to to with factor unconstrained.
See the Lerp trait.
pub fn lerp_unclamped<S>(from: Vec2<T>, to: Vec2<T>, factor: S) -> Vec2<T> where
T: Copy + Sub<T, Output = T> + MulAdd<T, T, Output = T>,
S: Into<Vec2<T>>, [src]
T: Copy + Sub<T, Output = T> + MulAdd<T, T, Output = T>,
S: Into<Vec2<T>>,
Same as lerp_unclamped_precise, implemented as a possibly faster but less precise operation.
See the Lerp trait.
pub fn lerp<S>(from: Vec2<T>, to: Vec2<T>, factor: S) -> Vec2<T> where
T: Copy + Sub<T, Output = T> + MulAdd<T, T, Output = T>,
S: Clamp<S> + Into<Vec2<T>> + Zero + One, [src]
T: Copy + Sub<T, Output = T> + MulAdd<T, T, Output = T>,
S: Clamp<S> + Into<Vec2<T>> + Zero + One,
Returns the linear interpolation of from to to with factor constrained to be
between 0 and 1.
See the Lerp trait.
pub fn lerp_precise<S>(from: Vec2<T>, to: Vec2<T>, factor: S) -> Vec2<T> where
T: Copy + One<Output = T> + Mul<T> + Sub<T, Output = T> + MulAdd<T, T, Output = T>,
S: Clamp<S> + Into<Vec2<T>> + Zero + One, [src]
T: Copy + One<Output = T> + Mul<T> + Sub<T, Output = T> + MulAdd<T, T, Output = T>,
S: Clamp<S> + Into<Vec2<T>> + Zero + One,
Returns the linear interpolation of from to to with factor constrained to be
between 0 and 1.
See the Lerp trait.
impl Vec2<bool>[src]
This type is used to represent the coordinate, and width and height of a layer.
pub fn reduce_and(self) -> bool[src]
Returns the result of logical AND (&&) on all elements of this vector.
assert_eq!(true, Vec4::new(true, true, true, true).reduce_and()); assert_eq!(false, Vec4::new(true, false, true, true).reduce_and()); assert_eq!(false, Vec4::new(true, true, true, false).reduce_and());
pub fn reduce_or(self) -> bool[src]
Returns the result of logical OR (||) on all elements of this vector.
assert_eq!(false, Vec4::new(false, false, false, false).reduce_or()); assert_eq!(true, Vec4::new(false, false, true, false).reduce_or());
pub fn reduce_ne(self) -> bool[src]
Reduces this vector using total inequality.
assert_eq!(false, Vec4::new(true, true, true, true).reduce_ne()); assert_eq!(true, Vec4::new(true, false, true, true).reduce_ne());
impl<T> Vec2<T>[src]
This type is used to represent the coordinate, and width and height of a layer.
pub fn dot(self, v: Vec2<T>) -> T where
T: Add<T, Output = T> + Mul<T, Output = T>, [src]
T: Add<T, Output = T> + Mul<T, Output = T>,
Dot product between this vector and another.
pub fn magnitude_squared(self) -> T where
T: Copy + Add<T, Output = T> + Mul<T, Output = T>, [src]
T: Copy + Add<T, Output = T> + Mul<T, Output = T>,
The squared magnitude of a vector is its spatial length, squared.
It is slightly cheaper to compute than magnitude because it avoids a square root.
pub fn magnitude(self) -> T where
T: Add<T, Output = T> + Real, [src]
T: Add<T, Output = T> + Real,
The magnitude of a vector is its spatial length.
pub fn distance_squared(self, v: Vec2<T>) -> T where
T: Copy + Add<T, Output = T> + Sub<T, Output = T> + Mul<T, Output = T>, [src]
T: Copy + Add<T, Output = T> + Sub<T, Output = T> + Mul<T, Output = T>,
Squared distance between two point vectors.
It is slightly cheaper to compute than distance because it avoids a square root.
pub fn distance(self, v: Vec2<T>) -> T where
T: Add<T, Output = T> + Real, [src]
T: Add<T, Output = T> + Real,
Distance between two point vectors.
pub fn normalized(self) -> Vec2<T> where
T: Add<T, Output = T> + Real, [src]
T: Add<T, Output = T> + Real,
Get a copy of this direction vector such that its length equals 1.
pub fn try_normalized<E>(self) -> Option<Vec2<T>> where
T: RelativeEq<T, Epsilon = E> + Add<T, Output = T> + Real,
E: Add<E, Output = E> + Real, [src]
T: RelativeEq<T, Epsilon = E> + Add<T, Output = T> + Real,
E: Add<E, Output = E> + Real,
Get a copy of this direction vector such that its length equals 1. If all components approximately zero, None is returned (uses RelativeEq).
pub fn normalize(&mut self) where
T: Add<T, Output = T> + Real, [src]
T: Add<T, Output = T> + Real,
Divide this vector's components such that its length equals 1.
pub fn is_normalized<E>(self) -> bool where
T: RelativeEq<T, Epsilon = E> + Add<T, Output = T> + Real,
E: Real, [src]
T: RelativeEq<T, Epsilon = E> + Add<T, Output = T> + Real,
E: Real,
Is this vector normalized ? (Uses RelativeEq)
pub fn is_approx_zero<E>(self) -> bool where
T: RelativeEq<T, Epsilon = E> + Add<T, Output = T> + Real,
E: Real, [src]
T: RelativeEq<T, Epsilon = E> + Add<T, Output = T> + Real,
E: Real,
Is this vector approximately zero ? (Uses RelativeEq)
pub fn is_magnitude_close_to<E>(self, x: T) -> bool where
T: RelativeEq<T, Epsilon = E> + Add<T, Output = T> + Real,
E: Real, [src]
T: RelativeEq<T, Epsilon = E> + Add<T, Output = T> + Real,
E: Real,
Is the magnitude of the vector close to x ? (Uses RelativeEq)
pub fn angle_between(self, v: Vec2<T>) -> T where
T: Add<T, Output = T> + Real + Clamp<T>, [src]
T: Add<T, Output = T> + Real + Clamp<T>,
Get the smallest angle, in radians, between two direction vectors.
pub fn angle_between_degrees(self, v: Vec2<T>) -> T where
T: Add<T, Output = T> + Real + Clamp<T>, [src]
T: Add<T, Output = T> + Real + Clamp<T>,
Use to_degrees() on the value returned by angle_between() instead
Get the smallest angle, in degrees, between two direction vectors.
pub fn reflected(self, surface_normal: Vec2<T>) -> Vec2<T> where
T: Copy + Add<T, Output = T, Output = T> + Mul<T, Output = T> + Sub<T, Output = T> + Add<T>, [src]
T: Copy + Add<T, Output = T, Output = T> + Mul<T, Output = T> + Sub<T, Output = T> + Add<T>,
The reflection direction for this vector on a surface which normal is given.
pub fn refracted(self, surface_normal: Vec2<T>, eta: T) -> Vec2<T> where
T: Real<Output = T, Output = T> + Add<T> + Mul<T>, [src]
T: Real<Output = T, Output = T> + Add<T> + Mul<T>,
The refraction vector for this incident vector, a surface normal and a ratio of
indices of refraction (eta).
pub fn face_forward(self, incident: Vec2<T>, reference: Vec2<T>) -> Vec2<T> where
T: Add<T, Output = T> + Mul<T, Output = T> + Zero + PartialOrd<T> + Neg<Output = T>, [src]
T: Add<T, Output = T> + Mul<T, Output = T> + Zero + PartialOrd<T> + Neg<Output = T>,
Orients a vector to point away from a surface as defined by its normal.
impl<T> Vec2<T>[src]
This type is used to represent the coordinate, and width and height of a layer.
pub fn determine_side(self, a: Vec2<T>, b: Vec2<T>) -> T where
T: Copy + Sub<T, Output = T> + Mul<T, Output = T>, [src]
T: Copy + Sub<T, Output = T> + Mul<T, Output = T>,
A signed value which tells in which half-space of the line segment ab this point lies.
Returns:
< 0: This point lies in the half-space right of segmentab.== 0: This point lies in the infinite line along segmentab.> 0: This point lies in the half-space left of segmentab.
pub fn signed_triangle_area(a: Vec2<T>, b: Vec2<T>, c: Vec2<T>) -> T where
T: Copy + Sub<T, Output = T> + Mul<T, Output = T> + One + Div<T, Output = T> + Add<T, Output = T>, [src]
T: Copy + Sub<T, Output = T> + Mul<T, Output = T> + One + Div<T, Output = T> + Add<T, Output = T>,
The signed area of the triangle defined by points (a, b, c).
pub fn triangle_area(a: Vec2<T>, b: Vec2<T>, c: Vec2<T>) -> T where
T: Copy + Sub<T, Output = T> + Mul<T, Output = T> + One + Div<T, Output = T> + Add<T, Output = T> + PartialOrd<T> + Neg<Output = T>, [src]
T: Copy + Sub<T, Output = T> + Mul<T, Output = T> + One + Div<T, Output = T> + Add<T, Output = T> + PartialOrd<T> + Neg<Output = T>,
The area of the triangle defined by points (a, b, c).
pub fn rotated_z(self, angle_radians: T) -> Vec2<T> where
T: Real, [src]
T: Real,
Returns this vector rotated in 2D, counter-clockwise.
use std::f32::consts::PI; assert_relative_eq!(Vec2::unit_x().rotated_z(0_f32), Vec2::unit_x()); assert_relative_eq!(Vec2::unit_x().rotated_z(PI/2.), Vec2::unit_y()); assert_relative_eq!(Vec2::unit_x().rotated_z(PI), -Vec2::unit_x()); assert_relative_eq!(Vec2::unit_x().rotated_z(PI*1.5), -Vec2::unit_y()); assert_relative_eq!(Vec2::unit_x().rotated_z(PI*2.), Vec2::unit_x(), epsilon = 0.000001);
pub fn rotate_z(&mut self, angle_radians: T) where
T: Real, [src]
T: Real,
Rotates this vector in 2D. See rotated_z().
pub fn unit_x() -> Vec2<T> where
T: Zero + One, [src]
T: Zero + One,
Get the unit vector which has x set to 1.
pub fn unit_y() -> Vec2<T> where
T: Zero + One, [src]
T: Zero + One,
Get the unit vector which has y set to 1.
pub fn left() -> Vec2<T> where
T: Zero + One + Neg<Output = T>, [src]
T: Zero + One + Neg<Output = T>,
Get the unit vector which has x set to -1.
pub fn right() -> Vec2<T> where
T: Zero + One, [src]
T: Zero + One,
Get the unit vector which has x set to 1.
pub fn up() -> Vec2<T> where
T: Zero + One, [src]
T: Zero + One,
Get the unit vector which has y set to 1.
This is not intended for screen-space coordinates (in which case the Y axis is reversed). When in doubt, just use unit_y() instead.
pub fn down() -> Vec2<T> where
T: Zero + One + Neg<Output = T>, [src]
T: Zero + One + Neg<Output = T>,
Get the unit vector which has y set to -1.
This is not intended for screen-space coordinates (in which case the Y axis is reversed). When in doubt, just use unit_y() instead.
Trait Implementations
impl<T> AbsDiffEq<Vec2<T>> for Vec2<T> where
T: AbsDiffEq<T>,
<T as AbsDiffEq<T>>::Epsilon: Copy, [src]
T: AbsDiffEq<T>,
<T as AbsDiffEq<T>>::Epsilon: Copy,
type Epsilon = <T as AbsDiffEq<T>>::Epsilon
Used for specifying relative comparisons.
pub fn default_epsilon() -> <T as AbsDiffEq<T>>::Epsilon[src]
pub fn abs_diff_eq(
&self,
other: &Vec2<T>,
epsilon: <Vec2<T> as AbsDiffEq<Vec2<T>>>::Epsilon
) -> bool[src]
&self,
other: &Vec2<T>,
epsilon: <Vec2<T> as AbsDiffEq<Vec2<T>>>::Epsilon
) -> bool
pub fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
impl<'a, 'b, T> Add<&'a T> for &'b Vec2<T> where
&'b T: Add<&'a T>,
<&'b T as Add<&'a T>>::Output == T, [src]
&'b T: Add<&'a T>,
<&'b T as Add<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the + operator.
pub fn add(self, rhs: &'a T) -> <&'b Vec2<T> as Add<&'a T>>::Output[src]
impl<'a, T> Add<&'a Vec2<T>> for Vec2<T> where
T: Add<&'a T, Output = T>, [src]
T: Add<&'a T, Output = T>,
type Output = Vec2<T>
The resulting type after applying the + operator.
pub fn add(self, rhs: &'a Vec2<T>) -> <Vec2<T> as Add<&'a Vec2<T>>>::Output[src]
impl<'a, 'b, T> Add<&'a Vec2<T>> for &'b Vec2<T> where
&'b T: Add<&'a T>,
<&'b T as Add<&'a T>>::Output == T, [src]
&'b T: Add<&'a T>,
<&'b T as Add<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the + operator.
pub fn add(self, rhs: &'a Vec2<T>) -> <&'b Vec2<T> as Add<&'a Vec2<T>>>::Output[src]
impl<'a, T> Add<T> for &'a Vec2<T> where
T: Copy,
&'a T: Add<T>,
<&'a T as Add<T>>::Output == T, [src]
T: Copy,
&'a T: Add<T>,
<&'a T as Add<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the + operator.
pub fn add(self, rhs: T) -> <&'a Vec2<T> as Add<T>>::Output[src]
impl<V, T> Add<V> for Vec2<T> where
T: Add<T, Output = T>,
V: Into<Vec2<T>>, [src]
T: Add<T, Output = T>,
V: Into<Vec2<T>>,
type Output = Vec2<T>
The resulting type after applying the + operator.
pub fn add(self, rhs: V) -> <Vec2<T> as Add<V>>::Output[src]
impl<'a, T> Add<Vec2<T>> for &'a Vec2<T> where
&'a T: Add<T>,
<&'a T as Add<T>>::Output == T, [src]
&'a T: Add<T>,
<&'a T as Add<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the + operator.
pub fn add(self, rhs: Vec2<T>) -> <&'a Vec2<T> as Add<Vec2<T>>>::Output[src]
impl<V, T> AddAssign<V> for Vec2<T> where
T: AddAssign<T>,
V: Into<Vec2<T>>, [src]
T: AddAssign<T>,
V: Into<Vec2<T>>,
pub fn add_assign(&mut self, rhs: V)[src]
impl<T> AsMut<[T]> for Vec2<T>[src]
impl<T> AsMut<Vec2<T>> for Vec2<T>[src]
impl<T> AsRef<[T]> for Vec2<T>[src]
impl<T> AsRef<Vec2<T>> for Vec2<T>[src]
impl<'a, 'b, T> BitAnd<&'a T> for &'b Vec2<T> where
&'b T: BitAnd<&'a T>,
<&'b T as BitAnd<&'a T>>::Output == T, [src]
&'b T: BitAnd<&'a T>,
<&'b T as BitAnd<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the & operator.
pub fn bitand(self, rhs: &'a T) -> <&'b Vec2<T> as BitAnd<&'a T>>::Output[src]
impl<'a, T> BitAnd<&'a Vec2<T>> for Vec2<T> where
T: BitAnd<&'a T, Output = T>, [src]
T: BitAnd<&'a T, Output = T>,
type Output = Vec2<T>
The resulting type after applying the & operator.
pub fn bitand(
self,
rhs: &'a Vec2<T>
) -> <Vec2<T> as BitAnd<&'a Vec2<T>>>::Output[src]
self,
rhs: &'a Vec2<T>
) -> <Vec2<T> as BitAnd<&'a Vec2<T>>>::Output
impl<'a, 'b, T> BitAnd<&'a Vec2<T>> for &'b Vec2<T> where
&'b T: BitAnd<&'a T>,
<&'b T as BitAnd<&'a T>>::Output == T, [src]
&'b T: BitAnd<&'a T>,
<&'b T as BitAnd<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the & operator.
pub fn bitand(
self,
rhs: &'a Vec2<T>
) -> <&'b Vec2<T> as BitAnd<&'a Vec2<T>>>::Output[src]
self,
rhs: &'a Vec2<T>
) -> <&'b Vec2<T> as BitAnd<&'a Vec2<T>>>::Output
impl<'a, T> BitAnd<T> for &'a Vec2<T> where
T: Copy,
&'a T: BitAnd<T>,
<&'a T as BitAnd<T>>::Output == T, [src]
T: Copy,
&'a T: BitAnd<T>,
<&'a T as BitAnd<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the & operator.
pub fn bitand(self, rhs: T) -> <&'a Vec2<T> as BitAnd<T>>::Output[src]
impl<V, T> BitAnd<V> for Vec2<T> where
T: BitAnd<T, Output = T>,
V: Into<Vec2<T>>, [src]
T: BitAnd<T, Output = T>,
V: Into<Vec2<T>>,
type Output = Vec2<T>
The resulting type after applying the & operator.
pub fn bitand(self, rhs: V) -> <Vec2<T> as BitAnd<V>>::Output[src]
impl<'a, T> BitAnd<Vec2<T>> for &'a Vec2<T> where
&'a T: BitAnd<T>,
<&'a T as BitAnd<T>>::Output == T, [src]
&'a T: BitAnd<T>,
<&'a T as BitAnd<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the & operator.
pub fn bitand(self, rhs: Vec2<T>) -> <&'a Vec2<T> as BitAnd<Vec2<T>>>::Output[src]
impl<V, T> BitAndAssign<V> for Vec2<T> where
T: BitAndAssign<T>,
V: Into<Vec2<T>>, [src]
T: BitAndAssign<T>,
V: Into<Vec2<T>>,
pub fn bitand_assign(&mut self, rhs: V)[src]
impl<'a, 'b, T> BitOr<&'a T> for &'b Vec2<T> where
&'b T: BitOr<&'a T>,
<&'b T as BitOr<&'a T>>::Output == T, [src]
&'b T: BitOr<&'a T>,
<&'b T as BitOr<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the | operator.
pub fn bitor(self, rhs: &'a T) -> <&'b Vec2<T> as BitOr<&'a T>>::Output[src]
impl<'a, 'b, T> BitOr<&'a Vec2<T>> for &'b Vec2<T> where
&'b T: BitOr<&'a T>,
<&'b T as BitOr<&'a T>>::Output == T, [src]
&'b T: BitOr<&'a T>,
<&'b T as BitOr<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the | operator.
pub fn bitor(
self,
rhs: &'a Vec2<T>
) -> <&'b Vec2<T> as BitOr<&'a Vec2<T>>>::Output[src]
self,
rhs: &'a Vec2<T>
) -> <&'b Vec2<T> as BitOr<&'a Vec2<T>>>::Output
impl<'a, T> BitOr<&'a Vec2<T>> for Vec2<T> where
T: BitOr<&'a T, Output = T>, [src]
T: BitOr<&'a T, Output = T>,
type Output = Vec2<T>
The resulting type after applying the | operator.
pub fn bitor(self, rhs: &'a Vec2<T>) -> <Vec2<T> as BitOr<&'a Vec2<T>>>::Output[src]
impl<'a, T> BitOr<T> for &'a Vec2<T> where
T: Copy,
&'a T: BitOr<T>,
<&'a T as BitOr<T>>::Output == T, [src]
T: Copy,
&'a T: BitOr<T>,
<&'a T as BitOr<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the | operator.
pub fn bitor(self, rhs: T) -> <&'a Vec2<T> as BitOr<T>>::Output[src]
impl<V, T> BitOr<V> for Vec2<T> where
T: BitOr<T, Output = T>,
V: Into<Vec2<T>>, [src]
T: BitOr<T, Output = T>,
V: Into<Vec2<T>>,
type Output = Vec2<T>
The resulting type after applying the | operator.
pub fn bitor(self, rhs: V) -> <Vec2<T> as BitOr<V>>::Output[src]
impl<'a, T> BitOr<Vec2<T>> for &'a Vec2<T> where
&'a T: BitOr<T>,
<&'a T as BitOr<T>>::Output == T, [src]
&'a T: BitOr<T>,
<&'a T as BitOr<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the | operator.
pub fn bitor(self, rhs: Vec2<T>) -> <&'a Vec2<T> as BitOr<Vec2<T>>>::Output[src]
impl<V, T> BitOrAssign<V> for Vec2<T> where
T: BitOrAssign<T>,
V: Into<Vec2<T>>, [src]
T: BitOrAssign<T>,
V: Into<Vec2<T>>,
pub fn bitor_assign(&mut self, rhs: V)[src]
impl<'a, 'b, T> BitXor<&'a T> for &'b Vec2<T> where
&'b T: BitXor<&'a T>,
<&'b T as BitXor<&'a T>>::Output == T, [src]
&'b T: BitXor<&'a T>,
<&'b T as BitXor<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the ^ operator.
pub fn bitxor(self, rhs: &'a T) -> <&'b Vec2<T> as BitXor<&'a T>>::Output[src]
impl<'a, 'b, T> BitXor<&'a Vec2<T>> for &'b Vec2<T> where
&'b T: BitXor<&'a T>,
<&'b T as BitXor<&'a T>>::Output == T, [src]
&'b T: BitXor<&'a T>,
<&'b T as BitXor<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the ^ operator.
pub fn bitxor(
self,
rhs: &'a Vec2<T>
) -> <&'b Vec2<T> as BitXor<&'a Vec2<T>>>::Output[src]
self,
rhs: &'a Vec2<T>
) -> <&'b Vec2<T> as BitXor<&'a Vec2<T>>>::Output
impl<'a, T> BitXor<&'a Vec2<T>> for Vec2<T> where
T: BitXor<&'a T, Output = T>, [src]
T: BitXor<&'a T, Output = T>,
type Output = Vec2<T>
The resulting type after applying the ^ operator.
pub fn bitxor(
self,
rhs: &'a Vec2<T>
) -> <Vec2<T> as BitXor<&'a Vec2<T>>>::Output[src]
self,
rhs: &'a Vec2<T>
) -> <Vec2<T> as BitXor<&'a Vec2<T>>>::Output
impl<'a, T> BitXor<T> for &'a Vec2<T> where
T: Copy,
&'a T: BitXor<T>,
<&'a T as BitXor<T>>::Output == T, [src]
T: Copy,
&'a T: BitXor<T>,
<&'a T as BitXor<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the ^ operator.
pub fn bitxor(self, rhs: T) -> <&'a Vec2<T> as BitXor<T>>::Output[src]
impl<V, T> BitXor<V> for Vec2<T> where
T: BitXor<T, Output = T>,
V: Into<Vec2<T>>, [src]
T: BitXor<T, Output = T>,
V: Into<Vec2<T>>,
type Output = Vec2<T>
The resulting type after applying the ^ operator.
pub fn bitxor(self, rhs: V) -> <Vec2<T> as BitXor<V>>::Output[src]
impl<'a, T> BitXor<Vec2<T>> for &'a Vec2<T> where
&'a T: BitXor<T>,
<&'a T as BitXor<T>>::Output == T, [src]
&'a T: BitXor<T>,
<&'a T as BitXor<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the ^ operator.
pub fn bitxor(self, rhs: Vec2<T>) -> <&'a Vec2<T> as BitXor<Vec2<T>>>::Output[src]
impl<V, T> BitXorAssign<V> for Vec2<T> where
T: BitXorAssign<T>,
V: Into<Vec2<T>>, [src]
T: BitXorAssign<T>,
V: Into<Vec2<T>>,
pub fn bitxor_assign(&mut self, rhs: V)[src]
impl<T> Borrow<[T]> for Vec2<T>[src]
impl<T> BorrowMut<[T]> for Vec2<T>[src]
pub fn borrow_mut(&mut self) -> &mut [T][src]
impl<T> Clamp<T> for Vec2<T> where
T: Clamp<T> + Copy, [src]
T: Clamp<T> + Copy,
pub fn clamped(self, lower: T, upper: T) -> Vec2<T>[src]
pub fn clamp(val: Self, lower: Bound, upper: Bound) -> Self[src]
pub fn clamped01(self) -> Self where
Bound: Zero + One, [src]
Bound: Zero + One,
pub fn clamp01(val: Self) -> Self where
Bound: Zero + One, [src]
Bound: Zero + One,
pub fn clamped_minus1_1(self) -> Self where
Bound: One + Neg<Output = Bound>, [src]
Bound: One + Neg<Output = Bound>,
pub fn clamp_minus1_1(val: Self) -> Self where
Bound: One + Neg<Output = Bound>, [src]
Bound: One + Neg<Output = Bound>,
impl<T> Clamp<Vec2<T>> for Vec2<T> where
T: Clamp<T>, [src]
T: Clamp<T>,
pub fn clamped(self, lower: Vec2<T>, upper: Vec2<T>) -> Vec2<T>[src]
pub fn clamp(val: Self, lower: Bound, upper: Bound) -> Self[src]
pub fn clamped01(self) -> Self where
Bound: Zero + One, [src]
Bound: Zero + One,
pub fn clamp01(val: Self) -> Self where
Bound: Zero + One, [src]
Bound: Zero + One,
pub fn clamped_minus1_1(self) -> Self where
Bound: One + Neg<Output = Bound>, [src]
Bound: One + Neg<Output = Bound>,
pub fn clamp_minus1_1(val: Self) -> Self where
Bound: One + Neg<Output = Bound>, [src]
Bound: One + Neg<Output = Bound>,
impl<T> Clone for Vec2<T> where
T: Clone, [src]
T: Clone,
pub fn clone(&self) -> Vec2<T>[src]
pub fn clone_from(&mut self, source: &Self)1.0.0[src]
impl<T> Copy for Vec2<T> where
T: Copy, [src]
T: Copy,
impl<T> Debug for Vec2<T> where
T: Debug, [src]
T: Debug,
impl<T> Default for Vec2<T> where
T: Default, [src]
T: Default,
impl<T> Deref for Vec2<T>[src]
impl<T> DerefMut for Vec2<T>[src]
impl<T> Display for Vec2<T> where
T: Display, [src]
T: Display,
Displays the vector, formatted as ({...}, {...}) where ... are the actual formatting parameters.
impl<'a, 'b, T> Div<&'a T> for &'b Vec2<T> where
&'b T: Div<&'a T>,
<&'b T as Div<&'a T>>::Output == T, [src]
&'b T: Div<&'a T>,
<&'b T as Div<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the / operator.
pub fn div(self, rhs: &'a T) -> <&'b Vec2<T> as Div<&'a T>>::Output[src]
impl<'a, 'b, T> Div<&'a Vec2<T>> for &'b Vec2<T> where
&'b T: Div<&'a T>,
<&'b T as Div<&'a T>>::Output == T, [src]
&'b T: Div<&'a T>,
<&'b T as Div<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the / operator.
pub fn div(self, rhs: &'a Vec2<T>) -> <&'b Vec2<T> as Div<&'a Vec2<T>>>::Output[src]
impl<'a, T> Div<&'a Vec2<T>> for Vec2<T> where
T: Div<&'a T, Output = T>, [src]
T: Div<&'a T, Output = T>,
type Output = Vec2<T>
The resulting type after applying the / operator.
pub fn div(self, rhs: &'a Vec2<T>) -> <Vec2<T> as Div<&'a Vec2<T>>>::Output[src]
impl<'a, T> Div<T> for &'a Vec2<T> where
T: Copy,
&'a T: Div<T>,
<&'a T as Div<T>>::Output == T, [src]
T: Copy,
&'a T: Div<T>,
<&'a T as Div<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the / operator.
pub fn div(self, rhs: T) -> <&'a Vec2<T> as Div<T>>::Output[src]
impl<V, T> Div<V> for Vec2<T> where
T: Div<T, Output = T>,
V: Into<Vec2<T>>, [src]
T: Div<T, Output = T>,
V: Into<Vec2<T>>,
type Output = Vec2<T>
The resulting type after applying the / operator.
pub fn div(self, rhs: V) -> <Vec2<T> as Div<V>>::Output[src]
impl<'a, T> Div<Vec2<T>> for &'a Vec2<T> where
&'a T: Div<T>,
<&'a T as Div<T>>::Output == T, [src]
&'a T: Div<T>,
<&'a T as Div<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the / operator.
pub fn div(self, rhs: Vec2<T>) -> <&'a Vec2<T> as Div<Vec2<T>>>::Output[src]
impl<V, T> DivAssign<V> for Vec2<T> where
T: DivAssign<T>,
V: Into<Vec2<T>>, [src]
T: DivAssign<T>,
V: Into<Vec2<T>>,
pub fn div_assign(&mut self, rhs: V)[src]
impl<T> Eq for Vec2<T> where
T: Eq, [src]
T: Eq,
impl<T> From<[T; 2]> for Vec2<T>[src]
impl<T> From<(T, T)> for Vec2<T>[src]
impl<T> From<Extent2<T>> for Vec2<T>[src]
impl<T> From<T> for Vec2<T> where
T: Copy, [src]
T: Copy,
A vector can be obtained from a single scalar by broadcasting it.
This conversion is important because it allows scalars to be smoothly accepted as operands in most vector operations.
For instance :
assert_eq!(Vec4::min(4, 5), Vec4::broadcast(4)); assert_eq!(Vec4::max(4, 5), Vec4::broadcast(5)); assert_eq!(Vec4::from(4), Vec4::broadcast(4)); assert_eq!(Vec4::from(4).mul_add(4, 5), Vec4::broadcast(21)); // scaling_3d() logically accepts a Vec3... let _ = Mat4::<f32>::scaling_3d(Vec3::broadcast(5.0)); // ... but there you go; quick uniform scale, thanks to Into ! let _ = Mat4::scaling_3d(5_f32);
On the other hand, it also allows writing nonsense. To minimize surprises, the names of operations try to be as explicit as possible.
// This creates a matrix that translates to (5,5,5), but it's probably not what you meant. // Hopefully the `_3d` suffix would help you catch this. let _ = Mat4::translation_3d(5_f32); // translation_3d() takes V: Into<Vec3> because it allows it to accept // Vec2, Vec3 and Vec4, and also with both repr(C) and repr(simd) layouts.
impl<T> From<Vec3<T>> for Vec2<T>[src]
impl<T> From<Vec4<T>> for Vec2<T>[src]
impl<T> FromIterator<T> for Vec2<T> where
T: Default, [src]
T: Default,
pub fn from_iter<I>(iter: I) -> Vec2<T> where
I: IntoIterator<Item = T>, [src]
I: IntoIterator<Item = T>,
impl<T> Hash for Vec2<T> where
T: Hash, [src]
T: Hash,
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher, [src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl<'a, T> IntoIterator for &'a Vec2<T>[src]
type Item = &'a T
The type of the elements being iterated over.
type IntoIter = Iter<'a, T>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> <&'a Vec2<T> as IntoIterator>::IntoIter[src]
impl<'a, T> IntoIterator for &'a mut Vec2<T>[src]
type Item = &'a mut T
The type of the elements being iterated over.
type IntoIter = IterMut<'a, T>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> <&'a mut Vec2<T> as IntoIterator>::IntoIter[src]
impl<T> IntoIterator for Vec2<T>[src]
type Item = T
The type of the elements being iterated over.
type IntoIter = IntoIter<T>
Which kind of iterator are we turning this into?
pub fn into_iter(self) -> <Vec2<T> as IntoIterator>::IntoIter[src]
impl<T> IsBetween<T> for Vec2<T> where
T: IsBetween<T, Output = bool> + Copy, [src]
T: IsBetween<T, Output = bool> + Copy,
type Output = Vec2<bool>
bool for scalars, or vector of bools for vectors.
pub fn is_between(self, lower: T, upper: T) -> <Vec2<T> as IsBetween<T>>::Output[src]
pub fn is_between01(self) -> Self::Output where
Bound: Zero + One, [src]
Bound: Zero + One,
impl<T> IsBetween<Vec2<T>> for Vec2<T> where
T: IsBetween<T, Output = bool>, [src]
T: IsBetween<T, Output = bool>,
type Output = Vec2<bool>
bool for scalars, or vector of bools for vectors.
pub fn is_between(
self,
lower: Vec2<T>,
upper: Vec2<T>
) -> <Vec2<T> as IsBetween<Vec2<T>>>::Output[src]
self,
lower: Vec2<T>,
upper: Vec2<T>
) -> <Vec2<T> as IsBetween<Vec2<T>>>::Output
pub fn is_between01(self) -> Self::Output where
Bound: Zero + One, [src]
Bound: Zero + One,
impl<T, Factor> Lerp<Factor> for Vec2<T> where
T: Lerp<Factor, Output = T>,
Factor: Copy, [src]
T: Lerp<Factor, Output = T>,
Factor: Copy,
type Output = Vec2<T>
The resulting type after performing the LERP operation.
pub fn lerp_unclamped_precise(
from: Vec2<T>,
to: Vec2<T>,
factor: Factor
) -> Vec2<T>[src]
from: Vec2<T>,
to: Vec2<T>,
factor: Factor
) -> Vec2<T>
pub fn lerp_unclamped(from: Vec2<T>, to: Vec2<T>, factor: Factor) -> Vec2<T>[src]
pub fn lerp(from: Self, to: Self, factor: Factor) -> Self::Output where
Factor: Clamp<Factor> + Zero + One, [src]
Factor: Clamp<Factor> + Zero + One,
pub fn lerp_precise(from: Self, to: Self, factor: Factor) -> Self::Output where
Factor: Clamp<Factor> + Zero + One, [src]
Factor: Clamp<Factor> + Zero + One,
impl<'a, T, Factor> Lerp<Factor> for &'a Vec2<T> where
Factor: Copy,
&'a T: Lerp<Factor>,
<&'a T as Lerp<Factor>>::Output == T, [src]
Factor: Copy,
&'a T: Lerp<Factor>,
<&'a T as Lerp<Factor>>::Output == T,
type Output = Vec2<T>
The resulting type after performing the LERP operation.
pub fn lerp_unclamped_precise(
from: &'a Vec2<T>,
to: &'a Vec2<T>,
factor: Factor
) -> Vec2<T>[src]
from: &'a Vec2<T>,
to: &'a Vec2<T>,
factor: Factor
) -> Vec2<T>
pub fn lerp_unclamped(
from: &'a Vec2<T>,
to: &'a Vec2<T>,
factor: Factor
) -> Vec2<T>[src]
from: &'a Vec2<T>,
to: &'a Vec2<T>,
factor: Factor
) -> Vec2<T>
pub fn lerp(from: Self, to: Self, factor: Factor) -> Self::Output where
Factor: Clamp<Factor> + Zero + One, [src]
Factor: Clamp<Factor> + Zero + One,
pub fn lerp_precise(from: Self, to: Self, factor: Factor) -> Self::Output where
Factor: Clamp<Factor> + Zero + One, [src]
Factor: Clamp<Factor> + Zero + One,
impl<'a, 'b, T> Mul<&'a T> for &'b Vec2<T> where
&'b T: Mul<&'a T>,
<&'b T as Mul<&'a T>>::Output == T, [src]
&'b T: Mul<&'a T>,
<&'b T as Mul<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the * operator.
pub fn mul(self, rhs: &'a T) -> <&'b Vec2<T> as Mul<&'a T>>::Output[src]
impl<'a, 'b, T> Mul<&'a Vec2<T>> for &'b Vec2<T> where
&'b T: Mul<&'a T>,
<&'b T as Mul<&'a T>>::Output == T, [src]
&'b T: Mul<&'a T>,
<&'b T as Mul<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the * operator.
pub fn mul(self, rhs: &'a Vec2<T>) -> <&'b Vec2<T> as Mul<&'a Vec2<T>>>::Output[src]
impl<'a, T> Mul<&'a Vec2<T>> for Vec2<T> where
T: Mul<&'a T, Output = T>, [src]
T: Mul<&'a T, Output = T>,
type Output = Vec2<T>
The resulting type after applying the * operator.
pub fn mul(self, rhs: &'a Vec2<T>) -> <Vec2<T> as Mul<&'a Vec2<T>>>::Output[src]
impl<T> Mul<Mat2<T>> for Vec2<T> where
T: Copy + Mul<T, Output = T> + MulAdd<T, T, Output = T>, [src]
T: Copy + Mul<T, Output = T> + MulAdd<T, T, Output = T>,
Multiplies a row vector with a row-major matrix, giving a row vector.
With SIMD vectors, this is the most efficient way.
use vek::mat::row_major::Mat4; use vek::vec::Vec4; let m = Mat4::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 ); let v = Vec4::new(0, 1, 2, 3); let r = Vec4::new(26, 32, 18, 24); assert_eq!(v * m, r);
type Output = Vec2<T>
The resulting type after applying the * operator.
pub fn mul(self, rhs: Mat2<T>) -> <Vec2<T> as Mul<Mat2<T>>>::Output[src]
impl<T> Mul<Mat2<T>> for Vec2<T> where
T: Copy + Mul<T, Output = T> + MulAdd<T, T, Output = T>, [src]
T: Copy + Mul<T, Output = T> + MulAdd<T, T, Output = T>,
Multiplies a row vector with a column-major matrix, giving a row vector.
use vek::mat::column_major::Mat4; use vek::vec::Vec4; let m = Mat4::new( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 ); let v = Vec4::new(0, 1, 2, 3); let r = Vec4::new(26, 32, 18, 24); assert_eq!(v * m, r);
type Output = Vec2<T>
The resulting type after applying the * operator.
pub fn mul(self, rhs: Mat2<T>) -> <Vec2<T> as Mul<Mat2<T>>>::Output[src]
impl<'a, T> Mul<T> for &'a Vec2<T> where
T: Copy,
&'a T: Mul<T>,
<&'a T as Mul<T>>::Output == T, [src]
T: Copy,
&'a T: Mul<T>,
<&'a T as Mul<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the * operator.
pub fn mul(self, rhs: T) -> <&'a Vec2<T> as Mul<T>>::Output[src]
impl<V, T> Mul<V> for Vec2<T> where
T: Mul<T, Output = T>,
V: Into<Vec2<T>>, [src]
T: Mul<T, Output = T>,
V: Into<Vec2<T>>,
type Output = Vec2<T>
The resulting type after applying the * operator.
pub fn mul(self, rhs: V) -> <Vec2<T> as Mul<V>>::Output[src]
impl<'a, T> Mul<Vec2<T>> for &'a Vec2<T> where
&'a T: Mul<T>,
<&'a T as Mul<T>>::Output == T, [src]
&'a T: Mul<T>,
<&'a T as Mul<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the * operator.
pub fn mul(self, rhs: Vec2<T>) -> <&'a Vec2<T> as Mul<Vec2<T>>>::Output[src]
impl<'a, 'b, 'c, T> MulAdd<&'a Vec2<T>, &'b Vec2<T>> for &'c Vec2<T> where
&'c T: MulAdd<&'a T, &'b T>,
<&'c T as MulAdd<&'a T, &'b T>>::Output == T, [src]
&'c T: MulAdd<&'a T, &'b T>,
<&'c T as MulAdd<&'a T, &'b T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the fused multiply-add operation.
pub fn mul_add(
self,
a: &'a Vec2<T>,
b: &'b Vec2<T>
) -> <&'c Vec2<T> as MulAdd<&'a Vec2<T>, &'b Vec2<T>>>::Output[src]
self,
a: &'a Vec2<T>,
b: &'b Vec2<T>
) -> <&'c Vec2<T> as MulAdd<&'a Vec2<T>, &'b Vec2<T>>>::Output
impl<'a, 'b, T> MulAdd<&'a Vec2<T>, &'b Vec2<T>> for Vec2<T> where
T: MulAdd<&'a T, &'b T, Output = T>, [src]
T: MulAdd<&'a T, &'b T, Output = T>,
type Output = Vec2<T>
The resulting type after applying the fused multiply-add operation.
pub fn mul_add(
self,
a: &'a Vec2<T>,
b: &'b Vec2<T>
) -> <Vec2<T> as MulAdd<&'a Vec2<T>, &'b Vec2<T>>>::Output[src]
self,
a: &'a Vec2<T>,
b: &'b Vec2<T>
) -> <Vec2<T> as MulAdd<&'a Vec2<T>, &'b Vec2<T>>>::Output
impl<'a, 'c, T> MulAdd<&'a Vec2<T>, Vec2<T>> for &'c Vec2<T> where
&'c T: MulAdd<&'a T, T>,
<&'c T as MulAdd<&'a T, T>>::Output == T, [src]
&'c T: MulAdd<&'a T, T>,
<&'c T as MulAdd<&'a T, T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the fused multiply-add operation.
pub fn mul_add(
self,
a: &'a Vec2<T>,
b: Vec2<T>
) -> <&'c Vec2<T> as MulAdd<&'a Vec2<T>, Vec2<T>>>::Output[src]
self,
a: &'a Vec2<T>,
b: Vec2<T>
) -> <&'c Vec2<T> as MulAdd<&'a Vec2<T>, Vec2<T>>>::Output
impl<'a, T> MulAdd<&'a Vec2<T>, Vec2<T>> for Vec2<T> where
T: MulAdd<&'a T, T, Output = T>, [src]
T: MulAdd<&'a T, T, Output = T>,
type Output = Vec2<T>
The resulting type after applying the fused multiply-add operation.
pub fn mul_add(
self,
a: &'a Vec2<T>,
b: Vec2<T>
) -> <Vec2<T> as MulAdd<&'a Vec2<T>, Vec2<T>>>::Output[src]
self,
a: &'a Vec2<T>,
b: Vec2<T>
) -> <Vec2<T> as MulAdd<&'a Vec2<T>, Vec2<T>>>::Output
impl<'b, 'c, T> MulAdd<Vec2<T>, &'b Vec2<T>> for &'c Vec2<T> where
&'c T: MulAdd<T, &'b T>,
<&'c T as MulAdd<T, &'b T>>::Output == T, [src]
&'c T: MulAdd<T, &'b T>,
<&'c T as MulAdd<T, &'b T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the fused multiply-add operation.
pub fn mul_add(
self,
a: Vec2<T>,
b: &'b Vec2<T>
) -> <&'c Vec2<T> as MulAdd<Vec2<T>, &'b Vec2<T>>>::Output[src]
self,
a: Vec2<T>,
b: &'b Vec2<T>
) -> <&'c Vec2<T> as MulAdd<Vec2<T>, &'b Vec2<T>>>::Output
impl<'b, T> MulAdd<Vec2<T>, &'b Vec2<T>> for Vec2<T> where
T: MulAdd<T, &'b T, Output = T>, [src]
T: MulAdd<T, &'b T, Output = T>,
type Output = Vec2<T>
The resulting type after applying the fused multiply-add operation.
pub fn mul_add(
self,
a: Vec2<T>,
b: &'b Vec2<T>
) -> <Vec2<T> as MulAdd<Vec2<T>, &'b Vec2<T>>>::Output[src]
self,
a: Vec2<T>,
b: &'b Vec2<T>
) -> <Vec2<T> as MulAdd<Vec2<T>, &'b Vec2<T>>>::Output
impl<'c, T> MulAdd<Vec2<T>, Vec2<T>> for &'c Vec2<T> where
&'c T: MulAdd<T, T>,
<&'c T as MulAdd<T, T>>::Output == T, [src]
&'c T: MulAdd<T, T>,
<&'c T as MulAdd<T, T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the fused multiply-add operation.
pub fn mul_add(
self,
a: Vec2<T>,
b: Vec2<T>
) -> <&'c Vec2<T> as MulAdd<Vec2<T>, Vec2<T>>>::Output[src]
self,
a: Vec2<T>,
b: Vec2<T>
) -> <&'c Vec2<T> as MulAdd<Vec2<T>, Vec2<T>>>::Output
impl<T> MulAdd<Vec2<T>, Vec2<T>> for Vec2<T> where
T: MulAdd<T, T, Output = T>, [src]
T: MulAdd<T, T, Output = T>,
type Output = Vec2<T>
The resulting type after applying the fused multiply-add operation.
pub fn mul_add(
self,
a: Vec2<T>,
b: Vec2<T>
) -> <Vec2<T> as MulAdd<Vec2<T>, Vec2<T>>>::Output[src]
self,
a: Vec2<T>,
b: Vec2<T>
) -> <Vec2<T> as MulAdd<Vec2<T>, Vec2<T>>>::Output
impl<V, T> MulAssign<V> for Vec2<T> where
T: MulAssign<T>,
V: Into<Vec2<T>>, [src]
T: MulAssign<T>,
V: Into<Vec2<T>>,
pub fn mul_assign(&mut self, rhs: V)[src]
impl<T> Neg for Vec2<T> where
T: Neg<Output = T>, [src]
T: Neg<Output = T>,
type Output = Vec2<T>
The resulting type after applying the - operator.
pub fn neg(self) -> <Vec2<T> as Neg>::Output[src]
impl<T> Not for Vec2<T> where
T: Not<Output = T>, [src]
T: Not<Output = T>,
type Output = Vec2<T>
The resulting type after applying the ! operator.
pub fn not(self) -> <Vec2<T> as Not>::Output[src]
impl<T> One for Vec2<T> where
T: One, [src]
T: One,
pub fn one() -> Vec2<T>[src]
pub fn set_one(&mut self)[src]
pub fn is_one(&self) -> bool where
Self: PartialEq<Self>, [src]
Self: PartialEq<Self>,
impl<T> PartialEq<Vec2<T>> for Vec2<T> where
T: PartialEq<T>, [src]
T: PartialEq<T>,
impl<T> Product<Vec2<T>> for Vec2<T> where
T: Mul<T, Output = T> + One, [src]
T: Mul<T, Output = T> + One,
impl<T> RelativeEq<Vec2<T>> for Vec2<T> where
T: RelativeEq<T>,
<T as AbsDiffEq<T>>::Epsilon: Copy, [src]
T: RelativeEq<T>,
<T as AbsDiffEq<T>>::Epsilon: Copy,
pub fn default_max_relative() -> <T as AbsDiffEq<T>>::Epsilon[src]
pub fn relative_eq(
&self,
other: &Vec2<T>,
epsilon: <T as AbsDiffEq<T>>::Epsilon,
max_relative: <T as AbsDiffEq<T>>::Epsilon
) -> bool[src]
&self,
other: &Vec2<T>,
epsilon: <T as AbsDiffEq<T>>::Epsilon,
max_relative: <T as AbsDiffEq<T>>::Epsilon
) -> bool
pub fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
impl<'a, 'b, T> Rem<&'a T> for &'b Vec2<T> where
&'b T: Rem<&'a T>,
<&'b T as Rem<&'a T>>::Output == T, [src]
&'b T: Rem<&'a T>,
<&'b T as Rem<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the % operator.
pub fn rem(self, rhs: &'a T) -> <&'b Vec2<T> as Rem<&'a T>>::Output[src]
impl<'a, 'b, T> Rem<&'a Vec2<T>> for &'b Vec2<T> where
&'b T: Rem<&'a T>,
<&'b T as Rem<&'a T>>::Output == T, [src]
&'b T: Rem<&'a T>,
<&'b T as Rem<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the % operator.
pub fn rem(self, rhs: &'a Vec2<T>) -> <&'b Vec2<T> as Rem<&'a Vec2<T>>>::Output[src]
impl<'a, T> Rem<&'a Vec2<T>> for Vec2<T> where
T: Rem<&'a T, Output = T>, [src]
T: Rem<&'a T, Output = T>,
type Output = Vec2<T>
The resulting type after applying the % operator.
pub fn rem(self, rhs: &'a Vec2<T>) -> <Vec2<T> as Rem<&'a Vec2<T>>>::Output[src]
impl<'a, T> Rem<T> for &'a Vec2<T> where
T: Copy,
&'a T: Rem<T>,
<&'a T as Rem<T>>::Output == T, [src]
T: Copy,
&'a T: Rem<T>,
<&'a T as Rem<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the % operator.
pub fn rem(self, rhs: T) -> <&'a Vec2<T> as Rem<T>>::Output[src]
impl<V, T> Rem<V> for Vec2<T> where
T: Rem<T, Output = T>,
V: Into<Vec2<T>>, [src]
T: Rem<T, Output = T>,
V: Into<Vec2<T>>,
type Output = Vec2<T>
The resulting type after applying the % operator.
pub fn rem(self, rhs: V) -> <Vec2<T> as Rem<V>>::Output[src]
impl<'a, T> Rem<Vec2<T>> for &'a Vec2<T> where
&'a T: Rem<T>,
<&'a T as Rem<T>>::Output == T, [src]
&'a T: Rem<T>,
<&'a T as Rem<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the % operator.
pub fn rem(self, rhs: Vec2<T>) -> <&'a Vec2<T> as Rem<Vec2<T>>>::Output[src]
impl<V, T> RemAssign<V> for Vec2<T> where
T: RemAssign<T>,
V: Into<Vec2<T>>, [src]
T: RemAssign<T>,
V: Into<Vec2<T>>,
pub fn rem_assign(&mut self, rhs: V)[src]
impl<'a, 'b, T> Shl<&'a T> for &'b Vec2<T> where
&'b T: Shl<&'a T>,
<&'b T as Shl<&'a T>>::Output == T, [src]
&'b T: Shl<&'a T>,
<&'b T as Shl<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the << operator.
pub fn shl(self, rhs: &'a T) -> <&'b Vec2<T> as Shl<&'a T>>::Output[src]
impl<'a, 'b, T> Shl<&'a Vec2<T>> for &'b Vec2<T> where
&'b T: Shl<&'a T>,
<&'b T as Shl<&'a T>>::Output == T, [src]
&'b T: Shl<&'a T>,
<&'b T as Shl<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the << operator.
pub fn shl(self, rhs: &'a Vec2<T>) -> <&'b Vec2<T> as Shl<&'a Vec2<T>>>::Output[src]
impl<'a, T> Shl<&'a Vec2<T>> for Vec2<T> where
T: Shl<&'a T, Output = T>, [src]
T: Shl<&'a T, Output = T>,
type Output = Vec2<T>
The resulting type after applying the << operator.
pub fn shl(self, rhs: &'a Vec2<T>) -> <Vec2<T> as Shl<&'a Vec2<T>>>::Output[src]
impl<'a, T> Shl<T> for &'a Vec2<T> where
T: Copy,
&'a T: Shl<T>,
<&'a T as Shl<T>>::Output == T, [src]
T: Copy,
&'a T: Shl<T>,
<&'a T as Shl<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the << operator.
pub fn shl(self, rhs: T) -> <&'a Vec2<T> as Shl<T>>::Output[src]
impl<V, T> Shl<V> for Vec2<T> where
T: Shl<T, Output = T>,
V: Into<Vec2<T>>, [src]
T: Shl<T, Output = T>,
V: Into<Vec2<T>>,
type Output = Vec2<T>
The resulting type after applying the << operator.
pub fn shl(self, rhs: V) -> <Vec2<T> as Shl<V>>::Output[src]
impl<'a, T> Shl<Vec2<T>> for &'a Vec2<T> where
&'a T: Shl<T>,
<&'a T as Shl<T>>::Output == T, [src]
&'a T: Shl<T>,
<&'a T as Shl<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the << operator.
pub fn shl(self, rhs: Vec2<T>) -> <&'a Vec2<T> as Shl<Vec2<T>>>::Output[src]
impl<V, T> ShlAssign<V> for Vec2<T> where
T: ShlAssign<T>,
V: Into<Vec2<T>>, [src]
T: ShlAssign<T>,
V: Into<Vec2<T>>,
pub fn shl_assign(&mut self, rhs: V)[src]
impl<'a, 'b, T> Shr<&'a T> for &'b Vec2<T> where
&'b T: Shr<&'a T>,
<&'b T as Shr<&'a T>>::Output == T, [src]
&'b T: Shr<&'a T>,
<&'b T as Shr<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the >> operator.
pub fn shr(self, rhs: &'a T) -> <&'b Vec2<T> as Shr<&'a T>>::Output[src]
impl<'a, T> Shr<&'a Vec2<T>> for Vec2<T> where
T: Shr<&'a T, Output = T>, [src]
T: Shr<&'a T, Output = T>,
type Output = Vec2<T>
The resulting type after applying the >> operator.
pub fn shr(self, rhs: &'a Vec2<T>) -> <Vec2<T> as Shr<&'a Vec2<T>>>::Output[src]
impl<'a, 'b, T> Shr<&'a Vec2<T>> for &'b Vec2<T> where
&'b T: Shr<&'a T>,
<&'b T as Shr<&'a T>>::Output == T, [src]
&'b T: Shr<&'a T>,
<&'b T as Shr<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the >> operator.
pub fn shr(self, rhs: &'a Vec2<T>) -> <&'b Vec2<T> as Shr<&'a Vec2<T>>>::Output[src]
impl<'a, T> Shr<T> for &'a Vec2<T> where
T: Copy,
&'a T: Shr<T>,
<&'a T as Shr<T>>::Output == T, [src]
T: Copy,
&'a T: Shr<T>,
<&'a T as Shr<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the >> operator.
pub fn shr(self, rhs: T) -> <&'a Vec2<T> as Shr<T>>::Output[src]
impl<V, T> Shr<V> for Vec2<T> where
T: Shr<T, Output = T>,
V: Into<Vec2<T>>, [src]
T: Shr<T, Output = T>,
V: Into<Vec2<T>>,
type Output = Vec2<T>
The resulting type after applying the >> operator.
pub fn shr(self, rhs: V) -> <Vec2<T> as Shr<V>>::Output[src]
impl<'a, T> Shr<Vec2<T>> for &'a Vec2<T> where
&'a T: Shr<T>,
<&'a T as Shr<T>>::Output == T, [src]
&'a T: Shr<T>,
<&'a T as Shr<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the >> operator.
pub fn shr(self, rhs: Vec2<T>) -> <&'a Vec2<T> as Shr<Vec2<T>>>::Output[src]
impl<V, T> ShrAssign<V> for Vec2<T> where
T: ShrAssign<T>,
V: Into<Vec2<T>>, [src]
T: ShrAssign<T>,
V: Into<Vec2<T>>,
pub fn shr_assign(&mut self, rhs: V)[src]
impl<T> StructuralEq for Vec2<T>[src]
impl<T> StructuralPartialEq for Vec2<T>[src]
impl<'a, 'b, T> Sub<&'a T> for &'b Vec2<T> where
&'b T: Sub<&'a T>,
<&'b T as Sub<&'a T>>::Output == T, [src]
&'b T: Sub<&'a T>,
<&'b T as Sub<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the - operator.
pub fn sub(self, rhs: &'a T) -> <&'b Vec2<T> as Sub<&'a T>>::Output[src]
impl<'a, T> Sub<&'a Vec2<T>> for Vec2<T> where
T: Sub<&'a T, Output = T>, [src]
T: Sub<&'a T, Output = T>,
type Output = Vec2<T>
The resulting type after applying the - operator.
pub fn sub(self, rhs: &'a Vec2<T>) -> <Vec2<T> as Sub<&'a Vec2<T>>>::Output[src]
impl<'a, 'b, T> Sub<&'a Vec2<T>> for &'b Vec2<T> where
&'b T: Sub<&'a T>,
<&'b T as Sub<&'a T>>::Output == T, [src]
&'b T: Sub<&'a T>,
<&'b T as Sub<&'a T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the - operator.
pub fn sub(self, rhs: &'a Vec2<T>) -> <&'b Vec2<T> as Sub<&'a Vec2<T>>>::Output[src]
impl<'a, T> Sub<T> for &'a Vec2<T> where
T: Copy,
&'a T: Sub<T>,
<&'a T as Sub<T>>::Output == T, [src]
T: Copy,
&'a T: Sub<T>,
<&'a T as Sub<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the - operator.
pub fn sub(self, rhs: T) -> <&'a Vec2<T> as Sub<T>>::Output[src]
impl<V, T> Sub<V> for Vec2<T> where
T: Sub<T, Output = T>,
V: Into<Vec2<T>>, [src]
T: Sub<T, Output = T>,
V: Into<Vec2<T>>,
type Output = Vec2<T>
The resulting type after applying the - operator.
pub fn sub(self, rhs: V) -> <Vec2<T> as Sub<V>>::Output[src]
impl<'a, T> Sub<Vec2<T>> for &'a Vec2<T> where
&'a T: Sub<T>,
<&'a T as Sub<T>>::Output == T, [src]
&'a T: Sub<T>,
<&'a T as Sub<T>>::Output == T,
type Output = Vec2<T>
The resulting type after applying the - operator.
pub fn sub(self, rhs: Vec2<T>) -> <&'a Vec2<T> as Sub<Vec2<T>>>::Output[src]
impl<V, T> SubAssign<V> for Vec2<T> where
T: SubAssign<T>,
V: Into<Vec2<T>>, [src]
T: SubAssign<T>,
V: Into<Vec2<T>>,
pub fn sub_assign(&mut self, rhs: V)[src]
impl<T> Sum<Vec2<T>> for Vec2<T> where
T: Add<T, Output = T> + Zero, [src]
T: Add<T, Output = T> + Zero,
impl<T> UlpsEq<Vec2<T>> for Vec2<T> where
T: UlpsEq<T>,
<T as AbsDiffEq<T>>::Epsilon: Copy, [src]
T: UlpsEq<T>,
<T as AbsDiffEq<T>>::Epsilon: Copy,
pub fn default_max_ulps() -> u32[src]
pub fn ulps_eq(
&self,
other: &Vec2<T>,
epsilon: <T as AbsDiffEq<T>>::Epsilon,
max_ulps: u32
) -> bool[src]
&self,
other: &Vec2<T>,
epsilon: <T as AbsDiffEq<T>>::Epsilon,
max_ulps: u32
) -> bool
pub fn ulps_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_ulps: u32
) -> bool
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_ulps: u32
) -> bool
impl<T> Wrap<T> for Vec2<T> where
T: Wrap<T> + Copy, [src]
T: Wrap<T> + Copy,
pub fn wrapped(self, upper: T) -> Vec2<T>[src]
pub fn wrapped_between(self, lower: T, upper: T) -> Vec2<T>[src]
pub fn pingpong(self, upper: T) -> Vec2<T>[src]
pub fn wrap(val: Self, upper: Bound) -> Self[src]
pub fn wrapped_2pi(self) -> Self where
Bound: FloatConst + Add<Bound, Output = Bound>, [src]
Bound: FloatConst + Add<Bound, Output = Bound>,
pub fn wrap_2pi(val: Self) -> Self where
Bound: FloatConst + Add<Bound, Output = Bound>, [src]
Bound: FloatConst + Add<Bound, Output = Bound>,
pub fn wrap_between(val: Self, lower: Bound, upper: Bound) -> Self where
Self: Sub<Self, Output = Self> + Add<Self, Output = Self> + From<Bound>,
Bound: Copy + Sub<Bound, Output = Bound> + PartialOrd<Bound>, [src]
Self: Sub<Self, Output = Self> + Add<Self, Output = Self> + From<Bound>,
Bound: Copy + Sub<Bound, Output = Bound> + PartialOrd<Bound>,
pub fn delta_angle(self, target: Self) -> Self where
Self: From<Bound> + Sub<Self, Output = Self> + PartialOrd<Self>,
Bound: FloatConst + Add<Bound, Output = Bound>, [src]
Self: From<Bound> + Sub<Self, Output = Self> + PartialOrd<Self>,
Bound: FloatConst + Add<Bound, Output = Bound>,
pub fn delta_angle_degrees(self, target: Self) -> Self where
Self: From<Bound> + Sub<Self, Output = Self> + PartialOrd<Self>,
Bound: From<u16>, [src]
Self: From<Bound> + Sub<Self, Output = Self> + PartialOrd<Self>,
Bound: From<u16>,
impl<T> Wrap<Vec2<T>> for Vec2<T> where
T: Wrap<T>, [src]
T: Wrap<T>,
pub fn wrapped(self, upper: Vec2<T>) -> Vec2<T>[src]
pub fn wrapped_between(self, lower: Vec2<T>, upper: Vec2<T>) -> Vec2<T>[src]
pub fn pingpong(self, upper: Vec2<T>) -> Vec2<T>[src]
pub fn wrap(val: Self, upper: Bound) -> Self[src]
pub fn wrapped_2pi(self) -> Self where
Bound: FloatConst + Add<Bound, Output = Bound>, [src]
Bound: FloatConst + Add<Bound, Output = Bound>,
pub fn wrap_2pi(val: Self) -> Self where
Bound: FloatConst + Add<Bound, Output = Bound>, [src]
Bound: FloatConst + Add<Bound, Output = Bound>,
pub fn wrap_between(val: Self, lower: Bound, upper: Bound) -> Self where
Self: Sub<Self, Output = Self> + Add<Self, Output = Self> + From<Bound>,
Bound: Copy + Sub<Bound, Output = Bound> + PartialOrd<Bound>, [src]
Self: Sub<Self, Output = Self> + Add<Self, Output = Self> + From<Bound>,
Bound: Copy + Sub<Bound, Output = Bound> + PartialOrd<Bound>,
pub fn delta_angle(self, target: Self) -> Self where
Self: From<Bound> + Sub<Self, Output = Self> + PartialOrd<Self>,
Bound: FloatConst + Add<Bound, Output = Bound>, [src]
Self: From<Bound> + Sub<Self, Output = Self> + PartialOrd<Self>,
Bound: FloatConst + Add<Bound, Output = Bound>,
pub fn delta_angle_degrees(self, target: Self) -> Self where
Self: From<Bound> + Sub<Self, Output = Self> + PartialOrd<Self>,
Bound: From<u16>, [src]
Self: From<Bound> + Sub<Self, Output = Self> + PartialOrd<Self>,
Bound: From<u16>,
impl<T> Zero for Vec2<T> where
T: PartialEq<T> + Zero, [src]
T: PartialEq<T> + Zero,
Auto Trait Implementations
impl<T> Send for Vec2<T> where
T: Send, [src]
T: Send,
impl<T> Sync for Vec2<T> where
T: Sync, [src]
T: Sync,
impl<T> Unpin for Vec2<T> where
T: Unpin, [src]
T: Unpin,
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> Clamp01 for T where
T: Clamp<T> + Zero + One, [src]
T: Clamp<T> + Zero + One,
impl<T> ClampMinus1 for T where
T: Clamp<T> + Neg<Output = T> + One, [src]
T: Clamp<T> + Neg<Output = T> + One,
impl<T> From<!> for 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> IsBetween01 for T where
T: IsBetween<T> + Zero + One, [src]
T: IsBetween<T> + Zero + One,
impl<T, Rhs> NumAssignOps<Rhs> for T where
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>, [src]
T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,
impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>, [src]
T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,
impl<T, Base> RefNum<Base> for T where
T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>, [src]
T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,
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>,