pub struct Affine2<T: CoordinateScalar> {
pub m: [T; 9],
/* private fields */
}Expand description
3×3 affine matrix in homogeneous 2D coordinates.
Mirrors boost::geometry::strategy::transform::matrix_transformer<T, 2, 2>
from matrix_transformers.hpp.
Fields§
§m: [T; 9]Row-major: [a, b, tx, c, d, ty, 0, 0, 1].
Implementations§
Source§impl<T: CoordinateScalar> Affine2<T>
impl<T: CoordinateScalar> Affine2<T>
Sourcepub fn translation(tx: T, ty: T) -> Self
pub fn translation(tx: T, ty: T) -> Self
Translation by (tx, ty).
Source§impl Affine2<f64>
impl Affine2<f64>
Sourcepub fn rotation(angle_rad: f64) -> Self
pub fn rotation(angle_rad: f64) -> Self
Rotation by angle_rad radians counter-clockwise. Only
available for f64 (needs sin/cos, which the scalar trait
does not yet expose generically).
std-gated: f64::sin_cos is not shimmed by geometry-coords
under libm (only sqrt/abs are), so this constructor is
unavailable in a no_std build.
Trait Implementations§
impl<T: Copy + CoordinateScalar> Copy for Affine2<T>
Source§impl<T, P> TransformStrategy<P> for Affine2<T>where
T: CoordinateScalar,
P: Point<Scalar = T>,
<P::Cs as CoordinateSystem>::Family: SameAs<CartesianFamily>,
impl<T, P> TransformStrategy<P> for Affine2<T>where
T: CoordinateScalar,
P: Point<Scalar = T>,
<P::Cs as CoordinateSystem>::Family: SameAs<CartesianFamily>,
Auto Trait Implementations§
impl<T> Freeze for Affine2<T>where
T: Freeze,
impl<T> RefUnwindSafe for Affine2<T>where
T: RefUnwindSafe,
impl<T> Send for Affine2<T>where
T: Send,
impl<T> Sync for Affine2<T>where
T: Sync,
impl<T> Unpin for Affine2<T>where
T: Unpin,
impl<T> UnsafeUnpin for Affine2<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Affine2<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more