# Namespace JXG.Math.Plot

↳ JXG.Math.Plot

Defined in: plot.js.

Namespace Summary
Constructor Attributes Constructor Name and Description

Functions for plotting of curves.
Field Summary
Field Attributes Field Name and Description
<static>
JXG.Math.Plot.criticalThreshold
If the absolute maximum of the set of differences is larger than criticalThreshold * median of these values, it is regarded as critical point.
<static>
JXG.Math.Plot.steps
Number of equidistant points where the function is evaluated
Method Summary
Method Attributes Method Name and Description
<private> <static>
JXG.Math.Plot._borderCase(curve, a, b, c, ta, tb, tc, depth)
Investigate a function term at the bounds of intervals where the function is not defined, e.g.
<private> <static>
JXG.Math.Plot._findStartPoint(curve, ta, b, tb, tb)
For a curve c(t) defined on the interval [ta, tb] find the first point which is in the visible area of the board (plus some outside margin).
<private> <static>
JXG.Math.Plot._getBorderPos(curve, a, b, c, ta, tb, tc, depth)
Investigate a function term at the bounds of intervals where the function is not defined, e.g.
<private> <static>
JXG.Math.Plot._getCuspPos(curve, ta, tb)
<private> <static>
JXG.Math.Plot._getJumpPos(curve, ta, tb)
<private> <static>
JXG.Math.Plot._getLimes(curve, a, tc, c, tb, b, may_be_special, depth, depth)
<private> <static>
JXG.Math.Plot._getLimits(curve, t)
<private> <static>
JXG.Math.Plot._insertLimesPoint(curve, pnt, t, depth, limes)
<private> <static>
JXG.Math.Plot._insertPoint(curve, pnt, t, depth, limes)
Add a point to the curve plot.
<private> <static>
JXG.Math.Plot._insertPoint_v2(pnt, pnt, t)
Add a point to the curve plot.
<private> <static>
JXG.Math.Plot._isOutside(a, ta, b, tb, board)
Decide if a path segment is too far from the canvas that we do not need to draw it.
<private> <static>
JXG.Math.Plot._isOutsidePoint(a, board)
Decide if a point of a curve is too far from the canvas that we do not need to draw it.
<private> <static>
JXG.Math.Plot._isUndefined(curve, a, ta, b, tb)
Test if the function is undefined on an interval: If the interval borders a and b are undefined, 20 random values are tested if they are undefined, too.
<private> <static>
JXG.Math.Plot._plotNonRecursive(curve, a, ta, b, tb, depth, delta)
Recursive interval bisection algorithm for curve plotting.
<private> <static>
JXG.Math.Plot._plotRecursive_v2(curve, a, ta, b, tb, depth, delta)
Recursive interval bisection algorithm for curve plotting.
<private> <static>
JXG.Math.Plot._triangleDists(a, b, c)
Compute distances in screen coordinates between the points ab, ac, cb, and cd, where d = (a + b)/2.
<static>
JXG.Math.Plot.checkReal(points)
Check if at least one point on the curve is finite and real.
<private> <static>
JXG.Math.Plot.isDistOK(dx, dy, MAXX, MAXY)
Compares the absolute value of dx with MAXX and the absolute value of dy with MAXY.
<private> <static>
JXG.Math.Plot.isSegmentDefined(x0, y0, x1, y1)
<private> <static>
JXG.Math.Plot.isSegmentOutside(x0, y0, x1, y1, board)
Crude and cheap test if the segment defined by the two points (x0, y0) and (x1, y1) is outside the viewport of the board.
<static>
JXG.Math.Plot.neighborhood_isNaN_v2(curve, t0)
Check if there is a single NaN function value at t0.
<static>
JXG.Math.Plot.updateParametricCurve(curve, mi, ma)
Updates the data points of a parametric curve, alias for JXG.Curve#updateParametricCurve_v2.
<static>
JXG.Math.Plot.updateParametricCurve_v2(curve, mi, ma)
Updates the data points of a parametric curve.
<static>
JXG.Math.Plot.updateParametricCurve_v3(curve, mi, ma)
Updates the data points of a parametric curve.
<static>
JXG.Math.Plot.updateParametricCurve_v4(curve, mi, ma)
Updates the data points of a parametric curve, plotVersion 4.
<static>
JXG.Math.Plot.updateParametricCurveNaive(curve, mi, ma, len)
Updates the data points of a parametric curve.
<static>
JXG.Math.Plot.updateParametricCurveOld(curve, mi, ma)
Updates the data points of a parametric curve.
Namespace Detail
JXG.Math.Plot
Functions for plotting of curves.
Field Detail
<static> JXG.Math.Plot.criticalThreshold
If the absolute maximum of the set of differences is larger than criticalThreshold * median of these values, it is regarded as critical point.
See:
JXG.Math.Plot#_criticalInterval

