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.
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.
|
Field Attributes | Field Name and Description |
---|---|
The curveType is set in @see generateTerm and used in JXG.Curve#updateCurve.
|
|
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 Attributes | Field Name and Description |
---|---|
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 Attributes | Method Name and Description |
---|---|
addTransform(transform)
Add transformations to this curve.
|
|
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
|
|
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 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.
|
|
Updates the visual contents of the curve.
|
|
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
Defined in: Options.js.
- 'none'
- 'plot': Data plot
- 'parameter': we can not distinguish function graphs and parameter curves
- 'functiongraph': function graph
- 'polar'
- 'implicit' (not yet)
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.
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.
{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