homothety: Homothety

View source: R/homothety.R

homothetyR Documentation

Homothety

Description

Compute a homothetic transformation for a set of points. The transformed set of points is optionally drawn as a polygon.

Usage

homothety(x, y, lambda, xcen = NULL, ycen = NULL, add = FALSE, ...)

Arguments

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 TRUE the set of transformed points are drawn as a polygon.

...

additional arguments to be passed to graphics::polygon() function (used only if add is TRUE).

Details

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.

References

https://en.wikipedia.org/wiki/Homothetic_transformation.

Examples

# 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)


KevCaz/graphicsutils documentation built on Sept. 16, 2022, 10:05 a.m.