Container for accumulating 2D affine transformations. Simple spatial
transforms (spatShift(), spin(), rescale(), flip(), t(),
shear()) can be chained on an affine2d to build up a combined
transform, which is then applied to spatial objects in a single step via
affine().
Create an identity affine2d with affine() (no arguments).
Before chaining centroid-relative operations (spin(),
rescale()) without explicit x0/y0, set
ext(aff) <- ext(your_object) so the pivot point matches your data.
The combined linear transform is stored as a 3x3 homogeneous matrix in
@affine. Translations are encoded in column 3 (rows 1-2). The
convention is post-multiply: xy_out = xy_in %*% A.
Slots
anchornumeric(4). Anchoring spatial extent (
xmin, xmax, ymin, ymax). Set viaext(aff) <-to match the data extent. Used as the centroid pivot forspin()andrescale()whenx0/y0are not supplied, and for translation calculation during transform composition.affinematrix. 3x3 homogeneous transform matrix encoding the combined linear + translation transform.
ordercharacter. Records the order in which component operations were applied.
rotatenumeric(1). Accumulated rotation angle in radians.
shearnumeric(2). Accumulated shear factors
(x, y).scalenumeric(2). Accumulated scale factors
(x, y).translatenumeric(2). Accumulated translation
(x, y).
