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

- Angle
- Arc
- Arrow
- Arrowparallel
- Axes3D
- Axis
- Axis3D
- Bisector
- Bisectorlines
- Boxplot
- Button
- Cardinalspline
- Chart
- Checkbox
- Circle
- Circle3D
- Circumcenter
- Circumcircle
- CircumcircleArc
- CircumcircleSector
- Comb
- Conic
- Curve
- Curve3D
- CurveDifference
- CurveIntersection
- CurveUnion
- Derivative
- Ellipse
- Face3D
- ForeignObject
- Functiongraph
- Functiongraph3D
- Glider
- Grid
- Group
- Hatch
- Hyperbola
- Image
- ImplicitCurve
- Incenter
- Incircle
- Inequality
- Input
- Integral
- Intersection
- IntersectionCircle3D
- IntersectionLine3D
- Label
- Legend
- Line
- Line3D
- MajorArc
- MajorSector
- Measurement
- Mesh3D
- Metapostspline
- Midpoint
- MinorArc
- MinorSector
- MirrorElement
- MirrorPoint
- NonReflexAngle
- Normal
- Orthogonalprojection
- OtherIntersection
- Parabola
- Parallel
- Parallelogram
- Parallelpoint
- ParametricSurface3D
- Perpendicular
- PerpendicularPoint
- PerpendicularSegment
- Plane3D
- Point
- Point3D
- PolarLine
- PolePoint
- Polygon
- Polygon3D
- PolygonalChain
- Polyhedron3D
- RadicalAxis
- Reflection
- ReflexAngle
- RegularPolygon
- Riemannsum
- Sector
- Segment
- Semicircle
- Slider
- Slopefield
- Slopetriangle
- Smartlabel
- Sphere3D
- Spline
- Stepfunction
- Tangent
- TangentTo
- Tapemeasure
- Text
- Text3D
- Ticks
- Ticks3D
- Tracecurve
- Transformation
- Transformation3D
- Turtle
- Vectorfield
- Vectorfield3D
- View3D

Classes

- _global_
- JXG
- JXG.AbstractRenderer
- JXG.Board
- JXG.Board.infobox
- JXG.C
- JXG.CA
- JXG.CanvasRenderer
- JXG.Chart
- JXG.Circle
- JXG.Circle3D
- JXG.Complex
- JXG.Composition
- JXG.Coords
- JXG.CoordsElement
- JXG.Curve
- JXG.Curve3D
- JXG.Dump
- JXG.EventEmitter
- JXG.Expect
- JXG.Face3D
- 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.NoRenderer
- JXG.Options
- JXG.Plane3D
- JXG.Point
- JXG.Point3D
- JXG.Polygon
- JXG.Polygon3D
- JXG.PrefixParser
- JXG.Sphere3D
- JXG.Surface3D
- JXG.SVGRenderer
- JXG.Text
- JXG.Text3D
- JXG.Ticks
- JXG.Transformation
- JXG.Turtle
- JXG.Util
- JXG.Util.Base64
- JXG.Util.Unzip
- JXG.Util.UTF8
- JXG.View3D
- JXG.VMLRenderer
- JXG.XML

# Element Polyhedron3D

JXG.GeometryElement
↳ JXG.GeometryElement3D
↳ Polyhedron3D

A polyhedron in a 3D view consists of faces.
Defined in: polyhedron3d.js.
Extends JXG.GeometryElement3D.

Element Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| Polyhedron3D Create a polyhedron in a 3D view consisting of faces.

Attributes Summary
Field Attributes | Field Name and Description
--- | ---
| fillColorArray Color array to define fill colors of faces cyclically.

Field Summary
Field Attributes | Field Name and Description
--- | ---
| def Contains the defining data of the polyhedron: Definitions of vertices and a list of vertices for each face.
| faces List of Face3D objects.
| numberFaces Number of faces

Methods borrowed from class JXG.GeometryElement:
  _set, addChild, addDescendants, addParents, addParentsFromJCFunctions, addRotation, addTicks, addTransform, animate, bounds, clearTrace, cloneToBackground, countChildren, createGradient, createLabel, draggable, eval, evalVisProp, 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

Element Detail
Polyhedron3D
Create a polyhedron in a 3D view consisting of faces. Faces can be 0-, 1- or 2-dimensional.

This element has no direct constructor. To create an instance of this element you have to call JXG.Board#create with type "polyhedron3d".
Possible parent array combinations are:
{} TODO

