How do I set the position of a Point3D? The Position of a 2D Point can be set with the method setPosition, followed by board.fullUpdate(). This does not seem to work with a Point3D.
In v1.4.4 many functions for 3D handling are still missing, among them are setPosition3D and moveTo3D.
By the way, point.moveTo([x,y], time);
is the preferred way to move 2D points. setPosition()
is considered as low level. Nevertheless, setPosition3D()
can be done by setting the array p.D3.coords
of a 3D point p
, followed by a board update:
var p = view.create('point3d', [1, 1, 2], { size: 5 });
// Coordinates given in the form [1, x, y, z]
p.D3.coords = [1, 1, 1, -2];
board.update();
The coords array of a 3D point has length 4 (as it contains homogeneous coordinates) and is of the form [1, x, y, z]
.
See https://jsfiddle.net/wmsg2963/ for working example.