Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

Turtle Class Reference

Turtle for drawing pictures. More...

#include <mturtle.h>

Inheritance diagram for Turtle:

TurtleState List of all members.

Public Methods

 Turtle (TurtleDevice &dev, double step, double drot)
void drawLSystem (const String &lstring)
void forward ()
virtual OStreamoperator>> (OStream &out) const

Detailed Description

Turtle for drawing pictures.

Definition at line 120 of file mturtle.h.


Constructor & Destructor Documentation

Turtle TurtleDevice   dev,
double    step,
double    drot
[inline]
 

Standard constructor.

Parameters:
dev  Graphics device.
step  Step scale size (for example 10 units).
drot  Rotation delta, in degrees (for example 45 degrees).

Definition at line 128 of file mturtle.h.

References TurtleState::jumpTo(), and TurtleState::mRot.


Member Function Documentation

void drawLSystem const String   lstring
 

Draws the given L-System description string produced by LGrammar.

Standard commands for L-Systems are accepted:

F = forward one 'step' length (see the constructor), pen down.

f = forward one 'step' length (see the constructor), pen up.

+ = turn right by the 'drot' amount given in constructor.

  • = turn left by the 'drot' amount given in constructor.
[ = push the current location into stack.

] = pop the topmost location from the stack.

Definition at line 64 of file mturtle.cc.

References TurtleState::copy(), TurtleDevice::end(), forward(), String::length(), TurtleState::mCoord, Array::size(), TurtleDevice::start(), TurtleDevice::tip(), and TurtleState::turnBy().

void forward  
 

Moves the turle forward one 'step' length (see the constructor).

Definition at line 57 of file mturtle.cc.

References TurtleDevice::forwardLine(), TurtleState::jumpTo(), TurtleState::mCoord, TurtleState::mRot, Coord2D::x, and Coord2D::y.

Referenced by drawLSystem().

OStream & operator>> OStream   out const [virtual]
 

Implementation for Object.

Dumps the object description to the given stream.

Definition at line 109 of file mturtle.cc.

References TurtleState::mCoord, TurtleState::mRot, OStream::printf(), Coord2D::x, and Coord2D::y.


The documentation for this class was generated from the following files:
Generated on Thu Feb 10 20:06:43 2005 for LibMagiC by doxygen1.2.18