# JSXGraph 1.7.0 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

Classes

- _global_
- Angle
- Arc
- Arrow
- Arrowparallel
- Axis
- Bisector
- Bisectorlines
- Boxplot
- Button
- Cardinalspline
- Chart
- Checkbox
- Circle
- Circumcenter
- Circumcircle
- CircumcircleArc
- CircumcircleSector
- Comb
- Conic
- Curve
- Curve3D
- CurveDifference
- CurveIntersection
- CurveUnion
- Derivative
- Ellipse
- ForeignObject
- Functiongraph
- Functiongraph3D
- Glider
- Grid
- Group
- Hatch
- Hyperbola
- Image
- ImplicitCurve
- Incenter
- Incircle
- Inequality
- Input
- Integral
- Intersection
- JXG
- JXG.AbstractRenderer
- JXG.Board
- JXG.Board.infobox
- JXG.C
- JXG.CA
- JXG.CanvasRenderer
- JXG.Chart
- JXG.Circle
- JXG.Complex
- JXG.Composition
- JXG.Coords
- JXG.CoordsElement
- JXG.Curve
- JXG.Curve3D
- JXG.Dump
- JXG.EventEmitter
- JXG.Expect
- JXG.ForeignObject
- JXG.GeometryElement
- JXG.GeometryElement3D
- JXG.GeonextParser
- JXG.Group
- JXG.Image
- JXG.JessieCode
- JXG.JSXGraph
- JXG.Legend
- JXG.Line
- JXG.Line3D
- JXG.Math
- JXG.Math.BoxQuadtree
- JXG.Math.Clip
- JXG.Math.Extrapolate
- JXG.Math.Geometry
- JXG.Math.ImplicitPlot
- JXG.Math.IntervalArithmetic
- JXG.Math.Metapost
- JXG.Math.Nlp
- JXG.Math.Numerics
- JXG.Math.Plot
- JXG.Math.Poly
- JXG.Math.Poly.Monomial
- JXG.Math.Poly.Polynomial
- JXG.Math.Poly.Ring
- JXG.Math.ProbFuncs
- JXG.Math.Quadtree
- JXG.Math.Statistics
- JXG.Math.Symbolic
- JXG.NoRenderer
- JXG.Options
- JXG.Plane3D
- JXG.Point
- JXG.Point3D
- JXG.Polygon
- JXG.PrefixParser
- JXG.Server
- JXG.Server.modules
- JXG.Surface3D
- JXG.SVGRenderer
- JXG.Text
- JXG.Ticks
- JXG.Transformation
- JXG.Turtle
- JXG.Util
- JXG.Util.Base64
- JXG.Util.Unzip
- JXG.Util.UTF8
- JXG.View3D
- JXG.VMLRenderer
- JXG.XML
- Label
- Legend
- Line
- Line3D
- Locus
- MajorArc
- MajorSector
- Measurement
- Metapostspline
- Midpoint
- MinorArc
- MinorSector
- mirrorelement
- Mirrorpoint
- NonReflexAngle
- Normal
- Orthogonalprojection
- OtherIntersection
- Parabola
- Parallel
- Parallelogram
- Parallelpoint
- ParametricSurface3D
- Perpendicular
- PerpendicularPoint
- PerpendicularSegment
- Point
- Point3D
- PolarLine
- PolePoint
- Polygon
- PolygonalChain
- RadicalAxis
- Reflection
- ReflexAngle
- RegularPolygon
- Riemannsum
- Sector
- Segment
- Semicircle
- Slider
- Slopefield
- Slopetriangle
- Smartlabel
- Spline
- Stepfunction
- Tangent
- Tapemeasure
- Text
- Ticks
- Tracecurve
- Transformation
- Turtle
- Vectorfield
- Vectorfield3D
- View3D

# Namespace JXG.PrefixParser

↳ JXG.PrefixParser

Defined in: prefix.js.

Namespace Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| JXG.PrefixParser Prefix expression parser, i.e.

Method Summary
Method Attributes | Method Name and Description
--- | ---
<static> | JXG.PrefixParser.dimension(term) Determine the dimension of the resulting value, i.e.
<private> <static> | JXG.PrefixParser.getParents(term) Determine parent elements of a prefix expression.
<static> | JXG.PrefixParser.parse(term, action) Parse a prefix expression and apply an action.
<static> | JXG.PrefixParser.toPrefix(term) Convert a prefix expression into a new prefix expression in which JSXGraph elements have been replaced by their ids.

Namespace Detail
JXG.PrefixParser
Prefix expression parser, i.e. a poor man's parser. This is a simple prefix parser for measurements and expressions of measurements, see Measurement. An expression is given as

- array starting with an operator as first element, followed by one or more operands,
- number.

Possible operators are:

- '+', '-', '*', '/': binary operators
- 'Area', 'Radius', 'Value', 'V', 'L': arbitrary methods of JSXGraph elements, supplied as strings.
- 'exec': call a function

Possible operands are:

- numbers
- strings
- JSXGraph elements in case the operator is a method. Example: ['Area', circle] calls the method circle.Area().
- prefix expressions (for binary operators)
- 'exec': call functions. Example: ['exec', 'sin', ['V', slider]] computes 'Math.sin(slider.Value())'. As functions only functions in Math or JXG.Math are allowed.

Examples:

      ['+', 100, 200]

    var p1 = board.create('point', [1, 1]);
    var p2 = board.create('point', [1, 3]);
    var seg = board.create('segment', [[-2,-3], [-2, 3]]);

    // Valid prefix expression: ['L', seg]

    var p1 = board.create('point', [1, 1]);
    var p2 = board.create('point', [1, 3]);
    var seg = board.create('segment', [[-2,-3], [-2, 3]]);
    var ci = board.create('circle', [p1, 7]);

    // Valid prefix expression:  ['+', ['Radius', ci], ['L', seg]]

    var ang = board.create('angle', [[4, 0], [0, 0], [2, 2]]);
    // Valid prefix expression:  ['V', ang, 'degrees']);

Method Detail
<static> JXG.PrefixParser.dimension(term)
Determine the dimension of the resulting value, i.e. ['L', obj] as well as ['+', ['L', obj1], ['L', obj2]] have dimension 1.

['+', ['Area', obj1], ['L', obj2]] will retrun NaN, because the two operands have conflicting dimensions.

If an element is a measurement element, then it's dimension can be set as attribute. This overrules the computed dimension.

Parameters:
{Array|Number} term
  Prefix expression

Returns:
  Number

<private> <static> JXG.PrefixParser.getParents(term)
Determine parent elements of a prefix expression.

Parameters:
{Array|Number} term
  prefix expression

Returns:
  Array

<static> {Number} JXG.PrefixParser.parse(term, action)
Parse a prefix expression and apply an action.

Parameters:
{array|number} term
  Expression
{String} action
  Determines what to do. So far, the only action available is 'execute', which evaluates the expression.

Returns:
  {Number} What ever the action does.

<static> {Array|Number} JXG.PrefixParser.toPrefix(term)
Convert a prefix expression into a new prefix expression in which JSXGraph elements have been replaced by their ids.

Parameters:
{Array|Number} term

Returns:
  {Array|Number}

Documentation generated by JsDoc Toolkit 2.4.0 on Thu Feb 15 2024 17:48:02 GMT+0000 (Coordinated Universal Time)