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

JXG.GeometryElement
↳ JXG.Curve

Creates a new curve object. Do not use this constructor to create a curve. Use JXG.Board#create with type Curve, or Functiongraph instead.
Defined in: Curve.js.
Extends JXG.GeometryElement.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| JXG.Curve(board, parents, attributes) Curves are the common object for function graphs, parametric curves, polar curves, and data plots.

Attributes Summary
Field Attributes | Field Name and Description
--- | ---
| curveType The curveType is set in @see generateTerm and used in JXG.Curve#updateCurve.
| handDrawing The data points of the curve are not connected with straight lines but with bezier curves.

Fields borrowed from class JXG.GeometryElement:
  addEvent, ancestors, baseElement, board, childElements, dash, descendants, draft, dump, elementClass, elType, eventHandlers, fillColor, fillOpacity, fixed, frozen, getAttribute, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, isDraggable, isReal, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, quadraticform, removeEvent, shadow, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, trace, traceAttributes, traces, transformations, type, visible, visProp, withLabel

Field Summary
Field Attributes | Field Name and Description
--- | ---
| numberPoints Number of points on curves.

Fields borrowed from class JXG.GeometryElement:
  addEvent, ancestors, baseElement, board, childElements, dash, descendants, draft, dump, elementClass, elType, eventHandlers, fillColor, fillOpacity, fixed, frozen, getAttribute, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, isDraggable, isReal, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, quadraticform, removeEvent, shadow, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, trace, traceAttributes, traces, transformations, type, visible, visProp, withLabel

Method Summary
Method Attributes | Method Name and Description
--- | ---
| addTransform(transform) Add transformations to this curve.
| allocatePoints() Allocate points in the Coords array this.points
| generateTerm(varname, xterm, yterm, mi, ma) Converts the GEONExT syntax of the defining function term into JavaScript.
| hasPoint(x, y) Checks whether (x,y) is near the curve.
| isDistOK(dx, dy, MAXX, MAXY) Compares the absolute value of `dx` with `MAXX` and the absolute value of `dy` with `MAXY`.
| isSegmentOutside(x0, y0, x1, y1) Determines if the segment defined by the two points `(x0, y0)` and `(x1, y1)` is outside the viewport of the board.
| maxX() Gives the default value of the right bound for the curve.
| minX() Gives the default value of the left bound for the curve.
| notifyParents(contentStr) Finds dependencies in a given term and notifies the parents by adding the dependent object to the found objects child elements.
| setPosition(method, x, y) Translates the object by `(x, y)`.
| update() Computes for equidistant points on the x-axis the values of the function
| updateCurve() Computes for equidistant points on the x-axis the values of the function.
| updateDataArray() For dynamic dataplots updateCurve can be used to compute new entries for the arrays JXG.Curve#dataX and JXG.Curve#dataY.
| updateParametricCurve(mi, ma, len) Updates the data points of a parametric curve.
| updateParametricCurveNaive(mi, ma, len) Updates the data points of a parametric curve.
| updateRenderer() Updates the visual contents of the curve.
| updateTransform(p) Applies the transformations of the curve to the given point `p`.
| X(t)
| Y(t)
| Z(t) Treat the curve as curve with homogeneous coordinates

Methods borrowed from class JXG.GeometryElement:
  _set, addChild, addDescendants, animate, bounds, clearTrace, cloneToBackground, countChildren, createGradient, createLabel, draggable, generatePolynomial, getAttributes, getLabelAnchor, getName, getParents, getProperty, getTextAnchor, getType, hideElement, labelColor, noHighlight, normalize, off, on, prepareUpdate, remove, resolveShortcuts, setArrow, setAttribute, setDash, setLabelText, setProperty, setStraight, showElement, triggerEventHandlers

Class Detail
JXG.Curve(board, parents, attributes)
Curves are the common object for function graphs, parametric curves, polar curves, and data plots.

Parameters:
{string|JXG.Board} board
  The board the new curve is drawn on.
{Array} parents
  defining terms An array with the functon terms or the data points of the curve.
{Object} attributes
  Defines the visual appearance of the curve.

See:
  JXG.Board#generateName
  JXG.Board#addCurve

Attribute Detail
curveType
The curveType is set in @see generateTerm and used in JXG.Curve#updateCurve. Possible values are

- 'none'
- 'plot': Data plot
- 'parameter': we can not distinguish function graphs and parameter curves
- 'functiongraph': function graph
- 'polar'
- 'implicit' (not yet)

Only parameter and plot are set directly. Polar is set with setProperties only.
Defined in: Options.js.

