Rotate: Rotates a geometric object

Description Usage Arguments Value Examples

View source: R/Rotation.R

Description

Rotate rotates a geometric object of any of the following types: line, polygon or segment

Usage

1
Rotate(object, fixed, angle)

Arguments

object

geometric object of type line, polygon or segment, previously created with any of the functions in the package

fixed

Vector containing the xy-coordinates of the only point of the plane which remains fixed during rotation

angle

Angle of rotation in degrees (0-360), considering the clockwise direction

Value

Returns a geometric object which is the rotation of the original one, following the clockwise direction

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
x_min <- -5
x_max <- 5
y_min <- -5
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")
fixed <- c(-1,-1)
angle <- 30
Poly_rotated <- Rotate(Poly, fixed, angle)
Draw(Poly_rotated, "orange")
fixed <- c(2,0)
Poly_rotated <- Rotate(Poly, fixed, angle)
Draw(Poly_rotated, "transparent")

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.