Throws:
{Exception}
  If the element cannot be constructed with the given parent objects an exception is thrown.

Examples:

    var box = [-4, 4];
    var view = board.create(
        'view3d',
        [[-5, -3], [8, 8],
        [box, box, box]],
        {
            projection: 'parallel',
            trackball: { enabled: false },
            depthOrder: {
                enabled: true
            },
            xPlaneRear: { visible: false },
            yPlaneRear: { visible: false },
            zPlaneRear: { fillOpacity: 0.2 }
        }
    );
    var cube = view.create('polyhedron3d', [
    [
        [-3, -3, -3],
        [3, -3, -3],
        [3, 3, -3],
        [-3, 3, -3],

        [-3, -3, 3],
        [3, -3, 3],
        [3, 3, 3],
        [-3, 3, 3]
    ],
    [
        [0, 1, 2, 3],
        [0, 1, 5, 4],
        [[1, 2, 6, 5], { fillColor: 'black', fillOpacity: 0.5, strokeWidth: 5 }],
        [2, 3, 7, 6],
        [3, 0, 4, 7],
        [4, 5, 6, 7]
    ]
    ], {
    fillColorArray: ['blue', 'red', 'yellow']
    });

    var box = [-4, 4];
    var view = board.create(
        'view3d',
        [[-5, -3], [8, 8],
        [box, box, box]],
        {
            projection: 'parallel',
            trackball: { enabled: false },
            depthOrder: {
                enabled: true
            },
            xPlaneRear: { visible: false },
            yPlaneRear: { visible: false },
            zPlaneRear: { fillOpacity: 0.2 }
        }
    );
    var aa = view.create('point3d', [-3, -3, -3], { name: 'A', layer: 12});
    var bb = view.create('point3d', [() => aa.X(), () => aa.Y(), 3], { name: 'B', fixed: true, layer: 12});
    var cube = view.create('polyhedron3d', [
        {
            a: 'A',
            b: [3, -3, -3],
            c: [3, 3, -3],
            d: [-3, 3, -3],

            e: bb,
            f: [3, -3, 3],
            g: [3, 3, 3],
            h: [-3, 3, 3]
        },
        [
            ['a', 'b', 'c', 'd'],
            ['a', 'b', 'f', 'e'],
            ['b', 'c', 'g', 'f'],
            ['c', 'd', 'h', 'g'],
            ['d', 'a', 'e', 'h'],
            ['e', 'f', 'g', 'h'],

            ['a', 'g'], // Edge
            ['f']       // Vertex
        ]
    ], {
        fillColorArray: ['blue', 'red', 'yellow'],
        fillOpacity: 0.4,
        layer: 12
    });
    cube.faces[6].setAttribute({ strokeWidth: 5 });
    cube.faces[7].setAttribute({ strokeWidth: 10 });

    var box = [-4, 4];
    var view = board.create(
        'view3d',
        [[-5, -3], [8, 8],
        [box, box, box]],
        {
            projection: 'parallel',
            trackball: { enabled: false },
            depthOrder: {
                enabled: true
            },
            xPlaneRear: { visible: false },
            yPlaneRear: { visible: false },
            zPlaneRear: { fillOpacity: 0.2 }
        }
    );
    var s = board.create('slider', [[-4, -6], [4, -6], [0, 2, 4]], { name: 's' });
    var cube = view.create('polyhedron3d', [
        [
            () => { let f = s.Value(); return [-f, -f, -f]; },
            () => { let f = s.Value(); return [f, -f, -f]; },
            () => { let f = s.Value(); return [f, f, -f]; },
            () => { let f = s.Value(); return [-f, f, -f]; },

            () => { let f = s.Value(); return [-f, -f, f]; },
            () => { let f = s.Value(); return [f, -f, f]; },
            () => { let f = s.Value(); return [f, f, f]; },
            // () => { let f = s.Value(); return [-f, f, f]; }
            [ () => -s.Value(),  () => s.Value(), () => s.Value() ]
        ],
        [
            [0, 1, 2, 3],
            [0, 1, 5, 4],
            [1, 2, 6, 5],
            [2, 3, 7, 6],
            [3, 0, 4, 7],
            [4, 5, 6, 7],
        ]
    ], {
        strokeWidth: 3,
        fillOpacity: 0.6,
        fillColorArray: ['blue', 'red', 'yellow'],
        shader: {
            enabled:false
        }
    });

    var box = [-4, 4];
    var view = board.create(
        'view3d',
        [[-5, -3], [8, 8],
        [box, box, box]],
        {
            projection: 'parallel',
            trackball: { enabled: false },
            depthOrder: {
                enabled: true
            },
            xPlaneRear: { visible: false },
            yPlaneRear: { visible: false },
            zPlaneRear: { fillOpacity: 0.2 }
        }
    );
    let rho = 1.6180339887;
    let vertexList = [
        [0, -1, -rho], [0, +1, -rho], [0, -1, rho], [0, +1, rho],
        [1, rho, 0], [-1, rho, 0], [1, -rho, 0], [-1, -rho, 0],
        [-rho, 0, 1], [-rho, 0, -1], [rho, 0, 1], [rho, 0, -1]
    ];
    let faceArray = [
        [4, 1, 11],
        [11, 1, 0],
        [6, 11, 0],
        [0, 1, 9],
        [11, 10, 4],
        [9, 1, 5],
        [8, 9, 5],
        [5, 3, 8],
        [6, 10, 11],
        [2, 3, 10],
        [2, 10, 6],
        [8, 3, 2],
        [3, 4, 10],
        [7, 8, 2],
        [9, 8, 7],
        [0, 9, 7],
        [4, 3, 5],
        [5, 1, 4],
        [0, 7, 6],
        [7, 2, 6]
    ];
    var ico = view.create('polyhedron3d', [vertexList, faceArray], {
    fillColorArray: [],
    fillOpacity: 1,
    strokeWidth: 0.1,
    layer: 12,
    shader: {
        enabled: true,
        type: 'angle',
        hue: 60,
        saturation: 90,
        minlightness: 60,
        maxLightness: 80
    }
    });

