Element Curve
JXG.GeometryElement
↳ JXG.Curve
↳ Curve
This element is used to provide a constructor for curve, which is just a wrapper for element Curve. A curve is a mapping from R to R^2. t mapsto (x(t),y(t)). The graph is drawn for t in the interval [a,b].
The following types of curves can be plotted:
- parametric curves: t mapsto (x(t),y(t)), where x() and y() are univariate functions.
- polar curves: curves commonly written with polar equations like spirals and cardioids.
- data plots: plot linbe segments through a given list of coordinates.
Defined in: curve.js.
Extends JXG.Curve.
Constructor Attributes | Constructor Name and Description |
---|---|
- Methods borrowed from class JXG.Curve:
- addTransform, allocatePoints, checkReal, generateTerm, hasPoint, interpolationFunctionFromArray, isDistOK, isSegmentOutside, maxX, minX, notifyParents, setPosition, setPositionDirectly, update, updateCurve, updateDataArray, updateParametricCurve, updateParametricCurveNaive, updateRenderer, updateTransform, Z
- Methods borrowed from class JXG.GeometryElement:
- _set, addChild, addDescendants, addRotation, animate, bounds, clearTrace, cloneToBackground, countChildren, createGradient, createLabel, draggable, generatePolynomial, getAttribute, getAttributes, getLabelAnchor, getName, getParents, getTextAnchor, getType, hideElement, labelColor, noHighlight, normalize, off, on, prepareUpdate, remove, removeChild, removeDescendants, resolveShortcuts, setArrow, setAttribute, setDash, setLabelText, showElement, triggerEventHandlers
- Events borrowed from class JXG.GeometryElement:
- attribute, attribute:<attribute><attribute>, down, drag, mousedown, mousedrag, mousemove, mouseout, mouseover, mouseup, move, out, over, touchdown, touchdrag, touchup, up
-
This element has no direct constructor. To create an instance of this element you have to call JXG.Board#create
with type "curve".
- Possible parent array combinations are:
-
{function|number} x
{function|number} y
{function|number} a Optional
{function|number} b Optional
- Parent elements for Parametric Curves.
x describes the x-coordinate of the curve. It may be a function term in one variable, e.g. x(t). In case of x being of type number, x(t) is set to a constant function. this function at the values of the array.
y describes the y-coordinate of the curve. In case of a number, y(t) is set to the constant function returning this number.
Further parameters are an optional number or function for the left interval border a, and an optional number or function for the right interval border b.
Default values are a=-10 and b=10.
-
{array} x
{array|function|number} y
- Parent elements for Data Plots.
x and y are arrays contining the x and y coordinates of the data points which are connected by line segments. The individual entries of x and y may also be functions. In case of x being an array the curve type is data plot, regardless of the second parameter and if additionally the second parameter y is a function term the data plot evaluates.
-
{function} r
{array|function|number} offset Optional
{function|number} a Optional
{function|number} b Optional
- Parent elements for Polar Curves.
The first parameter is a function term r(phi) describing the polar curve.
The second parameter is the offset of the curve. It has to be an array containing numbers or functions describing the offset. Default value is the origin [0,0].
Further parameters are an optional number or function for the left interval border a, and an optional number or function for the right interval border b.
Default values are a=-10 and b=10.
- See:
- JXG.Curve
- Examples:
// Parametric curve // Create a curve of the form (t-sin(t), 1-cos(t), i.e. // the cycloid curve. var graph = board.create('curve', [function(t){ return t-Math.sin(t);}, function(t){ return 1-Math.cos(t);}, 0, 2*Math.PI] );
// Data plots // Connect a set of points given by coordinates with dashed line segments. // The x- and y-coordinates of the points are given in two separate // arrays. var x = [0,1,2,3,4,5,6,7,8,9]; var y = [9.2,1.3,7.2,-1.2,4.0,5.3,0.2,6.5,1.1,0.0]; var graph = board.create('curve', [x,y], {dash:2});
// Polar plot // Create a curve with the equation r(phi)= a*(1+phi), i.e. // a cardioid. var a = board.create('slider',[[0,2],[2,2],[0,1,2]]); var graph = board.create('curve', [function(phi){ return a.Value()*(1-Math.cos(phi));}, [1,0], 0, 2*Math.PI] );
- Attributes borrowed from class JXG.Curve:
- curveType, handDrawing
- Attributes borrowed from class JXG.GeometryElement:
- dash, draft, fillColor, fillOpacity, fixed, frozen, highlight, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, needsRegularUpdate, scalable, shadow, snapToGrid, strokeColor, strokeOpacity, strokeWidth, trace, traceAttributes, visible, withLabel
- Fields borrowed from class JXG.Curve:
- numberPoints
- Fields borrowed from class JXG.GeometryElement:
- _pos, addEvent, ancestors, baseElement, board, childElements, descendants, dump, elementClass, elType, eventHandlers, getProperty, hasLabel, highlighted, id, isDraggable, isReal, lastDragTime, methodMap, mouseover, name, needsUpdate, notExistingParents, numTraces, quadraticform, removeEvent, rendNode, setProperty, stdform, subs, symbolic, traces, transformations, type, visProp
- Methods borrowed from class JXG.Curve:
- addTransform, allocatePoints, checkReal, generateTerm, hasPoint, interpolationFunctionFromArray, isDistOK, isSegmentOutside, maxX, minX, notifyParents, setPosition, setPositionDirectly, update, updateCurve, updateDataArray, updateParametricCurve, updateParametricCurveNaive, updateRenderer, updateTransform, Z
- Methods borrowed from class JXG.GeometryElement:
- _set, addChild, addDescendants, addRotation, animate, bounds, clearTrace, cloneToBackground, countChildren, createGradient, createLabel, draggable, generatePolynomial, getAttribute, getAttributes, getLabelAnchor, getName, getParents, getTextAnchor, getType, hideElement, labelColor, noHighlight, normalize, off, on, prepareUpdate, remove, removeChild, removeDescendants, resolveShortcuts, setArrow, setAttribute, setDash, setLabelText, showElement, triggerEventHandlers