Draw: Plots a geometric object

Description Usage Arguments Value Examples

View source: R/Draw.R

Description

Draw plots geometric objects

Usage

1
Draw(object, colors = c("black", "black"), label = FALSE)

Arguments

object

geometric object of any of these five types: point, segment, arc, line or polygon. A point is simply a vector of length 2, which contains the xy-coordinates for the point. For the other four types, there can be created with any of the following functions:
- CreateArcAngles
- CreateArcPointsDist
- CreateLineAngle
- CreateLinePoints
- CreatePolygon
- CreateRegularPolygon
- CreateSegmentAngle
- CreateSegmentPoints

colors

Vector containing information about the color for the object to be plotted. In the case of polygons, the vector should have length 2 to define the background color and the border color (in this order). Moreover, it can be used "transparent" in the case no background color is needed for the polygon. For the other four types of objects, color should be a vector of length 1 (or a simple string) to indicate the color for the object. If this parameter is not specified the default color is black (for polygons, it is black for the background and the border)

label

Boolean, only used for polygons. When label = TRUE and the object is a polygon, the plot displays the numbers that correspond to the order of the points of the polygon. If missing, it works as with label = FALSE, so the numbers are not displayed

Value

None. It produces the plot of a geometric object (point, segment, arc, line or polygon) in the current coordinate plane

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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, c("blue"))

Example output


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