{Boolean} handDrawing
The data points of the curve are not connected with straight lines but with bezier curves.
Defined in: Options.js.

Default Value:
  false

Field Detail
numberPoints
Number of points on curves. This value changes between numberPointsLow and numberPointsHigh. It is set in JXG.Curve#updateCurve.
Method Detail
{JXG.Curve} addTransform(transform)
Add transformations to this curve.

Parameters:
{JXG.Transform|Array} transform
  Either one JXG.Transform or an array of JXG.Transforms.

Returns:
  {JXG.Curve} Reference to the curve object.

allocatePoints()
Allocate points in the Coords array this.points

generateTerm(varname, xterm, yterm, mi, ma)
Converts the GEONExT syntax of the defining function term into JavaScript. New methods X() and Y() for the Curve object are generated, further new methods for minX() and maxX().

Parameters:
varname
xterm
yterm
mi
ma

See:
  JXG.GeonextParser#geonext2JS.

{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.

{Boolean} isDistOK(dx, dy, MAXX, MAXY)
Compares the absolute value of `dx` with `MAXX` and the absolute value of `dy` with `MAXY`.

Parameters:
{Number} dx
{Number} dy
{Number} MAXX
{Number} MAXY

Returns:
  {Boolean} `true`, if `|dx| < MAXX` and `|dy| < MAXY`.

{Boolean} isSegmentOutside(x0, y0, x1, y1)
Determines if the segment defined by the two points `(x0, y0)` and `(x1, y1)` is outside the viewport of the board. All parameters have to be given in screen coordinates.

Parameters:
{Number} x0
{Number} y0
{Number} x1
{Number} y1

Returns:
  {Boolean} `true` if the given segment is outside the visible area.

{Number} maxX()
Gives the default value of the right bound for the curve. May be overwritten in JXG.Curve#generateTerm.

Returns:
  {Number} Right bound for the curve.

{Number} minX()
Gives the default value of the left bound for the curve. May be overwritten in JXG.Curve#generateTerm.

Returns:
  {Number} Left bound for the curve.

notifyParents(contentStr)
Finds dependencies in a given term and notifies the parents by adding the dependent object to the found objects child elements.

Parameters:
{String} contentStr
  String containing dependencies for the given object.

{JXG.Curve} setPosition(method, x, y)
Translates the object by `(x, y)`.

Parameters:
{null} method
  ignored
{Number} x
{Number} y

Returns:
  {JXG.Curve} Reference to the curve object.

{JXG.Curve} update()
Computes for equidistant points on the x-axis the values of the function

Returns:
  {JXG.Curve} Reference to the curve object.

See:
  JXG.Curve#updateCurve

{JXG.Curve} updateCurve()
Computes for equidistant points on the x-axis the values of the function. If the mousemove event triggers this update, we use only few points. Otherwise, e.g. on mouseup, many points are used.

Returns:
  {JXG.Curve} Reference to the curve object.

See:
  JXG.Curve#update

updateDataArray()
For dynamic dataplots updateCurve can be used to compute new entries for the arrays JXG.Curve#dataX and JXG.Curve#dataY. It is used in JXG.Curve#updateCurve. Default is an empty method, can be overwritten by the user.

{JXG.Curve} updateParametricCurve(mi, ma, len)
Updates the data points of a parametric curve. This version is used if JXG.Curve#visProp.doadvancedplot is `true`.

Parameters:
{Number} mi
  Left bound of curve
{Number} ma
  Right bound of curve
{Number} len
  Number of data points

Returns:
  {JXG.Curve} Reference to the curve object.

{JXG.Curve} updateParametricCurveNaive(mi, ma, len)
Updates the data points of a parametric curve. This version is used if JXG.Curve#visProp.doadvancedplot is `false`.

Parameters:
{Number} mi
  Left bound of curve
{Number} ma
  Right bound of curve
{Number} len
  Number of data points

Returns:
  {JXG.Curve} Reference to the curve object.

{JXG.Curve} updateRenderer()
Updates the visual contents of the curve.

Returns:
  {JXG.Curve} Reference to the curve object.

{JXG.Point} updateTransform(p)
Applies the transformations of the curve to the given point `p`.

Parameters:
{JXG.Point} p

Returns:
  {JXG.Point} The given point.

X(t)

Parameters:
t

Y(t)

Parameters:
t

{Number} Z(t)
Treat the curve as curve with homogeneous coordinates

Parameters:
{Number} t
  A number between 0.0 and 1.0.

Returns:
  {Number} Always 1.0

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