# 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

# Class JXG.View3D

JXG.GeometryElement
↳ JXG.View3D

Creates a new 3D view. Do not use this constructor to create a 3D view. Use JXG.Board#create with type View3D instead.
Defined in: view3d.js.
Extends JXG.GeometryElement.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| JXG.View3D(parents, parents, attributes) 3D view inside of a JXGraph board.

Fields borrowed from class JXG.GeometryElement:
  _org_type, _pos, ancestors, baseElement, board, childElements, dash, dashScale, descendants, draft, dragToTopOfLayer, dump, elementClass, elType, fillColor, fillOpacity, fixed, frozen, gradient, gradientAngle, gradientCX, gradientCY, gradientEndOffset, gradientFR, gradientFX, gradientFY, gradientR, gradientSecondColor, gradientSecondOpacity, gradientStartOffset, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, inherits, isDraggable, isLabel, isReal, lastDragTime, layer, lineCap, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, parents, precision, priv, quadraticform, rendNode, rotatable, scalable, shadow, snapToGrid, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, tabindex, trace, traceAttributes, traces, transformations, transitionDuration, transitionProperties, type, viewport, visible, visProp, visPropCalc, withLabel

Field Summary
Field Attributes | Field Name and Description
--- | ---
| az_slide Slider to adapt azimuth angle
| bbox3D Bounding box (cube) [[x1, x2], [y1,y2], [z1,z2]] of the 3D view
| defaultAxes Default axes of the 3D view, contains the axes of the view or null.
| el_slide Slider to adapt elevation angle
<private> | elementsByName An associative array / dictionary to store the objects of the board by name.
<private> | llftCorner
<private> | matrix3D
<private> | objects An associative array containing all geometric objects belonging to the view.
| r Distance of the view to the origin.
<private> | size Width and height [w, h] of the 3D view if elevation and azimuth are set to 0.

Fields borrowed from class JXG.GeometryElement:
  _org_type, _pos, ancestors, baseElement, board, childElements, dash, dashScale, descendants, draft, dragToTopOfLayer, dump, elementClass, elType, fillColor, fillOpacity, fixed, frozen, gradient, gradientAngle, gradientCX, gradientCY, gradientEndOffset, gradientFR, gradientFX, gradientFY, gradientR, gradientSecondColor, gradientSecondOpacity, gradientStartOffset, hasLabel, highlight, highlighted, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, id, inherits, isDraggable, isLabel, isReal, lastDragTime, layer, lineCap, methodMap, mouseover, name, needsRegularUpdate, needsUpdate, notExistingParents, numTraces, parents, precision, priv, quadraticform, rendNode, rotatable, scalable, shadow, snapToGrid, stdform, strokeColor, strokeOpacity, strokeWidth, subs, symbolic, tabindex, trace, traceAttributes, traces, transformations, transitionDuration, transitionProperties, type, viewport, visible, visProp, visPropCalc, withLabel

Method Summary
Method Attributes | Method Name and Description
--- | ---
| animateAzimuth()
| create(elementType, parents, attributes) Creates a new 3D element of type elementType.
<private> | getMesh(func, interval_u, interval_v) Generate mesh for a surface / plane.
| intersectionLineCube(p, d, r) Intersect a ray with the bounding cube of the 3D view.
| intersectionPlanePlane(plane1, plane2, d)
| isInCube(q) Test if coordinates are inside of the bounding cube.
<private> | isVerticalDrag() Check if vertical dragging is enabled and which action is needed.
| project2DTo3DPlane(point2d, normal, foot) Project a 2D coordinate to the plane defined by point "foot" and the normal vector `normal`.
| project2DTo3DVertical(point2d, coords3D) Project a 2D coordinate to a new 3D position by keeping the 3D x, y coordinates and changing only the z coordinate.
| project3DTo2D(x, y, z) Project 3D coordinates to 2D board coordinates The 3D coordinates are provides as three numbers x, y, z or one array of length 3.
| project3DToCube(c3d) Limit 3D coordinates to the bounding cube.
| select(str, onlyByIdOrName) Select a single or multiple elements at once.
| stopAzimuth()

Methods borrowed from class JXG.GeometryElement:
  _set, addChild, addDescendants, addParents, addParentsFromJCFunctions, addRotation, addTicks, addTransform, animate, bounds, clearTrace, cloneToBackground, countChildren, createGradient, createLabel, draggable, formatNumberLocale, fullUpdate, generatePolynomial, getAttribute, getAttributes, getLabelAnchor, getName, getParents, getProperty, getSnapSizes, getTextAnchor, getType, handleSnapToGrid, hasPoint, hide, hideElement, noHighlight, normalize, prepareUpdate, remove, removeAllTicks, removeChild, removeDescendants, removeTicks, resolveShortcuts, setArrow, setAttribute, setDash, setDisplayRendNode, setLabel, setLabelText, setName, setParents, setPosition, setPositionDirectly, setProperty, show, showElement, snapToPoints, update, updateRenderer, updateVisibility, useLocale

Events borrowed from class JXG.GeometryElement:
  attribute, attribute:key, down, drag, keydrag, mousedown, mousedrag, mousemove, mouseout, mouseover, mouseup, move, out, over, pendown, pendrag, penup, touchdown, touchdrag, touchup, up

Class Detail
JXG.View3D(parents, parents, attributes)
3D view inside of a JXGraph board.

Parameters:
{Array} parents
  Array consisting of lower left corner [x, y] of the view inside the board, [width, height] of the view and box size [[x1, x2], [y1,y2], [z1,z2]]. If the view's azimuth=0 and elevation=0, the 3D view will cover a rectangle with lower left corner [x,y] and side lengths [w, h] of the board.
