Class Index | File Index

Classes


Class JXG.Turtle

This is the Turtle class. It is derived from JXG.GeometryElement. It stores all properties required to move a turtle.
Defined in: Turtle.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
JXG.Turtle(x,y,angle, attributes)
Constructs a new Turtle object.
Method Summary
Method Attributes Method Name and Description
 
back(length)
Move the turtle backwards.
 
bk(len)
Alias for #back
 
Removes the turtle curve from the board.
 
Removes the turtle completely and resets it to its initial position and direction.
 
cs()
Alias for #clearScreen
 
fd(len)
Alias for #forward
 
forward(length)
Move the turtle forward.
 
hasPoint(x, y, Find)
Checks whether (x,y) is near the curve.
 
Sets the visibility of the turtle head to false,
 
home()
Moves the turtle to position [0,0].
 
ht()
Alias for #hideTurtle
 
left(angle)
Rotate the turtle direction to the right.
 
lookTo(angle, x, y)
Rotates the turtle into a new direction.
 
lt(angle)
Alias for #left
 
moveTo(x, y)
Moves the turtle to a given coordinate pair.
 
pd()
Alias for #penDown
 
Pen down, continues visible drawing
 
Pen up, stops visible drawing
 
pop()
Alias for #popTurtle
 
Gets the last position of the turtle on the stack, sets the turtle to this position and removes this position from the stack.
 
pu()
Alias for #penUp
 
push()
Alias for #pushTurtle
 
Pushes the position of the turtle on the stack.
 
right(angle)
Rotate the turtle direction to the right
 
rt(angle)
Alias for #right
 
Sets the highlight pen color.
 
setPenColor(color)
Sets the pen color.
 
setPenSize(size)
Sets the pen size.
 
setPos(x, y)
Moves the turtle without drawing to a new position
 
setProperty(key:value)
Sets properties of the turtle, see also JXG.GeometryElement#setProperty.
 
Sets the visibility of the turtle head to true,
 
st()
Alias for #showTurtle
 
X(target)
 
Y(target)
Class Detail
JXG.Turtle(x,y,angle, attributes)
Constructs a new Turtle object.
Parameters:
{String} JXG.board
The board the new turtle is drawn on.
{Array} x,y,angle Optional
Start position and start direction of the turtle. Possible values are [x,y,angle] [[x,y],angle] [x,y] [[x,y]]
{Object} attributes
Attributes to change the visual properties of the turtle object All angles are in degrees.
Method Detail
back(length)
Move the turtle backwards.
Parameters:
{float} length
of backwards move in user coordinates
Returns:
pointer to the turtle object

bk(len)
Alias for #back
Parameters:
len

clean()
Removes the turtle curve from the board. The turtle stays in its position.
Returns:
pointer to the turtle object

clearScreen()
Removes the turtle completely and resets it to its initial position and direction.
Returns:
pointer to the turtle object

cs()
Alias for #clearScreen

fd(len)
Alias for #forward
Parameters:
len

forward(length)
Move the turtle forward.
Parameters:
{float} length
of forward move in user coordinates
Returns:
pointer to the turtle object

{bool} hasPoint(x, y, Find)
Checks whether (x,y) is near the curve.
Parameters:
{int} x
Coordinate in x direction, screen coordinates.
{int} y
Coordinate in y direction, screen coordinates.
{y} Find
closest point on the curve to (x,y)
Returns:
{bool} True if (x,y) is near the curve, False otherwise.

hideTurtle()
Sets the visibility of the turtle head to false,
Returns:
pointer to the turtle object

home()
Moves the turtle to position [0,0].
Returns:
pointer to the turtle object

ht()
Alias for #hideTurtle

left(angle)
Rotate the turtle direction to the right.
Parameters:
{float} angle
of the rotation in degrees
Returns:
pointer to the turtle object

lookTo(angle, x, y)
Rotates the turtle into a new direction. There are two possibilities:
Parameters:
{float} angle
New direction to look to or
{float} x
New x coordinate to look to
{float} y
New y coordinate to look to
Returns:
pointer to the turtle object

lt(angle)
Alias for #left
Parameters:
angle

moveTo(x, y)
Moves the turtle to a given coordinate pair. The direction is not changed.
Parameters:
{float} x
New x coordinate to look to
{float} y
New y coordinate to look to
Returns:
pointer to the turtle object

pd()
Alias for #penDown

penDown()
Pen down, continues visible drawing
Returns:
pointer to the turtle object

penUp()
Pen up, stops visible drawing
Returns:
pointer to the turtle object

pop()
Alias for #popTurtle

popTurtle()
Gets the last position of the turtle on the stack, sets the turtle to this position and removes this position from the stack.
Returns:
pointer to the turtle object

pu()
Alias for #penUp

push()
Alias for #pushTurtle

pushTurtle()
Pushes the position of the turtle on the stack.
Returns:
pointer to the turtle object

right(angle)
Rotate the turtle direction to the right
Parameters:
{float} angle
of the rotation in degrees
Returns:
pointer to the turtle object

rt(angle)
Alias for #right
Parameters:
angle

setHighlightPenColor(color)
Sets the highlight pen color. Equivalent to setProperty({highlightStrokeColor:color})
Parameters:
{string} color
Returns:
pointer to the turtle object

setPenColor(color)
Sets the pen color. Equivalent to setProperty({strokeColor:color})
Parameters:
{string} color
Returns:
pointer to the turtle object

setPenSize(size)
Sets the pen size. Equivalent to setProperty({strokeWidth:size})
Parameters:
{float} size
Returns:
pointer to the turtle object

setPos(x, y)
Moves the turtle without drawing to a new position
Parameters:
{float} x
new x- coordinate
{float} y
new y- coordinate
Returns:
pointer to the turtle object

setProperty(key:value)
Sets properties of the turtle, see also JXG.GeometryElement#setProperty. Sets the property for all curves of the turtle.
Parameters:
{Object} key:value
pairs
Returns:
pointer to the turtle object

showTurtle()
Sets the visibility of the turtle head to true,
Returns:
pointer to the turtle object

st()
Alias for #showTurtle

X(target)
Parameters:
target
Returns:
x-coordinate of the turtle position

Y(target)
Parameters:
target
Returns:
y-coordinate of the turtle position

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Oct 25 2011 00:43:20 GMT-0000 (UTC)