General-purpose escape hatch for an affine transform not covered by
trans_translate()/trans_rotate()/trans_scale()/trans_reflect()/
trans_shear(): wraps a caller-supplied matrix directly.
See also
Other transform helpers:
trans(),
trans_chain(),
trans_fn(),
trans_identity(),
trans_reflect(),
trans_rotate(),
trans_scale(),
trans_shear(),
trans_translate(),
trans_warp()
Examples
# equivalent to trans_scale(2, 3)
trans_affine(matrix(c(2, 0, 0, 0, 3, 0, 0, 0, 1), nrow = 3, byrow = TRUE))
#> <sketchpad::trans>
#> @ matrix: num [1:3, 1:3] 2 0 0 0 3 0 0 0 1
# the 2x3 form omits the trivial homogeneous third row
draw(shape_square(
side = 1,
trans = trans_affine(matrix(c(2, 0, 0, 0, 3, 0), nrow = 2, byrow = TRUE))
))