p <- as_coord1d(x = sample(1:10, 3))
# {affiner} affine transformation matrices are post-multiplied
# and therefore should **not** go in reverse order
mat <- transform1d(diag(2)) %*%
scale1d(2) %*%
translate1d(x = -1)
p1 <- p$
clone()$
transform(mat)
# The equivalent result appyling affine transformations via method chaining
p2 <- p$
clone()$
transform(diag(2))$
scale(2)$
translate(x = -1)
all.equal(p1, p2)
Run the code above in your browser using DataLab