The LOGO programming language has a fill command which essentially performs a flood fill starting at the turtle's current position.
Filling in Solid Shapes
Now that we know how to move the turtle without drawing a line, we can make the turtle go inside a shape that it has drawn. Then we can fill the entire shape with a single color, using the FILL command.
You can think of the FILL command as pouring out a bucket of special paint and flooding the area under the turtle. The paint is special in that it can't flow over pixels that have a different color than the pixel that the turtle is over.
To add this to turtle, add a public fill() method that sends an appropriate drawing command and performs the necessary algorithm to determine the fill. Add the filled area to the drawings as a polygon or using a better representation.
Make sure the fill method has some examples in the examples directory along with some documentation and some tests (if testing would be useful here).
The LOGO programming language has a fill command which essentially performs a flood fill starting at the turtle's current position.
To add this to turtle, add a public
fill()method that sends an appropriate drawing command and performs the necessary algorithm to determine the fill. Add the filled area to the drawings as a polygon or using a better representation.Make sure the fill method has some examples in the examples directory along with some documentation and some tests (if testing would be useful here).