anar

Class Turtle

java.lang.Object
  extended by anar.Turtle

public class Turtle
extends java.lang.Object

Implements logo turtle in the anar framework Original Syntax Syntax again French Syntax http://pagesperso-orange.fr/blady/Ressources/dia_logo.pdf


Field Summary
static java.lang.String[][] AND
           
static java.lang.String[][] ARGUMENTS
           
static java.lang.String[][] BACK
           
static java.lang.String[][] CLEAN
           
static java.lang.String[][] CLEARSCREEN
           
static java.lang.String[][] CLEARTEXT
           
static java.lang.String[][][] COMMANDS
           
static boolean debug
           
 boolean displayTurtle
           
static java.lang.String[][] DOWN
           
static java.lang.String[][] END
           
static java.lang.String[][] FENCE
           
static java.lang.String[][] FORWARD
           
 Vertex head
          turtle head
static java.lang.String[][] HIDETURTLE
           
static java.lang.String[][] HOME
           
static java.lang.String[][] IF
           
static java.lang.String[][] LEFT
           
 Vertex norm
          turtle normal which defines the turning plan
static java.lang.String[][] OR
           
static java.lang.String[][] PENDOWN
           
static java.lang.String[][] PENERASE
           
 boolean penState
          Correspond to the state of the pen up or down True = penDown False = penUp
static java.lang.String[][] PENUP
           
static java.lang.String[][] REPEAT
           
static java.lang.String[][] RIGHT
           
static java.lang.String[][] SETBACKGROUND
           
static java.lang.String[][] SETHEADING
           
static java.lang.String[][] SETPENCOLOR
           
static java.lang.String[][] SETPOS
           
static java.lang.String[][] SETSPEED
           
static java.lang.String[][] SETX
           
static java.lang.String[][] SETXY
           
static java.lang.String[][] SETXYZ
           
static java.lang.String[][] SETY
           
static java.lang.String[][] SETZ
           
static java.lang.String[][] SHOWTURTLE
           
 Vertex tail
          turtle direction
static java.lang.String[][] THEN
           
 Obj trace
          The trailing trace of the turtle.
 Obj turtle
          The body of the turtle.
static java.lang.String[][] UP
           
static java.lang.String[][] WINDOWS
           
static java.lang.String[][] WRAP
           
 
Constructor Summary
Turtle()
          start a new turtle at origin with default heading and orientation
Turtle(XYZ head)
          starts a turtle in point p with default heading and orientation
