JavaScript must be enabled in order for you to use JSXGraph and JSXGraph reference. However, it seems JavaScript is either disabled or not supported by your browser.

Class Index | File Index

Elements

Classes


Class JXG.Turtle


      ↳ 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(board, parents, attributes)
Constructs a new Turtle object.
Method Summary
Method Attributes Method Name and Description
 
back(len)
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.
<private>  
copyAttr(key, val)
Set a future attribute of the turtle.
 
cs()
Alias for #clearScreen
 
evalAt(t)
the "co"-coordinate of the turtle curve at position t is returned.
 
fd(len)
Alias for #forward
 
forward(len)
Move the turtle forward.
 
hasPoint(x, y)
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
<private>  
init(x, y, dir)
Initialize a new turtle or reinitialize a turtle after JXG.Turtle#clearScreen.
 
left(angle)
Rotate the turtle direction to the right.
 
lookTo(target)
Rotates the turtle into a new direction.
 
lt(angle)
Alias for #left
 
maxX()
Gives the upper bound of the parameter if the the turtle is treated as parametric curve.
 
minX()
Gives the lower bound of the parameter if the the turtle is treated as parametric curve.
 
moveTo(target)
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
 
setAttribute(attributes)
Sets properties of the turtle, see also JXG.GeometryElement#setAttribute.
 
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
 
Sets the visibility of the turtle head to true,
 
st()
Alias for #showTurtle
 
X(t)
if t is not supplied the x-coordinate of the turtle is returned.
 
Y(t)
if t is not supplied the y-coordinate of the turtle is returned.
 
Z(t)
Class Detail
JXG.Turtle(board, parents, attributes)
Constructs a new Turtle object.
Parameters:
{JXG.Board} board
The board the new turtle is drawn on.


{Array} parents
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
{JXG.Turtle} back(len)
Move the turtle backwards.
Parameters:
{Number} len
of backwards move in user coordinates
Returns:
{JXG.Turtle} pointer to the turtle object

bk(len)
Alias for #back
Parameters:
len

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

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

<private> {Object} copyAttr(key, val)
Set a future attribute of the turtle.
Parameters:
{String} key
{Number|String} val
Returns:
{Object} pointer to the attributes object

cs()
Alias for #clearScreen

{Number} evalAt(t)
the "co"-coordinate of the turtle curve at position t is returned.
Parameters:
{Number} t
parameter
{String} co.
Either 'X' or 'Y'.
Returns:
{Number} x-coordinate of the turtle position or x-coordinate of turtle at position t

fd(len)
Alias for #forward
Parameters:
len

{JXG.Turtle} forward(len)
Move the turtle forward.
Parameters:
{Number} len
of forward move in user coordinates
Returns:
{JXG.Turtle} pointer to the turtle object

{Boolean} hasPoint(x, y)
Checks whether (x,y) is near the curve.
Parameters:
{Number} x
Coordinate in x direction, screen coordinates.
{Number} y
Coordinate in y direction, screen coordinates.
Returns:
{Boolean} True if (x,y) is near the curve, False otherwise.

{JXG.Turtle} hideTurtle()
Sets the visibility of the turtle head to false,
Returns:
{JXG.Turtle} pointer to the turtle object

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

ht()
Alias for #hideTurtle

<private> init(x, y, dir)
Initialize a new turtle or reinitialize a turtle after JXG.Turtle#clearScreen.
Parameters:
x
y
dir

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

{JXG.Turtle} lookTo(target)
Rotates the turtle into a new direction. There are two possibilities:
Parameters:
{Number|Array} target
If a number is given, it is interpreted as the new direction to look to; If an array consisting of two Numbers is given targeted is used as a pair coordinates.
Returns:
{JXG.Turtle} pointer to the turtle object

lt(angle)
Alias for #left
Parameters:
angle

maxX()
Gives the upper bound of the parameter if the the turtle is treated as parametric curve. May be overwritten in @see generateTerm.

minX()
Gives the lower bound of the parameter if the the turtle is treated as parametric curve.

{JXG.Turtle} moveTo(target)
Moves the turtle to a given coordinate pair. The direction is not changed.
Parameters:
{Array} target
Coordinates of the point where the turtle looks to.
Returns:
{JXG.Turtle} pointer to the turtle object

pd()
Alias for #penDown

{JXG.Turtle} penDown()
Pen down, continues visible drawing
Returns:
{JXG.Turtle} pointer to the turtle object

{JXG.Turtle} penUp()
Pen up, stops visible drawing
Returns:
{JXG.Turtle} pointer to the turtle object

pop()
Alias for #popTurtle

{JXG.Turtle} 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:
{JXG.Turtle} pointer to the turtle object

pu()
Alias for #penUp

push()
Alias for #pushTurtle

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

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

rt(angle)
Alias for #right
Parameters:
angle

{JXG.Turtle} setAttribute(attributes)
Sets properties of the turtle, see also JXG.GeometryElement#setAttribute. Sets the property for all curves of the turtle in the past and in the future.
Parameters:
{Object} attributes
key:value pairs
Returns:
{JXG.Turtle} pointer to the turtle object

{JXG.Turtle} setHighlightPenColor(color)
Sets the highlight pen color. Equivalent to setAttribute({highlightStrokeColor:color}) but affects only the future turtle.
Parameters:
{String} color
Returns:
{JXG.Turtle} pointer to the turtle object

{JXG.Turtle} setPenColor(color)
Sets the pen color. Equivalent to setAttribute({strokeColor:color}) but affects only the future turtle.
Parameters:
{String} color
Returns:
{JXG.Turtle} pointer to the turtle object

{JXG.Turtle} setPenSize(size)
Sets the pen size. Equivalent to setAttribute({strokeWidth:size}) but affects only the future turtle.
Parameters:
{Number} size
Returns:
{JXG.Turtle} pointer to the turtle object

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

{JXG.Turtle} showTurtle()
Sets the visibility of the turtle head to true,
Returns:
{JXG.Turtle} pointer to the turtle object

st()
Alias for #showTurtle

{Number} X(t)
if t is not supplied the x-coordinate of the turtle is returned. Otherwise the x-coordinate of the turtle curve at position t is returned.
Parameters:
{Number} t
parameter
Returns:
{Number} x-coordinate of the turtle position or x-coordinate of turtle at position t

{Number} Y(t)
if t is not supplied the y-coordinate of the turtle is returned. Otherwise the y-coordinate of the turtle curve at position t is returned.
Parameters:
{Number} t
parameter
Returns:
{Number} x-coordinate of the turtle position or x-coordinate of turtle at position t

{Number} Z(t)
Parameters:
t
Returns:
{Number} z-coordinate of the turtle position

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Sep 27 2013 11:32:44 GMT+0200 (CEST)