trans2d | R Documentation |
Perform linear spatial transformations on a matrix, including rigid, similarity, and affine transformations.
trans2d(x, y, z, pmat,
rotate = 0, translate = c(0, 0), scale = c(1, 1),
interp = "linear", dimout = dim(z), ...)
x , y , z |
The data to be interpolated. Alternatively, |
pmat |
A 3 x 2 transformation matrix for performing an affine transformation. Automatically generated from |
rotate |
Rotation in degrees. |
translate |
Translation vector, in the same units as |
scale |
Scaling factors. |
interp |
Interpolation method. See |
dimout |
The dimensions of the returned matrix. |
... |
Additional arguments passed to |
If x
is a matrix or z
is provided, returns a transformed matrix with the dimensions of dimout
.
Otherwise, only the transformed coordinates are returned in a data.frame
.
Kylie A. Bemis
approx2
set.seed(1)
x <- matrix(0, nrow=32, ncol=32)
x[9:24,9:24] <- 10
x <- x + runif(length(x))
xt <- trans2d(x, rotate=15, translate=c(-5, 5))
par(mfcol=c(1,2))
image(x, col=hcl.colors(256), main="original")
image(xt, col=hcl.colors(256), main="transformed")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.