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

Element Line3D

JXG.GeometryElement
   ↳ JXG.GeometryElement3D
         ↳ Line3D

A line in 3D is given by two points, or one point and a direction vector.

Defined in: linspace3d.js.
Extends JXG.GeometryElement3D.

Element Summary
Constructor Attributes Constructor Name and Description
 
A line in 3D is given by two points, or one point and a direction vector.
Attributes Summary
Field Attributes Field Name and Description
 
Attributes of the defining point in case the line is defined by [point, vector, [range]]
 
Attributes of the first point in case the line is defined by [point, point].
 
Attributes of the second point in case the line is defined by [point, point].
 
If the 3D line is defined by two points and if this attribute is true, the 3D line stretches infinitely in direction of its first point.
 
If the 3D line is defined by two points and if this attribute is true, the 3D line stretches infinitely in direction of its second point.
Field Summary
Field Attributes Field Name and Description
 
Direction which - together with a point - defines the line.
 
Array of length 2 containing the endings of the Line3D element.
<private>  
Determine one end point of a 3D line from point, direction and range).
<static>  
Line3D.point
3D point which - together with a direction - defines the line.
 
Range [r1, r2] of the line.
 
vec
Spanning vector of the 3D line.
Method Summary
Method Attributes Method Name and Description
<private>  
Set the 2D position of the defining points.
<private>  
Update the array Line3D#vec containing the homogeneous coords of the spanning vector.
 
Update the z-index of the line, i.e.
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
Line3D
A line in 3D is given by two points, or one point and a direction vector. That is, there are the following two possibilities to create a Line3D object:
  1. The 3D line is defined by two 3D points (Point3D): The points can be either existing points or coordinate arrays of the form [x, y, z].

    The 3D line is defined by a point (or coordinate array [x, y, z]) a direction given as array [x, y, z] and an optional range given as array [s, e]. The default value for the range is [-Infinity, Infinity].

All numbers can also be provided as functions returning a number. The case [point, array] is ambiguous, it is not clear if 'array' contains the coordinates of a point or of a direction. In that case, 'array' is interpreted as the coordinate array of a point, i.e. the line is defined by two points.
This element has no direct constructor. To create an instance of this element you have to call JXG.Board#create with type "line3d".

Possible parent array combinations are:
{JXG.Point3D|array|function} point1
{JXG.Point3D|array|function} point2

First and second defining point of the line. The attributes Line3D#straightFirst and Line3D#straightLast control if the line is displayed as segment, ray or infinite line.


{JXG.Point3D|array|function} point
{JXG.Line3D|array|function} direction
{array|function} range

The line is defined by point, direction and range.
  • point: Point3D or array of length 3
  • direction: array of length 3 or function returning an array of numbers or function returning an array
  • range: array of length 2, elements can also be functions. Use [-Infinity, Infinity] for infinite lines.


Throws:
{Exception}
If the element cannot be constructed with the given parent objects an exception is thrown.
Examples:
    var bound = [-5, 5];
    var view = board.create('view3d',
        [[-6, -3], [8, 8],
        [bound, bound, bound]],
        {});
    var p = view.create('point3d', [1, 2, 2], { name:'A', size: 5 });
    // Lines through 2 points
    var l1 = view.create('line3d', [[1, 3, 3], [-3, -3, -3]], {point1: {visible: true}, point2: {visible: true} });
    var l2 = view.create('line3d', [p, l1.point1]);

    // Line by point, direction, range
    var l3 = view.create('line3d', [p, [0, 0, 1], [-2, 4]]);


				
				
    var view = board.create(
        'view3d',
        [[-6, -3], [8, 8],
        [[-3, 3], [-3, 3], [-3, 3]]],
        {
            depthOrder: {
                enabled: true
            },
            projection: 'central',
            xPlaneRear: {fillOpacity: 0.2},
            yPlaneRear: {fillOpacity: 0.2},
            zPlaneRear: {fillOpacity: 0.2}
        }
    );

    var A = view.create('point3d', [0, 0, 0], {size: 2});
    var B = view.create('point3d', [2, 1, 1], {size: 2});
    var C = view.create('point3d', [-2.5, 2.5, 1.5], {size: 2});

    // Draggable line by two points
    var line1 = view.create('line3d', [A, B], {
        fixed: false,
        straightFirst: true,
        straightLast: true,
        dash: 2
    });

    // Line by point, direction, and range
    var line2 = view.create('line3d', [C, [1, 0, 0], [-1, Infinity]], {
        strokeColor: 'blue'
    });

    // Line by point and array
    var line3 = view.create('line3d', [C, [-2.5, -1, 1.5]], {
        point2: { visible: true},
        strokeColor: 'red'
    });


				
				
 var view = board.create(
     'view3d',
     [[-6, -3], [8, 8],
     [[-3, 3], [-3, 3], [-3, 3]]],
     {
         depthOrder: {
             enabled: true
         },
         projection: 'parallel',
         xPlaneRear: { fillOpacity: 0.2 },
         yPlaneRear: { fillOpacity: 0.2 },
         zPlaneRear: { fillOpacity: 0.2 }
     }
 );


