| homothety | R Documentation |
Compute a homothetic transformation for a set of points. The transformed set of points is optionally drawn as a polygon.
homothety(x, y, lambda, xcen = NULL, ycen = NULL, add = FALSE, ...)
x, y |
the x and ycoordinates of points. It can also be a matrix (see details). |
lambda |
the factor to be used for the homothetetic transformations. |
xcen, ycen |
the x and y coordinate for the center of rotation. |
add |
logical. If |
... |
additional arguments to be passed to |
If x is a matrix with more than 2 columns, then x is the first column and y the second one.
Note that lambda, xcen and ycen are unique, meaning that homothety computes only one homothetic transformation.
Drawing the points computed is relevant only if there are more than 2 points.
https://en.wikipedia.org/wiki/Homothetic_transformation.
# Example: plot0(c(0, 10), c(0, 10)) x <- c(4, 6, 5) y <- c(2, 2, 4) polygon(x, y) poly2 <- homothety(x, y, 2) polygon(poly2$x, poly2$y) poly3 <- homothety(x, y, -2.5, xcen = 5, ycen = 4, border = 4, add = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.