<static> JXG.Math.Plot.steps
Number of equidistant points where the function is evaluated
Method Detail
<private> <static> {JXG.Boolean} JXG.Math.Plot._borderCase(curve, a, b, c, ta, tb, tc, depth)
Investigate a function term at the bounds of intervals where the function is not defined, e.g. log(x) at x = 0. c is inbetween a and b
Parameters:
curve
JSXGraph curve element
{Array} a
Screen coordinates of the left interval bound
{Array} b
Screen coordinates of the right interval bound
{Array} c
Screen coordinates of the bisection point at (ta + tb) / 2
{Number} ta
Parameter which evaluates to a, i.e. [1, X(ta), Y(ta)] = a in screen coordinates
{Number} tb
Parameter which evaluates to b, i.e. [1, X(tb), Y(tb)] = b in screen coordinates
{Number} tc
(ta + tb) / 2 = tc. Parameter which evaluates to b, i.e. [1, X(tc), Y(tc)] = c in screen coordinates
{Number} depth
Actual recursion depth. The recursion stops if depth is equal to 0.
Returns:
{JXG.Boolean} true if the point is inserted and the recursion should stop, false otherwise.

<private> <static> {Array} JXG.Math.Plot._findStartPoint(curve, ta, b, tb, tb)
For a curve c(t) defined on the interval [ta, tb] find the first point which is in the visible area of the board (plus some outside margin).

This method is necessary to restrict the recursive plotting algorithm JXG.Curve._plotRecursive to the visible area and not waste recursion to areas far outside of the visible area.

This method can also be used to find the last visible point by reversing the input parameters.

Parameters:
curve
JSXGraph curve element
{Array} ta
Curve parameter of a.
{Array} b
Screen coordinates of the end point of the segment (unused)
{Array} tb
Curve parameter of b
tb
Returns:
{Array} Array of length two containing the screen ccordinates of the starting point and the curve parameter at this point.

<private> <static> {JXG.Boolean} JXG.Math.Plot._getBorderPos(curve, a, b, c, ta, tb, tc, depth)
Investigate a function term at the bounds of intervals where the function is not defined, e.g. log(x) at x = 0. c is inbetween a and b
Parameters:
curve
JSXGraph curve element
{Array} a
Screen coordinates of the left interval bound
{Array} b
Screen coordinates of the right interval bound
{Array} c
Screen coordinates of the bisection point at (ta + tb) / 2
{Number} ta
Parameter which evaluates to a, i.e. [1, X(ta), Y(ta)] = a in screen coordinates
{Number} tb
Parameter which evaluates to b, i.e. [1, X(tb), Y(tb)] = b in screen coordinates
{Number} tc
(ta + tb) / 2 = tc. Parameter which evaluates to b, i.e. [1, X(tc), Y(tc)] = c in screen coordinates
{Number} depth
Actual recursion depth. The recursion stops if depth is equal to 0.
Returns:
{JXG.Boolean} true if the point is inserted and the recursion should stop, false otherwise.

<private> <static> JXG.Math.Plot._getCuspPos(curve, ta, tb)
Parameters:
curve
JSXGraph curve element
{Number} ta
{Number} tb

<private> <static> JXG.Math.Plot._getJumpPos(curve, ta, tb)
Parameters:
curve
JSXGraph curve element
{Number} ta
{Number} tb

<private> <static> JXG.Math.Plot._getLimes(curve, a, tc, c, tb, b, may_be_special, depth, depth)
Parameters:
curve
JSXGraph curve element
{Array} a
{Number} tc
{Array} c
{Number} tb
{Array} b
{String} may_be_special
{Number} depth
depth