Turtle(XYZ head, XYZ tail, XYZ norm)
           
 
Method Summary
 Turtle BACK(float dist)
          BACK - the turtle go backward same as FORWARD(-f) Moves the turtle backward, i.e., exactly opposite to the direction that it's headed, by the specified distance.
 Turtle BACK(Param dist)
          BACK
 Turtle BK(float dist)
          BACK
 Turtle BK(Param dist)
          BACK
 Turtle CLEAN()
          Erases all lines that the turtle has drawn on the graphics window.
 Turtle CLEARSCREEN()
          Erases the graphics window and sends the turtle to its initial position and heading.
 Turtle CS()
           
 Turtle DOWN(float angle)
          DOWN - Turns the turtle clockwise by the specified angle, measured in degrees (1/360 of a circle).
 Turtle DOWN(Param angle)
           
 void draw()
          Draw the turtle body and the trailing results.
 Turtle drawingFromHead()
           
 Turtle drawingFromTail()
           
 void drawTrace()
          Draw the trailing trace from the turtle.
 Turtle DW(float angle)
          DOWN
 Turtle DW(Param angle)
          DOWN
 Turtle FD(float dist)
          FORWARD
 Turtle FD(Param dist)
          FORWARD
 Turtle FORWARD(float dist)
          FORWARD in the local frame Moves the turtle forward, in the direction that it's headed, by the specified distance (measured in turtle steps).
 Turtle FORWARD(Param dist)
           
 Vertex getPos()
           
 Turtle HIDETURTLE()
          Makes the turtle visible.
 Turtle HOME()
          Moves the turtle to the center of the screen.
 Turtle HT()
           
 Turtle LEFT(float angle)
          LEFT - Turns the turtle clockwise by the specified angle, measured in degrees (1/360 of a circle).
 Turtle LEFT(Param angle)
           
 Turtle load(java.lang.String fileName)
          Load a file with a LOGO syntax.
 Turtle LOGO(java.lang.String command)
          Parse a command with the LOGO syntax.
 Turtle LOGO(java.lang.String[] tokens)
           
 Turtle LT(float angle)
          LEFT
 Turtle LT(Param angle)
          LEFT
 Turtle PD()
           
 Turtle PENDOWN()
          Sets the pen's position to DOWN, without changing its mode.
 Turtle PENUP()
          Sets the pen's position to UP, without changing its mode.
 Turtle PU()
           
 Turtle REPEAT(int times, java.lang.String command)
           
 Turtle resetTurtle()
           
 Turtle RIGHT(float angle)
          RIGHT - Turns the turtle clockwise by the specified angle, measured in degrees (1/360 of a circle).
 Turtle RIGHT(Param angle)
           
 Turtle ROTATEXY(float angle)
          rotates the heading of the turtle on the turning plan
 Turtle ROTATEXY(Param angle)
           
 Turtle ROTATEXZ(float angle)
          rotates the local turning plan
 Turtle ROTATEXZ(Param angle)
           
 Turtle RT(float angle)
          RIGHT
 Turtle RT(Param angle)
          RIGHT
 void setCameraOnTurtle()
           
 Turtle SETH(float angle)
           
 Turtle setHead(XYZ head)
           
 Turtle SETHEADING(float angle)
          Turns the turtle to a new absolute heading.
 Turtle setNorm(XYZ norm)
           
 Turtle SETPC(AColor color)
           
 Turtle SETPC(float red, float green, float blue)
           
 Turtle SETPC(int color)
           
 Turtle SETPENCOLOR(float red, float green, float blue)
          Sets the pen to colorvector.
 Turtle SETPOS(float x, float y)
          Moves the turtle to an absolute X,Y, Z coordinate.
 Turtle SETPOS(float x, float y, float z)
          Moves the turtle to an absolute X,Y, Z coordinate.
 Turtle SETPOS(Param x, Param y, Param z)
           
 Turtle setTail(XYZ tail)
           
 Turtle setTurtle(XYZ head, XYZ tail, XYZ norm)
           
 Turtle SETX(float dist)
          Moves the turtle along the X axis from its current position to a new absolute X coordinate.
 Turtle SETX(Param dist)
           
 Turtle SETXY(float x, float y)
           
 Turtle SETXY(Param x, Param y)
           
 Turtle SETXYZ(float x, float y, float z)
           
 Turtle SETXYZ(Param x, Param y, Param z)
           
 Turtle SETY(float dist)
          Moves the turtle along the Y axis from its current position to a new absolute Y coordinate.
 Turtle SETY(Param dist)
           
 Turtle SETZ(float dist)
          Moves the turtle along the Z axis from its current position to a new absolute Z coordinate.
 Turtle SETZ(Param dist)
           
 Turtle SHOWTURTLE()
          Makes the turtle visible.
 Turtle ST()
           
 Turtle UP(float angle)
          UP - Turns the turtle clockwise by the specified angle, measured in degrees (1/360 of a circle).
 Turtle UP(Param angle)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tail

public Vertex tail
turtle direction


head

public Vertex head
turtle head


norm

public Vertex norm
turtle normal which defines the turning plan


trace

public Obj trace
The trailing trace of the turtle. Contains multilines.


turtle

public Obj turtle
The body of the turtle. Change this if you want a different body for the turtle.


FORWARD

public static final java.lang.String[][] FORWARD

BACK

public static final java.lang.String[][] BACK

RIGHT

public static final java.lang.String[][] RIGHT

LEFT

public static final java.lang.String[][] LEFT

