Wrapper functions for transformations, rotate: tf_rotate, flip: tf_flip, shift: tf_shift shear: tf_shear, scale: tf_scale and tf_scale_xy

tf_affine(
  object,
  type = c("none", "translate", "scale", "rotate", "shear", "reflect"),
  by.each.cross = F,
  x = 0,
  y = 0,
  angle = NA,
  scale.x = NA,
  scale.y = NA,
  counterclockwise = FALSE,
  relative = T,
  crosses = NULL,
  layout = "transforming"
)

tf_rotate(object, x = 0, y = 0, angle = 90, ...)

tf_flip(object, axis = c("x", "y"), ...)

tf_shift(object, x = 0, y = 0, ...)

tf_shear(object, axis = c("x", "y"), angle = 15, ...)

tf_scale(object, x = 0, y = 0, scale.x = 1, scale.y = 1, ...)

Arguments

object

a CrossLink object

type

affine type

by.each.cross

transformation to be performed by each cross

x, y

coordiantes of transformation center for tf_rotate; offset in x,y axies for tf_shift; scale about this position for tf_scale; scale x and y along x, y axies, respectively, for tf_scale_xy

angle

transformation angle in degree

scale.x, scale.y

scale size for type scale

counterclockwise

angle in counterclockwise for transformation

relative

x,y is relative coordinates in range c(0,1)

crosses

only these crosses will be transformed

layout

layout name to save

...

other parameters passed to tf_affine

axis

along which axis to flip or shear

Value

an updated CrossLink object

Details

learn more about 2D affine and perspective tranformation matrix:

  • https://en.wikipedia.org/wiki/Transformation_matrix

  • https://www.cnblogs.com/bnuvincent/p/6691189.html

  • Rconic::`Affine planar transformations matrix`

Examples