<private> <static> JXG.Math.Plot._getLimits(curve, t)
Parameters:
curve
JSXGraph curve element
{Number} t

<private> <static> JXG.Math.Plot._insertLimesPoint(curve, pnt, t, depth, limes)
Parameters:
curve
JSXGraph curve element
{*} pnt
{*} t
{*} depth
{*} limes

<private> <static> JXG.Math.Plot._insertPoint(curve, pnt, t, depth, limes)
Add a point to the curve plot. If the new point is too close to the previously inserted point, it is skipped. Used in JXG.Curve._plotRecursive.
Parameters:
curve
JSXGraph curve element
pnt
Coords to add to the list of points
t
depth
limes

<private> <static> JXG.Math.Plot._insertPoint_v2(pnt, pnt, t)
Add a point to the curve plot. If the new point is too close to the previously inserted point, it is skipped. Used in JXG.Curve._plotRecursive.
Parameters:
pnt
Coords to add to the list of points
pnt
t

<private> <static> {Boolean} JXG.Math.Plot._isOutside(a, ta, b, tb, board)
Decide if a path segment is too far from the canvas that we do not need to draw it.
Parameters:
{Array} a
Screen coordinates of the start point of the segment
{Array} ta
Curve parameter of a (unused).
{Array} b
Screen coordinates of the end point of the segment
{Array} tb
Curve parameter of b (unused).
board
Returns:
{Boolean} True if the segment is too far away from the canvas, false otherwise.

<private> <static> {Boolean} JXG.Math.Plot._isOutsidePoint(a, board)
Decide if a point of a curve is too far from the canvas that we do not need to draw it.
Parameters:
{Array} a
Screen coordinates of the point
board
Returns:
{Boolean} True if the point is too far away from the canvas, false otherwise.

<private> <static> JXG.Math.Plot._isUndefined(curve, a, ta, b, tb)
Test if the function is undefined on an interval: If the interval borders a and b are undefined, 20 random values are tested if they are undefined, too. Only if all values are undefined, we declare the function to be undefined in this interval.
Parameters:
curve
JSXGraph curve element
{Array} a
Screen coordinates of the left interval bound
{Number} ta
Parameter which evaluates to a, i.e. [1, X(ta), Y(ta)] = a in screen coordinates
{Array} b
Screen coordinates of the right interval bound
{Number} tb
Parameter which evaluates to b, i.e. [1, X(tb), Y(tb)] = b in screen coordinates

<private> <static> JXG.Math.Plot._plotNonRecursive(curve, a, ta, b, tb, depth, delta)
Recursive interval bisection algorithm for curve plotting. Used in JXG.Curve.updateParametricCurve.
Parameters:
curve
JSXGraph curve element
{Array} a
Screen coordinates of the left interval bound
{Number} ta
Parameter which evaluates to a, i.e. [1, X(ta), Y(ta)] = a in screen coordinates
{Array} b
Screen coordinates of the right interval bound
{Number} tb
Parameter which evaluates to b, i.e. [1, X(tb), Y(tb)] = b in screen coordinates
{Number} depth
Actual recursion depth. The recursion stops if depth is equal to 0.
{Number} delta
If the distance of the bisection point at (ta + tb) / 2 from the point (a + b) / 2 is less then delta, the segment [a,b] is regarded as straight line.
Returns:
Reference to the curve object.

<private> <static> JXG.Math.Plot._plotRecursive_v2(curve, a, ta, b, tb, depth, delta)
Recursive interval bisection algorithm for curve plotting. Used in JXG.Curve.updateParametricCurve.
Parameters:
curve
JSXGraph curve element
{Array} a
Screen coordinates of the left interval bound
{Number} ta
Parameter which evaluates to a, i.e. [1, X(ta), Y(ta)] = a in screen coordinates
{Array} b
Screen coordinates of the right interval bound
{Number} tb
Parameter which evaluates to b, i.e. [1, X(tb), Y(tb)] = b in screen coordinates
{Number} depth
Actual recursion depth. The recursion stops if depth is equal to 0.
{Number} delta
If the distance of the bisection point at (ta + tb) / 2 from the point (a + b) / 2 is less then delta, the segment [a,b] is regarded as straight line.
Returns:
Reference to the curve object.

