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

Returns true if the object is invertible, false otherwise.

Returns the inverse of an object.

This method must not panic, even if the object can't be reasonably inverted.

Provided Methods

Inverts an object, mutating it.

Attempts to compute the inverse of a transformation.

Returns Some(inverse) if the transformation is invertible, returns None otherwise.

Implementors