Trait ludomath::vec2d::MaybeInvertible
[−]
[src]
pub trait MaybeInvertible: Sized + Copy { fn is_invertible(self) -> bool; fn invert(self) -> Self; fn invert_mut(&mut self) { ... } fn invert_checked(self) -> Option<Self> { ... } }
A trait for possibly-invertible transformation.
The inversion is analogous to 1/x, in that it might sometimes fail numerically. For example, scaling the plane by zero can't be reversed, since information is lost.
An implementation of this is required for implementing Transformation
.
Required Methods
fn is_invertible(self) -> bool
Returns true
if the object is invertible, false
otherwise.
fn invert(self) -> Self
Returns the inverse of an object.
This method must not panic, even if the object can't be reasonably inverted.
Provided Methods
fn invert_mut(&mut self)
Inverts an object, mutating it.
fn invert_checked(self) -> Option<Self>
Attempts to compute the inverse of a transformation.
Returns Some(inverse)
if the transformation is invertible,
returns None
otherwise.
Implementors
impl MaybeInvertible for Transform