Polygon

Help Contents Graphics Drawing filled shapes Polygon
fill PolyStart

Polygon commandlist


command to draw a polygon using turtle commands inside the commandlist.

This is cool for drawing shapes, especially in 3D. In perspective mode the polygon will be lighted.

Be careful: the polygon must be simple and convex. For non-convex polygons and polygons with holes use Tesselation!

It is recommended to use the primitive Polygon instead of PolyStart..PolyEnd, because so you cannot forget PolyEnd, when i.e. leaving a loop with break, or leaving a procedure with output or stop.

Example:

clearScreen
setPC "red
PolyStart
repeat 8 [forward 100 right 45]
PolyEnd

clearScreen
perspective
PolyStart
repeat 6 [forward 100 right 60]
PolyEnd
rotatescene2

Examples:

References:

fill PolyStart