Class JXG.Curve
Extends
JXG.GeometryElement.
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.
Constructor Attributes | Constructor Name and Description |
---|---|
JXG.Curve(board, defining, id, name, show, layer)
Curves are the common object for function graphs, parametric curves, polar curves, adn data plots.
|
Field Attributes | Field Name and Description |
---|---|
The curveType is set in @see generateTerm and used in
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.
|
|
Use the algorithm by Gillam and Hohenwarter for plotting.
|
|
Number of points on curves.
|
|
Number of points on curves after mouseUp, i.e.
|
|
Number of points on curves after mousemove, i.e.
|
- Fields borrowed from class JXG.GeometryElement:
- ancestors, board, childElements, dash, descendants, draft, fillColor, fillOpacity, fixed, hasLabel, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, isReal, layer, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, quadraticform, shadow, stdform, strokeColor, strokeOpacity, strokeWidth, symbolic, trace, traces, transformations, visible, visProp
Method Attributes | Method Name and Description |
---|---|
Allocate points in the Coords array this.points
|
|
cloneToBackground(addToTrace)
Clone curve to the background.
|
|
generateTerm(varname, xterm, yterm, mi, ma)
Converts the GEONExT syntax of the defining function term into JavaScript.
|
|
Calculates LabelAnchor.
|
|
hasPoint(x, y, Find)
Checks whether (x,y) is near the curve.
|
|
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(term)
Finds dependencies in a given term and notifies the parents by adding the
dependent object to the found objects child elements.
|
|
update()
Computes for equidistant points on the x-axis the values
of the function, #updateCurve
Then, the update function of the renderer
is called.
|
|
Computes for equidistant points on the x-axis the values
of the function.
|
|
For dynamic dataplots updateCurve
can be used to compute new entries
for the arrays this.dataX and
this.dataY.
|
|
Then, the update function of the renderer
is called.
|
|
X(i)
|
|
Y(i)
|
- Methods borrowed from class JXG.GeometryElement:
- addChild, addLabelToElement, animate, clearTrace, hideElement, highlight, labelColor, noHighlight, remove, setArrow, setProperty, showElement
Class Detail
JXG.Curve(board, defining, id, name, show, layer)
Curves are the common object for function graphs, parametric curves, polar curves, adn data plots.
- Parameters:
- {string|JXG.Board} board
- The board the new curve is drawn on.
- {Array} defining
- terms An array with the functon terms, data points of the curve.
- {String} id
- Unique identifier for the point. If null or an empty string is given, an unique id will be generated by Board
- {String} name
- Not necessarily unique name for the point. If null or an empty string is given, an unique name will be generated
- {boolean} show
- False if the point is invisible, True otherwise
- layer
- See:
- JXG.Board#generateName
- JXG.Board#addCurve
Field Detail
curveType
The curveType is set in @see generateTerm and used in
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.
doAdvancedPlot
Use the algorithm by Gillam and Hohenwarter for plotting.
If false the naive algorithm is used.
It is much slower, but the result is better.
numberPoints
Number of points on curves. This value changes
between numberPointsLow and numberPointsHigh.
It is set in #updateCurve.
numberPointsHigh
Number of points on curves after mouseUp, i.e. high quality output.
Only used if this.doAdvancedPlot==false
May be overwritten.
numberPointsLow
Number of points on curves after mousemove, i.e. low quality output.
Only used if this.doAdvancedPlot==false
May be overwritten.
Method Detail
allocatePoints()
Allocate points in the Coords array this.points
cloneToBackground(addToTrace)
Clone curve to the background.
- Parameters:
- addToTrace
- Not used yet. Always true.
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().
Also, all objects whose name appears in the term are searched and
the curve is added as child to these objects. (Commented out!!!!)
- Parameters:
- varname
- xterm
- yterm
- mi
- ma
- See:
- Algebra
- #geonext2JS.
{JXG.Coords}
getLabelAnchor()
Calculates LabelAnchor.
- Returns:
- Text anchor coordinates as JXG.Coords 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.
maxX()
Gives the default value of the right bound for the curve.
May be overwritten in @see generateTerm.
minX()
Gives the default value of the left bound for the curve.
May be overwritten in @see generateTerm.
notifyParents(term)
Finds dependencies in a given term and notifies the parents by adding the
dependent object to the found objects child elements.
- Parameters:
- {String} term
- String containing dependencies for the given object.
update()
Computes for equidistant points on the x-axis the values
of the function, #updateCurve
Then, the update function of the renderer
is called.
updateCurve()
Computes for equidistant points on the x-axis the values
of the function. @see #update
If the mousemove event triggers this update, we use only few
points. Otherwise, e.g. on mouseup, many points are used.
updateDataArray()
For dynamic dataplots updateCurve
can be used to compute new entries
for the arrays this.dataX and
this.dataY. It is used in @see updateCurve.
Default is an empty method, can be overwritten
by the user.
updateRenderer()
Then, the update function of the renderer
is called.
X(i)
- Parameters:
- i
Y(i)
- Parameters:
- i