UP

public static final java.lang.String[][] UP

DOWN

public static final java.lang.String[][] DOWN

HOME

public static final java.lang.String[][] HOME

PENUP

public static final java.lang.String[][] PENUP

PENDOWN

public static final java.lang.String[][] PENDOWN

PENERASE

public static final java.lang.String[][] PENERASE

CLEARSCREEN

public static final java.lang.String[][] CLEARSCREEN

CLEAN

public static final java.lang.String[][] CLEAN

HIDETURTLE

public static final java.lang.String[][] HIDETURTLE

SHOWTURTLE

public static final java.lang.String[][] SHOWTURTLE

WRAP

public static final java.lang.String[][] WRAP

WINDOWS

public static final java.lang.String[][] WINDOWS

FENCE

public static final java.lang.String[][] FENCE

CLEARTEXT

public static final java.lang.String[][] CLEARTEXT

SETPENCOLOR

public static final java.lang.String[][] SETPENCOLOR

SETBACKGROUND

public static final java.lang.String[][] SETBACKGROUND

SETHEADING

public static final java.lang.String[][] SETHEADING

SETPOS

public static final java.lang.String[][] SETPOS

SETXY

public static final java.lang.String[][] SETXY

SETXYZ

public static final java.lang.String[][] SETXYZ

SETX

public static final java.lang.String[][] SETX

SETY

public static final java.lang.String[][] SETY

SETZ

public static final java.lang.String[][] SETZ

REPEAT

public static final java.lang.String[][] REPEAT

AND

public static final java.lang.String[][] AND

OR

public static final java.lang.String[][] OR

IF

public static final java.lang.String[][] IF

THEN

public static final java.lang.String[][] THEN

END

public static final java.lang.String[][] END

SETSPEED

public static final java.lang.String[][] SETSPEED

COMMANDS

public static final java.lang.String[][][] COMMANDS

ARGUMENTS

public static final java.lang.String[][] ARGUMENTS

displayTurtle

public boolean displayTurtle

penState

public boolean penState
Correspond to the state of the pen up or down True = penDown False = penUp


debug

public static boolean debug
Constructor Detail

Turtle

public Turtle()
start a new turtle at origin with default heading and orientation


Turtle

public Turtle(XYZ head)
starts a turtle in point p with default heading and orientation

Parameters:
head -

Turtle

public Turtle(XYZ head,
              XYZ tail,
              XYZ norm)
Method Detail

drawingFromHead

public Turtle drawingFromHead()

drawingFromTail

public Turtle drawingFromTail()

getPos

public Vertex getPos()

LOGO

public Turtle LOGO(java.lang.String command)
Parse a command with the LOGO syntax.

Parameters:
command -
Returns:
the Turtle

LOGO

public Turtle LOGO(java.lang.String[] tokens)

load

public Turtle load(java.lang.String fileName)
Load a file with a LOGO syntax.

Parameters:
fileName - - Path to your LOGO file.
Returns:

REPEAT

public Turtle REPEAT(int times,
                     java.lang.String command)

FORWARD

public Turtle FORWARD(float dist)
FORWARD in the local frame Moves the turtle forward, in the direction that it's headed, by the specified distance (measured in turtle steps).

Parameters:
dist -
Returns:
the Turtle

FORWARD

public Turtle FORWARD(Param dist)
Parameters:
dist -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#FORWARD(float)

FD

public Turtle FD(float dist)
FORWARD

Parameters:
dist -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#FORWARD(float)

FD

public Turtle FD(Param dist)
FORWARD

Parameters:
dist -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#FORWARD(float)

BACK

public Turtle BACK(float dist)
BACK - the turtle go backward same as FORWARD(-f) Moves the turtle backward, i.e., exactly opposite to the direction that it's headed, by the specified distance. (The heading of the turtle does not change.)

Parameters:
dist -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#FORWARD(float)

BACK

public Turtle BACK(Param dist)
BACK

Parameters:
dist -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#BACK(float)

