| holey_path {mazealls} | R Documentation |
holey_path .
Description
Make the turtle move multiple units, making turns, and possibly drawing line segments possibly with holes in them.
Usage
holey_path(unit_len, lengths, angles, draw_line = TRUE, has_hole = FALSE,
hole_color = NULL, hole_locations = NULL, hole_arrows = FALSE)
Arguments
unit_len |
the unit length in graph coordinates. This controls the width of the ‘holes’ in the boundary lines and generally controls the spacing of mazes. |
lengths |
an array of the number of units
each part of the path. An array of length |
angles |
after each part of the path is drawn, the turtle turns right by the given angle. |
draw_line |
a boolean array telling whether each part of the path is drawn at all, or whether the turtle simply moves through that path. |
has_hole |
a boolean array telling whether, conditional on the path being drawn, it has a one unit hole. |
hole_color |
the color to plot the ‘hole’.
A value |
hole_locations |
an optional array of ‘locations’
of the holes. These affect the |
hole_arrows |
a boolean or boolean array telling whether to draw a perpendicular arrow at a hole. |
Details
Causes the turtle to move through a path of connected line segments,
possibly drawing lines, possibly drawing holes in those lines.
All arguments are recycled to the length of the longest
argument via mapply, which simplifies
the path description.
Value
nothing; the function is called for side effects only, though in the future this might return information about the drawn boundary of the shape.
Author(s)
Steven E. Pav shabbychef@gmail.com
See Also
Examples
library(TurtleGraphics)
# draw a triangle with holes on the boundaries
turtle_init(1000,1000)
holey_path(unit_len=20, lengths=rep(10,3), angles=c(120), draw_line=TRUE, has_hole=TRUE)
# draw a square with holes on the boundaries
turtle_init(1000,1000)
turtle_hide()
holey_path(unit_len=20, lengths=rep(10,4), angles=c(90), draw_line=TRUE, has_hole=TRUE,
hole_color=c('red','green'))
# draw a square spiral
turtle_init(1000,1000)
turtle_hide()
holey_path(unit_len=20, lengths=sort(rep(1:10,2),decreasing=TRUE), angles=c(90),
draw_line=TRUE, has_hole=FALSE)