var A = view.create('point3d', [-2, 0, 1], { size: 2 });
var B = view.create('point3d', [-2, 0, 2], { size: 2 });
var line1 = view.create('line3d', [A, B], {
    fixed: false,
    strokeColor: 'blue',
    straightFirst: true,
    straightLast: true
});

var C = view.create('point3d', [2, 0, 1], { size: 2 });
var line2 = view.create('line3d', [C, line1, [-Infinity, Infinity]], { strokeColor: 'red' });


				
                
Attribute Detail
{Point3D} point
Attributes of the defining point in case the line is defined by [point, vector, [range]]
Defined in: options3d.js.
Default Value:
visible: false, name: ""

{Point3D} point1
Attributes of the first point in case the line is defined by [point, point].
Defined in: options3d.js.
Default Value:
visible: false, name: ""

{Point3D} point2
Attributes of the second point in case the line is defined by [point, point].
Defined in: options3d.js.
Default Value:
visible: false, name: ""

{Boolean} straightFirst
If the 3D line is defined by two points and if this attribute is true, the 3D line stretches infinitely in direction of its first point. Otherwise it ends at point1.
Defined in: options3d.js.
See:
Line3D#straightLast
Default Value:
false

{Boolean} straightLast
If the 3D line is defined by two points and if this attribute is true, the 3D line stretches infinitely in direction of its second point. Otherwise it ends at point2.
Defined in: options3d.js.
See:
Line3D#straightFirst
Default Value:
false
Field Detail
{Array|Function} direction
Direction which - together with a point - defines the line. Array of numbers or functions (of length 3) or function returning array of length 3.
See:
Line3D.point

endpoints
Array of length 2 containing the endings of the Line3D element. These are the defining points, the intersections of the line with the bounding box, or the endings defined by the range.

<private> {Array} getPointCoords
Determine one end point of a 3D line from point, direction and range).

<static> {Point3D} Line3D.point
3D point which - together with a direction - defines the line.
See:
Line3D#direction

{Array} range
Range [r1, r2] of the line. r1, r2 can be numbers or functions. The 3D line goes from (point + r1 * direction) to (point + r2 * direction)
Default Value:
[-Infinity, Infinity]

vec
Spanning vector of the 3D line. Contains the evaluated coordinates from direction and range. The array has length 4, the first entry being 0.
Method Detail
<private> setPosition2D(t)
Set the 2D position of the defining points.
Parameters:
{JXG.Transformation} t
projective 2D transformation

<private> {Object} updateCoords()
Update the array Line3D#vec containing the homogeneous coords of the spanning vector.
Returns:
{Object} Reference to Line3D object

{Object} updateZIndex()
Update the z-index of the line, i.e. the z-index of its midpoint.
Returns:
{Object} Reference to Line3D object

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 Mon Feb 24 2025 14:56:00 GMT+0100 (Mitteleuropäische Normalzeit)