BK

public Turtle BK(Param dist)
BACK

Parameters:
dist -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#BACK(float)

BK

public Turtle BK(float dist)
BACK

Parameters:
dist -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#BACK(float)

HOME

public Turtle HOME()
Moves the turtle to the center of the screen. Equivalent to SETPOS [0 0 0].

Returns:
the Turtle

setHead

public Turtle setHead(XYZ head)

setTail

public Turtle setTail(XYZ tail)

setNorm

public Turtle setNorm(XYZ norm)

setTurtle

public Turtle setTurtle(XYZ head,
                        XYZ tail,
                        XYZ norm)

resetTurtle

public Turtle resetTurtle()

SETPOS

public Turtle SETPOS(float x,
                     float y,
                     float z)
Moves the turtle to an absolute X,Y, Z coordinate. The argument is a list of three numbers, the X, Y, Z coordinates.

Parameters:
x -
y -
z -
Returns:
the Turtle

SETPOS

public Turtle SETPOS(float x,
                     float y)
Moves the turtle to an absolute X,Y, Z coordinate. The argument is a list of three numbers, the X, Y, Z coordinates.

Parameters:
x -
y -
Returns:
the Turtle

SETPOS

public Turtle SETPOS(Param x,
                     Param y,
                     Param z)
Parameters:
x -
y -
z -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#setPos(float,float,float)

SETXYZ

public Turtle SETXYZ(float x,
                     float y,
                     float z)
Parameters:
x -
y -
z -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#setPos(float,float,float)

SETXYZ

public Turtle SETXYZ(Param x,
                     Param y,
                     Param z)
Parameters:
x -
y -
z -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#setPos(float,float,float)

SETXY

public Turtle SETXY(float x,
                    float y)
Parameters:
x -
y -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#setPos(float,float)

SETXY

public Turtle SETXY(Param x,
                    Param y)
Parameters:
x -
y -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#setPos(float,float)

SETX

public Turtle SETX(float dist)
Moves the turtle along the X axis from its current position to a new absolute X coordinate. The argument is the new X coordinate.

Parameters:
dist -
Returns:
the Turtle

SETX

public Turtle SETX(Param dist)
Parameters:
dist -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#setX(float)

SETY

public Turtle SETY(float dist)
Moves the turtle along the Y axis from its current position to a new absolute Y coordinate. The argument is the new Y coordinate.

Parameters:
dist -
Returns:
the Turtle

SETY

public Turtle SETY(Param dist)
Parameters:
dist -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#setY(float)

SETZ

public Turtle SETZ(float dist)
Moves the turtle along the Z axis from its current position to a new absolute Z coordinate. The argument is the new Z coordinate.

Parameters:
dist -
Returns:
the Turtle

SETZ

public Turtle SETZ(Param dist)
Parameters:
dist -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#setZ(float)

SETHEADING

public Turtle SETHEADING(float angle)
Turns the turtle to a new absolute heading. The argument is an angle, the heading in degrees clockwise from the positive Y axis.

Parameters:
angle - in degree
Returns:
the Turtle

SETH

public Turtle SETH(float angle)
Parameters:
angle -
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#SETHEADING(float)

ROTATEXZ

public Turtle ROTATEXZ(float angle)
rotates the local turning plan

Parameters:
angle - in rad
Returns:
the Turtle

ROTATEXZ

public Turtle ROTATEXZ(Param angle)
Parameters:
angle - in rad
Returns:
the Turtle

ROTATEXY

public Turtle ROTATEXY(float angle)
rotates the heading of the turtle on the turning plan

Parameters:
angle - in rad
Returns:
the Turtle

ROTATEXY

public Turtle ROTATEXY(Param angle)
Parameters:
angle - in rad
Returns:
the Turtle

RIGHT

public Turtle RIGHT(float angle)
RIGHT - Turns the turtle clockwise by the specified angle, measured in degrees (1/360 of a circle).

Parameters:
angle - in degree
Returns:
the Turtle

