Homothety: Creates an homothety from a given polygon

Description Usage Arguments Value References Examples

View source: R/Homothety.R

Description

Homothety creates an homothety from a given polygon

Usage

1
Homothety(Poly, C, k, lines = F)

Arguments

Poly

Polygon object, previously created with function CreatePolygon

C

Vector containing the xy-coordinates of the center of the homothety

k

Number which represents the expansion or contraction factor for the homothety

lines

Boolean. When lines = TRUE, the plot displays the lines that connect the center of the homothety with the points of the polygons (the original and the transformed one). If missing, it works as with lines = FALSE, so the lines are not displayed

Value

Returns the coordinates of a polygon that has been transformed according to the homothethy with center at C and factor k

References

https://www.encyclopediaofmath.org/index.php/Homothety

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
x_min <- -2
x_max <- 6
y_min <- -3
y_max <- 5
CoordinatePlane(x_min, x_max, y_min, y_max)
P1 <- c(0,0)
P2 <- c(1,1)
P3 <- c(2,0) 
Poly <- CreatePolygon(P1, P2, P3)
Draw(Poly, "blue")
C <- c(-1,-2)
k1 <- 0.5
Poly_homothety1 <- Homothety(Poly, C, k1, lines = TRUE)
Draw(Poly_homothety1, "orange")
k2 <- 2
Poly_homothety2 <- Homothety(Poly, C, k2, lines = TRUE)
Draw(Poly_homothety2, "orange")

Example output

NULL
[1] "Some of the inserted points are collinear. This could lead to a defective polygon."
NULL
NULL
NULL

LearnGeom documentation built on July 14, 2020, 5:06 p.m.