ShearedPolygon: Creates a sheared polygon from a given one

Description Usage Arguments Value Examples

View source: R/ShearedPolygon.R

Description

ShearedPolygon creates a sheared polygon from a given one

Usage

1
ShearedPolygon(Poly, k, direction)

Arguments

Poly

Polygon object, previously created with function CreatePolygon or CreateRegularPolygon

k

Number that represents the shear factor which is applied to the original polygon

direction

String with value "horizontal" or "vertical" which indicates the direction in which shearing is applied. Horizontal means the shearing is parallel to the X axis, while vertical means parallel to the Y axis

Value

Returns a sheared polygon, in any of the two axis, to the original one

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
x_min <- -5
x_max <- 5
y_min <- -5
y_max <- 5
CoordinatePlane(x_min, x_max, y_min, y_max)
Square <- CreateRegularPolygon(4, c(-2, 0), 1)
Draw(Square, "blue")
k <- 1
Square_shearX <- Translate(ShearedPolygon(Square, k, "horizontal"), c(3,0))
Draw(Square_shearX, "orange")
Square_shearY <- Translate(ShearedPolygon(Square, k, "vertical"), c(3,0))
Draw(Square_shearY, "orange")

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