Point3D

Element

A Point3D object is defined by three coordinates [x,y,z], or a function returning an array with three numbers. Alternatively, all numbers can also be provided as functions returning a number.

Usage (signatures)
board.create('point3d', [x, y, z, slideopt]);

The coordinates are given as x, y, z consisting of numbers or functions. If an optional 3D element slide is supplied, the point is a 3D glider on that element.

Parameters
Name Type Attributes Description
x NumberLike
y NumberLike
z NumberLike
slide JXG.GeometryElement3D <optional>
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 });
   var q = view.create('point3d', function() { return [p.X(), p.Y(), p.Z() - 3]; }, { name:'B', size: 3, fixed: true });
   var w = view.create('point3d', [ () => p.X() + 3, () => p.Y(), () => p.Z() - 2], { name:'C', size: 3, fixed: true });

Glider on sphere

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

 // Two points
 var center = view.create('point3d', [0, 0, 0], {withLabel: false, size: 2});
 var point = view.create('point3d', [2, 0, 0], {withLabel: false, size: 2});

 // Sphere
 var sphere = view.create('sphere3d', [center, point], {fillOpacity: 0.8});

 // Glider on sphere
 var glide = view.create('point3d', [2, 2, 0, sphere], {withLabel: false, color: 'red', size: 4});
 var l1 = view.create('line3d', [glide, center], { strokeWidth: 2, dash: 2 });

board.create('point3d', [F, slideopt]);

Alternatively, the coordinates can be supplied as

  • function () => [x,y,z] returning an array of length 3 of numbers or
  • array arr=[x,y,z] of length 3 consisting of numbers

If an optional 3D element slide is supplied, the point is a glider on that element.

Parameters
Name Type Attributes Default Description
F Array | function
slide JXG.GeometryElement3D <optional>
null
Attributes

Own

cyclic

Description

If the point is bound to another element ("glides" on that element) and if the bound reaches the boundary, the point may start cyclically at the ozher side of the boundary - like one expects from a glider on a sphere. For this, set cyclic to true.

Type
Boolean
Default Value
false
Source
options3d.js, line 1082

Inherited

Members

Own

(private) coords : Array

Description

Homogeneous coordinates of a Point3D, i.e. array of length 4 containing numbers: [w, x, y, z]. Usually, w=1 for finite points and w=0 for points which are infinitely far. If coordinates of the point are supplied as functions, they are resolved in Point3D#updateCoords into numbers.

Type
Array
Example
p.coords;
Source
3d/point3d.js, line 61

(private) slide : JXG.GeometryElement3D

Description

Optional slide element, i.e. element the Point3D lives on.

Type
JXG.GeometryElement3D
Default Value
null
Example
p.slide;
Source
3d/point3d.js, line 87

Inherited

Methods

Own

(private) F()

Function or array of functions or array of numbers defining the coordinates of the point, used in updateCoords.

Details

See
  • updateCoords
Source
3d/point3d.js, line 76

(static) W()

Get w-coordinate of a 3D point.

Example

p.W();

Returns

Number

Details

Source
3d/point3d.js, line 180

(static) X() → {Number}

Get x-coordinate of a 3D point.

Example

p.X();

Returns

Type
Number

Details

Source
3d/point3d.js, line 135

(static) Y()

Get y-coordinate of a 3D point.

Example

p.Y();

Returns

Number

Details

Source
3d/point3d.js, line 150

(static) Z()

Get z-coordinate of a 3D point.

Example

p.Z();

Returns

Number

Details

Source
3d/point3d.js, line 165

(private, static) normalizeCoords() → {Object}

Normalize homogeneous coordinates such the the first coordinate (the w-coordinate is equal to 1 or 0)-

Example

p.normalizeCoords();

Returns

Reference to the Point3D object

Type
Object

Details

Source
3d/point3d.js, line 263

(static) setPosition(coords, noeventopt) → {Object}

Set the position of a 3D point.

Example

p.setPosition([1, 3, 4]);

Parameters

Name Type Attributes Description
coords Array

3D coordinates. Either of the form [x,y,z] (Euclidean) or [w,x,y,z] (homogeneous).

noevent Boolean <optional>

If true, no events are triggered (TODO)

Returns

Reference to the Point3D object

Type
Object

Details

Source
3d/point3d.js, line 284

(private, static) updateCoords() → {Object}

Update the array JXG.Point3D#coords containing the homogeneous coords.

Example

p.updateCoords();

Returns

Reference to the Point3D object

Type
Object

Details

See
  • GeometryElement3D#update()
Source
3d/point3d.js, line 195

Inherited

Events

Own

none

Inherited

Throws

If the element cannot be constructed with the given parent objects an exception is thrown.

Type
Exception

Details

Source
3d/point3d.js, line 712

Extends