Attribute Detail
{Array} fillColorArray
Color array to define fill colors of faces cyclically. Alternatively, the fill color can be defined for each face individually.
Defined in: options3d.js.

Default Value:
  ['white', 'black']

Field Detail
{Object} def
Contains the defining data of the polyhedron: Definitions of vertices and a list of vertices for each face. This is pretty much the input given in the construction of the polyhedron plus internal data.

     polyhedron = {
         view: view,
         vertices: {},
         coords: {},
         coords2D: {},
         zIndex: {},
         faces: []
     };

{Array} faces
List of Face3D objects.

{Number} numberFaces
Number of faces

Attributes borrowed from other Elements

Attributes borrowed from class JXG.GeometryElement:
  aria, cssClass, dash, dashScale, draft, dragToTopOfLayer, element3D, fillColor, fillOpacity, fixed, frozen, gradient, gradientAngle, gradientCX, gradientCY, gradientEndOffset, gradientFR, gradientFX, gradientFY, gradientR, gradientSecondColor, gradientSecondOpacity, gradientStartOffset, highlight, highlightCssClass, highlightFillColor, highlightFillOpacity, highlightStrokeColor, highlightStrokeOpacity, highlightStrokeWidth, isLabel, layer, lineCap, needsRegularUpdate, nonnegativeOnly, precision, priv, rotatable, scalable, shadow, snapToGrid, strokeColor, strokeOpacity, strokeWidth, tabindex, trace, traceAttributes, transitionDuration, transitionProperties, visible, withLabel

Fields borrowed from other Elements

Fields borrowed from class JXG.GeometryElement3D:
  element2D, is3D, view
Fields borrowed from class JXG.GeometryElement:
  _org_type, _pos, ancestors, baseElement, board, childElements, descendants, dump, elementClass, elType, hasLabel, highlighted, id, inherits, isDraggable, isReal, lastDragTime, methodMap, mouseover, name, needsUpdate, notExistingParents, numTraces, parents, quadraticform, rendNode, stdform, subs, symbolic, traces, transformations, type, visProp, visPropCalc

Methods borrowed from other Elements

Methods borrowed from class JXG.GeometryElement:
  _set, addChild, addDescendants, addParents, addParentsFromJCFunctions, addRotation, addTicks, addTransform, animate, bounds, clearTrace, cloneToBackground, countChildren, createGradient, createLabel, draggable, eval, evalVisProp, 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 other Elements

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

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Apr 04 2025 09:22:42 GMT+0200 (Mitteleuropäische Sommerzeit)