# JSXGraph Reference

## 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

- Angle
- Arc
- Arrow
- Arrowparallel
- Axis
- Bisector
- Bisectorlines
- Circle
- Circumcenter
- Circumcircle
- CircumcircleArc
- Circumcirclesector
- Conic
- Curve
- Ellipse
- Functiongraph
- Glider
- Grid
- Hyperbola
- Image
- Incenter
- Incircle
- Integral
- Intersection
- Line
- Locus
- Midpoint
- Mirrorpoint
- Normal
- Orthogonalprojection
- OtherIntersection
- Parabola
- Parallel
- Parallelpoint
- Perpendicular
- Perpendicularpoint
- Point
- Polygon
- Reflection
- RegularPolygon
- Riemannsum
- Sector
- Segment
- Semicircle
- Slider
- Tangent
- Text
- Ticks
- Tracecurve

## Classes

- _global_
- JXG
- JXG.AbstractRenderer
- JXG.Board
- JXG.C
- JXG.CanvasRenderer
- JXG.Circle
- JXG.Complex
- JXG.Composition
- JXG.Coords
- JXG.Curve
- JXG.Dump
- JXG.GeometryElement
- JXG.GeonextParser
- JXG.Group
- JXG.Image
- JXG.JessieCode
- JXG.JSXGraph
- JXG.Line
- JXG.Math
- JXG.Math.Geometry
- JXG.Math.Numerics
- JXG.Math.Poly
- JXG.Math.Poly.Monomial
- JXG.Math.Poly.Polynomial
- JXG.Math.Poly.Ring
- JXG.Math.Statistics
- JXG.Math.Symbolic
- JXG.Point
- JXG.Polygon
- JXG.Server
- JXG.Server.modules
- JXG.SVGRenderer
- JXG.Text
- JXG.Ticks
- JXG.Turtle
- JXG.Util
- JXG.VMLRenderer

# 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(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
| clean() Removes the turtle curve from the board.
| clearScreen() Removes the turtle completely and resets it to its initial position and direction.
<private> | copyAttr(key, value) 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(length) Move the turtle forward.
| hasPoint(x, y, Find) Checks whether (x,y) is near the curve.
| hideTurtle() 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 #clearscreen.
| 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
| 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(x, y) Moves the turtle to a given coordinate pair.
| pd() Alias for #penDown
| penDown() Pen down, continues visible drawing
| penUp() Pen up, stops visible drawing
| 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.
| pu() Alias for #penUp
| push() Alias for #pushTurtle
| pushTurtle() Pushes the position of the turtle on the stack.
| right(angle) Rotate the turtle direction to the right
| rt(angle) Alias for #right
| setHighlightPenColor(color) 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.
| showTurtle() 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(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

<private> copyAttr(key, value)
Set a future attribute of the turtle.

Parameters:
{String} key
{Object} value
  (number, string)

Returns:
  pointer to an attributes object

cs()
Alias for #clearScreen

{float} evalAt(t)
the "co"-coordinate of the turtle curve at position t is returned.

Parameters:
{float} t
  parameter
{string} coordinate.
  Either 'X' or 'Y'.

Returns:
  {float} x-coordinate of the turtle position or x-coordinate of turtle at position t

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

<private> init(x, y, dir)
Initialize a new turtle or reinitialize a turtle after #clearscreen.

Parameters:
x
y
dir

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

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.

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}) but affects only the future turtle.

Parameters:
{string} color

Returns:
  pointer to the turtle object

setPenColor(color)
Sets the pen color. Equivalent to setProperty({strokeColor:color}) but affects only the future turtle.

Parameters:
{string} color

Returns:
  pointer to the turtle object

setPenSize(size)
Sets the pen size. Equivalent to setProperty({strokeWidth:size}) but affects only the future turtle.

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 in the past and in the future.

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

{float} 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:
{float} t
  parameter

Returns:
  {float} x-coordinate of the turtle position or x-coordinate of turtle at position t

{float} 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:
{float} t
  parameter

Returns:
  {float} x-coordinate of the turtle position or x-coordinate of turtle at position t

{float} Z(t)

Parameters:
{float} t

Returns:
  z-coordinate of the turtle position

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Apr 02 2012 17:54:10 GMT+0200 (MESZ)