Vectorfield3D

Element

A vector field is an assignment of a vector to each point in 3D space.

Plot a vector field either given by three functions \(f_1(x, y, z)\), \(f_2(x, y, z)\), and \(f_3(x, y, z)\) or by a function \(f(x, y, z)\) returning an array of size 3.

Usage (signatures)
board.create('vectorfield3d', [f1, f2, f3]);

Either an array containing three functions f1(x, y, z), f2(x, y, z), and f3(x, y, z)

Parameters
Name Type Description
f1 Array
f2 Array
f3 Array
Example
const view = board.create('view3d',
    [
        [-6, -3],
        [8, 8],
        [[-3, 3], [-3, 3], [-3, 3]]
    ], {});

var vf = view.create('vectorfield3d', [
    [(x, y, z) => Math.cos(y), (x, y, z) => Math.sin(x), (x, y, z) => z],
    [-2, 5, 2], // x from -2 to 2 in 5 steps
    [-2, 5, 2], // y
    [-2, 5, 2] // z
], {
    strokeColor: 'red',
    scale: 0.5
});

board.create('vectorfield3d', [F]);

Function f(x, y, z) returning an array of length 3. The function may be given as JessieCode string.

Parameters
Name Type Description
F function | String
board.create('vectorfield3d', [xData, yData, zData]);
Parameters
Name Type Description
xData Array

Array of length 3 containing start value for x, number of steps, end value of x. The vector field will contain (number of steps) + 1 vectors in direction of x.

yData Array

Array of length 3 containing start value for y, number of steps, end value of y. The vector field will contain (number of steps) + 1 vectors in direction of y.

zData Array

Array of length 3 containing start value for z, number of steps, end value of z. The vector field will contain (number of steps) + 1 vectors in direction of z.

Attributes

Own

arrowhead

Description

Customize arrow heads of vectors. Be careful! If enabled this will slow down the performance. Fields are:

  • enabled: Boolean
  • size: length of the arrow head legs (in pixel)
  • angle: angle of the arrow head legs In radians.
Type
Object
Default Value
{enabled: true, size: 5, angle: Math.PI * 0.125}
Source
options3d.js, line 1615

scale

Description

Scaling factor of the vectors. This in contrast to slope fields, where this attribute sets the vector to the given length.

Type
Number | function
Default Value
1
See
Source
options3d.js, line 1604

Inherited

Members

Own

none

Inherited

Methods

Own

(static) setF(func) → {Object}

Set the defining functions of 3D vector field.

Example

field.setF([(x, y, z) => Math.sin(y), (x, y, z) => Math.cos(x), (x, y, z) => z]);
board.update();

Parameters

Name Type Description
func Array | function

Either an array containing three functions f1(x, y, z), f2(x, y, z), and f3(x, y, z) or function f(x, y, z) returning an array of length 3.

Returns

Reference to the 3D vector field object.

Type
Object

Details

Source
3d/curve3d.js, line 599

Inherited

Events

Own

none

Inherited

Throws

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

Type
Error

Details

Type
JXG.Curve3D
Source
3d/curve3d.js, line 490

Extends