parents
attributes

Field Detail
az_slide
Slider to adapt azimuth angle

{array} bbox3D
Bounding box (cube) [[x1, x2], [y1,y2], [z1,z2]] of the 3D view

defaultAxes
Default axes of the 3D view, contains the axes of the view or null.

Default Value:
  null

el_slide
Slider to adapt elevation angle

<private> {Object} elementsByName
An associative array / dictionary to store the objects of the board by name. The name of the object is the key and value is a reference to the object.

<private> {array} llftCorner

<private> matrix3D

<private> {Object} objects
An associative array containing all geometric objects belonging to the view. Key is the id of the object and value is a reference to the object.

{Number} r
Distance of the view to the origin. In other words, its the radius of the sphere where the camera sits.view.board.update

<private> {array} size
Width and height [w, h] of the 3D view if elevation and azimuth are set to 0.
Method Detail
animateAzimuth()

{Object} create(elementType, parents, attributes)
Creates a new 3D element of type elementType.

Parameters:
{String} elementType
  Type of the element to be constructed given as a string e.g. 'point3d' or 'surface3d'.
{Array} parents
  Array of parent elements needed to construct the element e.g. coordinates for a 3D point or two 3D points to construct a line. This highly depends on the elementType that is constructed. See the corresponding JXG.create* methods for a list of possible parameters.
{Object} attributes Optional
  An object containing the attributes to be set. This also depends on the elementType. Common attributes are name, visible, strokeColor.

Returns:
  {Object} Reference to the created element. This is usually a GeometryElement3D, but can be an array containing two or more elements.

<private> getMesh(func, interval_u, interval_v)
Generate mesh for a surface / plane. Returns array [dataX, dataY] for a JSXGraph curve's updateDataArray function.

Parameters:
{Array|Function} func
{Array} interval_u
{Array} interval_v

Returns:
  Array

Examples:

     var el = view.create('curve', [[], []]);
     el.updateDataArray = function () {
         var steps_u = Type.evaluate(this.visProp.stepsu),
              steps_v = Type.evaluate(this.visProp.stepsv),
              r_u = Type.evaluate(this.range_u),
              r_v = Type.evaluate(this.range_v),
              func, ret;

         if (this.F !== null) {
             func = this.F;
         } else {
             func = [this.X, this.Y, this.Z];
         }
         ret = this.view.getMesh(func,
             r_u.concat([steps_u]),
             r_v.concat([steps_v]));

         this.dataX = ret[0];
         this.dataY = ret[1];
     };

intersectionLineCube(p, d, r)
Intersect a ray with the bounding cube of the 3D view.

Parameters:
{Array} p
  3D coordinates [x,y,z]
{Array} d
  3D direction vector of the line (array of length 3)
{Number} r
  direction of the ray (positive if r > 0, negative if r < 0).

Returns:
  Affine ratio of the intersection of the line with the cube.

{Array} intersectionPlanePlane(plane1, plane2, d)

Parameters:
{JXG.Plane3D} plane1
{JXG.Plane3D} plane2
{JXG.Plane3D} d

Returns:
  {Array} of length 2 containing the coordinates of the defining points of of the intersection segment.

isInCube(q)
Test if coordinates are inside of the bounding cube.

Parameters:
{array} q
  3D coordinates [x,y,z] of a point.

Returns:
  Boolean

<private> isVerticalDrag()
Check if vertical dragging is enabled and which action is needed. Default is shiftKey.

Returns:
  Boolean

{Array} project2DTo3DPlane(point2d, normal, foot)
Project a 2D coordinate to the plane defined by point "foot" and the normal vector `normal`.

Parameters:
{JXG.Point} point2d
{Array} normal
{Array} foot

Returns:
  {Array} of length 4 containing the projected point in homogeneous coordinates.

{Array} project2DTo3DVertical(point2d, coords3D)
Project a 2D coordinate to a new 3D position by keeping the 3D x, y coordinates and changing only the z coordinate. All horizontal moves of the 2D point are ignored.

Parameters:
{JXG.Point} point2d
{Array} coords3D

Returns:
  {Array} of length 4 containing the projected point in homogeneous coordinates.

{Array} project3DTo2D(x, y, z)
Project 3D coordinates to 2D board coordinates The 3D coordinates are provides as three numbers x, y, z or one array of length 3.

Parameters:
{Number|Array} x
{Number[]} y
{Number[]} z

Returns:
  {Array} Array of length 3 containing the projection on to the board in homogeneous user coordinates.

project3DToCube(c3d)
Limit 3D coordinates to the bounding cube.

Parameters:
{Array} c3d
  3D coordinates [x,y,z]

Returns:
  Array with updated 3D coordinates.

{JXG.GeometryElement3D|JXG.Composition} select(str, onlyByIdOrName)
Select a single or multiple elements at once.

Parameters:
{String|Object|function} str
  The name, id or a reference to a JSXGraph 3D element in the 3D view. An object will be used as a filter to return multiple elements at once filtered by the properties of the object.
{Boolean} onlyByIdOrName
  If true (default:false) elements are only filtered by their id, name or groupId. The advanced filters consisting of objects or functions are ignored.

Returns:
  {JXG.GeometryElement3D|JXG.Composition}

Examples:

    // select the element with name A
    view.select('A');

    // select all elements with strokecolor set to 'red' (but not '#ff0000')
    view.select({
      strokeColor: 'red'
    });

    // select all points on or below the x/y plane and make them black.
    view.select({
      elType: 'point3d',
      Z: function (v) {
        return v <= 0;
      }
    }).setAttribute({color: 'black'});

    // select all elements
    view.select(function (el) {
      return true;
    });

stopAzimuth()

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