RIGHT

public Turtle RIGHT(Param angle)
Parameters:
angle - in degree
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#RIGHT(float)

RT

public Turtle RT(float angle)
RIGHT

Parameters:
angle - in degree
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#RIGHT(float)

RT

public Turtle RT(Param angle)
RIGHT

Parameters:
angle - in degree
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#RIGHT(float)

LEFT

public Turtle LEFT(float angle)
LEFT - Turns the turtle clockwise by the specified angle, measured in degrees (1/360 of a circle).

Parameters:
angle - in degree
Returns:
the Turtle

LEFT

public Turtle LEFT(Param angle)
Parameters:
angle - in degree
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#LEFT(float)

LT

public Turtle LT(float angle)
LEFT

Parameters:
angle - in degree
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#LEFT(float)

LT

public Turtle LT(Param angle)
LEFT

Parameters:
angle - in degree
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#LEFT(float)

UP

public Turtle UP(float angle)
UP - Turns the turtle clockwise by the specified angle, measured in degrees (1/360 of a circle).

Parameters:
angle - in degree
Returns:
the Turtle

UP

public Turtle UP(Param angle)
Parameters:
angle - in degree
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#UP(float)

DOWN

public Turtle DOWN(float angle)
DOWN - Turns the turtle clockwise by the specified angle, measured in degrees (1/360 of a circle).

Parameters:
angle - in degree
Returns:
the Turtle

DOWN

public Turtle DOWN(Param angle)
Parameters:
angle - in degree
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#DOWN(float)

DW

public Turtle DW(float angle)
DOWN

Parameters:
angle - in degree
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#DOWN(float)

DW

public Turtle DW(Param angle)
DOWN

Parameters:
angle - in degree
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#DOWN(float)

CLEAN

public Turtle CLEAN()
Erases all lines that the turtle has drawn on the graphics window. The turtle's state (position, heading, pen mode, etc.) is not changed.

Returns:
the Turtle

CLEARSCREEN

public Turtle CLEARSCREEN()
Erases the graphics window and sends the turtle to its initial position and heading.

Returns:
the Turtle

CS

public Turtle CS()

SHOWTURTLE

public Turtle SHOWTURTLE()
Makes the turtle visible.

Returns:
the Turtle

ST

public Turtle ST()
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#SHOWTURTLE()

HIDETURTLE

public Turtle HIDETURTLE()
Makes the turtle visible.

Returns:
the Turtle

HT

public Turtle HT()
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#HIDETURTLE()

PENUP

public Turtle PENUP()
Sets the pen's position to UP, without changing its mode.

Returns:
the Turtle

PU

public Turtle PU()
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#PENUP()

PENDOWN

public Turtle PENDOWN()
Sets the pen's position to DOWN, without changing its mode.

Returns:
the Turtle

PD

public Turtle PD()
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#PENDOWN()

SETPENCOLOR

public Turtle SETPENCOLOR(float red,
                          float green,
                          float blue)
Sets the pen to colorvector. The colorvector is a list of [red green blue] intensities. The pen color effects drawing text (LABEL) and drawing any line with the turtle (such as FORWARD).

Parameters:
red -
green -
blue -

SETPC

public Turtle SETPC(float red,
                    float green,
                    float blue)
Parameters:
red -
green -
blue -
Returns:
See Also:
anar.geo.extra.Turtle#SETPENCOLOR(float,float,float)

SETPC

public Turtle SETPC(AColor color)
Parameters:
color - OogColor
Returns:
See Also:
anar.geo.extra.Turtle#SETPENCOLOR(float,float,float)

SETPC

public Turtle SETPC(int color)
Parameters:
color - (processing)
Returns:
the Turtle
See Also:
anar.geo.extra.Turtle#SETPENCOLOR(float,float,float)

draw

public void draw()
Draw the turtle body and the trailing results.


drawTrace

public void drawTrace()
Draw the trailing trace from the turtle.


setCameraOnTurtle

public void setCameraOnTurtle()