Struct exr::math::Vec2 [−][src]
Simple two-dimensional vector of any numerical type. Supports only few mathematical operations as this is used mainly as data struct.
Implementations
impl<T> Vec2<T>
[src]
pub fn max(self, other: Self) -> Self where
T: Ord,
[src]
T: Ord,
Returns the vector with the maximum of either coordinates.
pub fn min(self, other: Self) -> Self where
T: Ord,
[src]
T: Ord,
Returns the vector with the minimum of either coordinates.
pub fn try_from<S>(value: Vec2<S>) -> Result<Self, T::Error> where
T: TryFrom<S>,
[src]
T: TryFrom<S>,
Try to convert all components of this vector to a new type, yielding either a vector of that new type, or an error.
pub fn area(self) -> T where
T: Mul<T, Output = T>,
[src]
T: Mul<T, Output = T>,
Seeing this vector as a dimension or size (width and height),
this returns the area that this dimensions contains (width * height
).
pub fn x(self) -> T
[src]
The first component of this 2D vector.
pub fn y(self) -> T
[src]
The second component of this 2D vector.
pub fn width(self) -> T
[src]
The first component of this 2D vector.
pub fn height(self) -> T
[src]
The second component of this 2D vector.
pub fn flat_index_for_size(self, resolution: Vec2<T>) -> T where
T: Copy + Debug + Ord + Mul<Output = T> + Add<Output = T>,
[src]
T: Copy + Debug + Ord + Mul<Output = T> + Add<Output = T>,
Convert this two-dimensional coordinate to an index suited for one-dimensional flattened image arrays. Works for images that store the pixels row by row, one after another, in a single array. In debug mode, panics for an index out of bounds.
impl Vec2<i32>
[src]
pub fn to_usize(self, error_message: &'static str) -> Result<Vec2<usize>>
[src]
Try to convert to Vec2<usize>
, returning an error on negative numbers.
impl Vec2<usize>
[src]
Trait Implementations
impl<T: Add<T>> Add<Vec2<T>> for Vec2<T>
[src]
type Output = Vec2<T::Output>
The resulting type after applying the +
operator.
fn add(self, other: Vec2<T>) -> Self::Output
[src]
impl<T: Clone> Clone for Vec2<T>
[src]
impl<T: Copy> Copy for Vec2<T>
[src]
impl<T: Debug> Debug for Vec2<T>
[src]
impl<T: Default> Default for Vec2<T>
[src]
impl<T: Div<T>> Div<Vec2<T>> for Vec2<T>
[src]
type Output = Vec2<T::Output>
The resulting type after applying the /
operator.
fn div(self, other: Vec2<T>) -> Self::Output
[src]
impl<T: Eq> Eq for Vec2<T>
[src]
impl<T> From<(T, T)> for Vec2<T>
[src]
impl<T: Hash> Hash for Vec2<T>
[src]
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: Mul<T>> Mul<Vec2<T>> for Vec2<T>
[src]
type Output = Vec2<T::Output>
The resulting type after applying the *
operator.
fn mul(self, other: Vec2<T>) -> Self::Output
[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.
fn neg(self) -> Self::Output
[src]
impl<T: PartialEq> PartialEq<Vec2<T>> for Vec2<T>
[src]
impl<T> StructuralEq for Vec2<T>
[src]
impl<T> StructuralPartialEq for Vec2<T>
[src]
impl<T: Sub<T>> Sub<Vec2<T>> for Vec2<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for Vec2<T> where
T: RefUnwindSafe,
[src]
T: RefUnwindSafe,
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,
impl<T> UnwindSafe for Vec2<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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<R, P> ReadPrimitive<R> for P where
R: ReadEndian<P> + Read,
P: Default,
[src]
R: ReadEndian<P> + Read,
P: Default,
pub fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
[src]
pub fn read_from_big_endian(read: &mut R) -> Result<Self, Error>
[src]
pub fn read_from_native_endian(read: &mut R) -> Result<Self, Error>
[src]
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, 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>,