pub struct AffineTransform2D {
pub m: [f64; 6],
}Expand description
2D affine transform represented as a 3×3 matrix in row-major order.
Stored as 6 elements [a, b, tx, c, d, ty] representing:
| a b tx |
| c d ty |
| 0 0 1 |Uses f64 for numerical precision in composed transforms.
Fields§
§m: [f64; 6][a, b, tx, c, d, ty] — the upper two rows of a 3×3 affine matrix.
Implementations§
Source§impl AffineTransform2D
impl AffineTransform2D
Sourcepub fn new(a: f64, b: f64, tx: f64, c: f64, d: f64, ty: f64) -> Self
pub fn new(a: f64, b: f64, tx: f64, c: f64, d: f64, ty: f64) -> Self
Create from the six affine parameters.
Sourcepub fn apply(&self, p: Point2) -> Point2
pub fn apply(&self, p: Point2) -> Point2
Apply this transform to a Point2.
The point is converted to f64, transformed, and converted back.
Sourcepub fn apply_bbox(&self, bbox: BBox) -> BBox
pub fn apply_bbox(&self, bbox: BBox) -> BBox
Apply this transform to a BBox using the transform-and-re-bound method.
All four corners are transformed, then an axis-aligned bounding box is computed from the results. This may enlarge the box if the transform involves rotation.
Trait Implementations§
Source§impl Clone for AffineTransform2D
impl Clone for AffineTransform2D
Source§fn clone(&self) -> AffineTransform2D
fn clone(&self) -> AffineTransform2D
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AffineTransform2D
impl Debug for AffineTransform2D
Source§impl PartialEq for AffineTransform2D
impl PartialEq for AffineTransform2D
impl Copy for AffineTransform2D
impl StructuralPartialEq for AffineTransform2D
Auto Trait Implementations§
impl Freeze for AffineTransform2D
impl RefUnwindSafe for AffineTransform2D
impl Send for AffineTransform2D
impl Sync for AffineTransform2D
impl Unpin for AffineTransform2D
impl UnsafeUnpin for AffineTransform2D
impl UnwindSafe for AffineTransform2D
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