Star {LearnGeom} | R Documentation |
Creates a closed curve with the shape of a star. Each of the stars produced by this function is built through a simple iterative process based on segment drawing for certain angles and lengths. It can also produce regular polygons for some combinations of the parameters
Description
Star
creates a star with multiple building possibilities
Usage
Star(P, angle, l, time = 0, color = "transparent")
Arguments
P |
Vector containing the xy-coordinates of the starting point for the star |
angle |
Angle (0-360) that is related to the direction of the two segments which are drawn in each of the steps of the process. This parameter really represents the angle (in clockwise and anti-clockwise direction) for the two first drawn segments, but it is modified according to rotations of 144 degrees in all the following steps, including the last one, which closes the curve. |
l |
Number that indicates the length side of the segments that are drawn. This parameter will determine the size of the star |
time |
Number of seconds to wait for the program before drawing each of the segments that make star. If no |
color |
Color to indicate the points that are obtained during the process to draw the star. If missing, the points are not indicated and only the segments are drawn in the plot |
Value
None. It produces the plot of a closed curve with the shape of a star, if the parameters are chosen properly
References
Abelson, H., & DiSessa, A. A. (1986). Turtle geometry: The computer as a medium for exploring mathematics. MIT press
Examples
x_min <- -5
x_max <- 5
y_min <- -5
y_max <- 5
CoordinatePlane(x_min, x_max, y_min, y_max)
P <- c(0,0)
angle <- 0
l <- 1
Star(P, angle, l)