<private> <static> {Array} JXG.Math.Plot._triangleDists(a, b, c)
Compute distances in screen coordinates between the points ab, ac, cb, and cd, where d = (a + b)/2. cd is used for the smoothness test, ab, ac, cb are used to detect jumps, cusps and poles.
Parameters:
{Array} a
Screen coordinates of the left interval bound
{Array} b
Screen coordinates of the right interval bound
{Array} c
Screen coordinates of the bisection point at (ta + tb) / 2
Returns:
{Array} array of distances in screen coordinates between: ab, ac, cb, and cd.

<static> JXG.Math.Plot.checkReal(points)
Check if at least one point on the curve is finite and real.
Parameters:
points

<private> <static> {Boolean} JXG.Math.Plot.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.

<private> <static> JXG.Math.Plot.isSegmentDefined(x0, y0, x1, y1)
Parameters:
x0
y0
x1
y1

<private> <static> {Boolean} JXG.Math.Plot.isSegmentOutside(x0, y0, x1, y1, board)
Crude and cheap test 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
board
Returns:
{Boolean} true if the given segment is outside the visible area.

<static> {Boolean} JXG.Math.Plot.neighborhood_isNaN_v2(curve, t0)
Check if there is a single NaN function value at t0.
Parameters:
{*} curve
{*} t0
Returns:
{Boolean} true if there is a second NaN point close by, false otherwise

<static> JXG.Math.Plot.updateParametricCurve(curve, mi, ma)
Updates the data points of a parametric curve, alias for JXG.Curve#updateParametricCurve_v2. This is needed for backwards compatibility, if this method has been used directly in an application.
Parameters:
curve
JSXGraph curve element
{Number} mi
Left bound of curve
{Number} ma
Right bound of curve
Returns:
Reference to the curve object.
See:
JXG.Curve#updateParametricCurve_v2

<static> JXG.Math.Plot.updateParametricCurve_v2(curve, mi, ma)
Updates the data points of a parametric curve. This version is used if JXG.Curve#plotVersion is 3.
Parameters:
curve
JSXGraph curve element
{Number} mi
Left bound of curve
{Number} ma
Right bound of curve
Returns:
Reference to the curve object.

<static> JXG.Math.Plot.updateParametricCurve_v3(curve, mi, ma)
Updates the data points of a parametric curve. This version is used if JXG.Curve#plotVersion is 3. This is an experimental plot version, not recommended to be used.
Parameters:
curve
JSXGraph curve element
{Number} mi
Left bound of curve
{Number} ma
Right bound of curve
Returns:
Reference to the curve object.

<static> JXG.Math.Plot.updateParametricCurve_v4(curve, mi, ma)
Updates the data points of a parametric curve, plotVersion 4. This version is used if JXG.Curve#plotVersion is 4.
Parameters:
curve
JSXGraph curve element
{Number} mi
Left bound of curve
{Number} ma
Right bound of curve
Returns:
Reference to the curve object.

<static> JXG.Math.Plot.updateParametricCurveNaive(curve, mi, ma, len)
Updates the data points of a parametric curve. This version is used if JXG.Curve#doadvancedplot is false.
Parameters:
curve
JSXGraph curve element
{Number} mi
Left bound of curve
{Number} ma
Right bound of curve
{Number} len
Number of data points
Returns:
Reference to the curve object.

<static> JXG.Math.Plot.updateParametricCurveOld(curve, mi, ma)
Updates the data points of a parametric curve. This version is used if JXG.Curve#doadvancedplot is true. Since 0.99 this algorithm is deprecated. It still can be used if JXG.Curve#doadvancedplotold is true.
Parameters:
curve
JSXGraph curve element
{Number} mi
Left bound of curve
{Number} ma
Right bound of curve
Returns:
Reference to the curve object.

Documentation generated by JsDoc Toolkit 2.4.0 on Fri May 27 2022 09:22:46 GMT+0200 (Mitteleuropäische Sommerzeit)