Oberon || Library || Module Index || Search Engine || Definition || Module
TYPE Graphic = POINTER TO GraphicRec; TYPE GraphicRec = RECORD (Services.ObjectRec) END;
PROCEDURE Create(VAR graphic: Graphic; angle: REAL);
PROCEDURE EnableRoundCorners(graphic: Graphic; cornerFraction: REAL);
PROCEDURE PenDown(graphic: Graphic); PROCEDURE PenUp(graphic: Graphic);
PROCEDURE Save(graphic: Graphic); PROCEDURE Restore(graphic: Graphic);
PROCEDURE Left(graphic: Graphic); PROCEDURE Right(graphic: Graphic); PROCEDURE Forward(graphic: Graphic);
PROCEDURE ApplySymbols(graphic: Graphic; symbols: ARRAY OF CHAR);
PROCEDURE Plot(graphic: Graphic; plotter: Plotters.Plotter);
Create creates a new turtle graphic system. Turns (be it left oder right) operate with a fixed angle which is to be given in degrees. Traditional turtle graphics use an angle of 90 degrees.
EnableRoundCorners requests tangential arcs to be used for the corners. The fraction out of the range (0,0.5) specifies the part of a unit line which may be used for it. This is, for example, helpful for Dragon curves which would otherwise self-intersect. Round corners are not used at branch positions (generated by Save and Restore).
PenDown causes future forward moves to be drawn. Initially, the pen is already down. PenUp causes following forward moves not to be drawn until PenDown is called.
Save saves the current state (current position, current direction, and pen position) for later restoral by Restore. Restore restores the previously saved state. Save and Restore can be arbitrarily nested.
Left turns the current direction to the left by the angle that was given to Create. Right turns the current direction to the right.
Forward moves forward one unit and causes, if the pen position is down, a line to be drawn.
ApplySymbols draws a string of Lindenmayer symbols from which following are supported:
All other symbols are silently ignored.
Plot draws the turtle graphic graphic on plotter with a scale that is automatically adapted to the plot area.
Oberon || Library || Module Index || Search Engine || Definition || Module