JXG.Point3D

Class

Creates a new 3D point object. Do not use this constructor to create a 3D point. Use JXG.View3D#create with type Point3D instead.

Attributes

Own

none

Inherited

Members

Own

(private) movePath : Array

Description

An array of coordinates for moveTo(). An in-progress move can be updated or cancelled by updating or clearing this array. Use moveTo() instead of accessing this array directly.

Type
Array
Source
3d/point3d.js, line 117

(private) position : Array

Description

In case, the point is a glider, store the preimage of the coordinates in terms of the parametric definition of the host element. That is, if the host element slide is a curve, and the coordinates of the point are equal to p and u = this.position[0], then p = [slide.X(u), slide.Y(u), slide.Z(u)].

Type
Array
Source
3d/point3d.js, line 109

(private, static) endpoints : Array

Description

Shadow points that determine the visible line. This is of relevance if the line is defined by two points and has straightFirst or straightLast set to true. In such a case, the shadow points are the intersection of the line with the cube.

Type
Array
Source
3d/linspace3d.js, line 662

Inherited

Methods

Own

distance(pt) → {Number}

Calculate the distance from one point to another. If one of the points is on the plane at infinity, return positive infinity.

Parameters

Name Type Description
pt Point3D

The point to which the distance is calculated.

Returns

The distance

Type
Number

Details

Source
3d/point3d.js, line 465

(private) initCoords() → {Object}

Initialize the coords array.

Returns

Reference to the Point3D object

Type
Object

Details

Source
3d/point3d.js, line 239

moveAlong(traversePathopt, timeopt, optionsopt)

Move along a path defined by an array of coordinates

Example

const board = JXG.JSXGraph.initBoard('jxgbox')
 var view = board.create(
     'view3d',
     [[-6, -3], [8, 8],
     [[-3, 3], [-3, 3], [-3, 3]]]);

  board.create('button', [-4, 4.5, 'start', () => {
       let A = view.create('point3d', [0, 0, 0]);
       A.moveAlong([[3, 3, 3], [-2, -1, -2], [-1, -1, -1], [-1, -2, 1]], 3000,
          { callback: () => board.create('text', [-4, 4, 'done!']) })
 }])

Parameters

Name Type Attributes Description
traversePath Array.<Array.<number>> <optional>

Array of path coordinates (either cartesian or homogenous).

time number <optional>

Number of milliseconds the animation should last.

options Object <optional>

'callback' and 'interpolate'. see JXG.CoordsElement#moveAlong,

Details

Source
3d/point3d.js, line 666

moveTo(where, timeopt, optionsopt)

Starts an animated point movement towards the given coordinates where. The animation is done after time milliseconds. If the second parameter is not given or is equal to 0, coordinates are changed without animation.

Example

Visit a coordinate, then use callback to visit a second coordinate

const board = JXG.JSXGraph.initBoard('jxgbox')
var view = board.create(
    'view3d',
    [[-6, -3], [8, 8],
    [[-3, 3], [-3, 3], [-3, 3]]]);

 let A = view.create('point3d', [0, 0, 0]);

 // move A with callbacks
 board.create('button', [-4, 4.3, 'callbacks', () => {
   A.moveTo([3, 3, 3], 3000,
      {
         callback: () => A.moveTo([-3, -3, -3], 3000, {
             callback: () => A.moveTo([0, 0, 0],1000), effect: '<'
         }),
         effect: '>'
      })
    }])

  // move A with async/await
  board.create('button', [-3, 4.3, 'async/await', async () => {
      await A.moveTo([3, 3, 3], 3000, { effect: '>' });
      await A.moveTo([-3, -3, -3], 3000, { effect: '<' });
      A.moveTo([0, 0, 0],1000)
  }])
 

Parameters

Name Type Attributes Description
where Array

Array containing the target coordinate in cartesian or homogenous form.

time Number <optional>

Number of milliseconds the animation should last.

options Object <optional>

Optional settings for the animation

Properties
Name Type Attributes Default Description
callback function <optional>

A function that is called as soon as the animation is finished.

effect String <optional>
'<>'|'>'|'<'

animation effects like speed fade in and out. possible values are '<>' for speed increase on start and slow down at the end (default), '<' for speed up, '>' for slow down, and '--' for constant speed during the whole animation.

Details

See
Source
3d/point3d.js, line 553

testIfFinite() → {Boolean}

Check whether a point's position is finite, i.e. the first entry is not zero.

Returns

True if the first entry of the coordinate vector is not zero; false otherwise.

Type
Boolean

Details

Source
3d/point3d.js, line 455

Inherited

Events

Own

none

Inherited

Parameters

Name Type Description
view JXG.View3D

The 3D view the point is drawn on.

F function | Array

Array of numbers, array of functions or function returning an array with defines the user coordinates of the point.

slide JXG.GeometryElement3D

Object the 3D point should be bound to. If null, the point is a free point.

attributes Object

An object containing visual properties like in JXG.Options#point3d and JXG.Options#elements, and optionally a name and an id.

Details

See
Source
3d/point3d.js, line 50

Extends