Appearance
Data and streaming
Streaming point replacement
The call
plot.replacePoints(handle: PointsHandle, points: PointSet): voidReplace the points behind
handle, keeping the handle.What a live cloud should call each time its data changes. Uploading again also works and is what most people reach for first, but it issues a new handle every time and leaves the old cloud resident: a page feeding an instrument would leak a cloud a frame.
This sends the whole cloud, which is the right call when most of it changed or when its length moves every time. A feed rewriting part of a cloud that stays the same size wants
writePoints, which costs the part rather than the cloud.
const cloud = plot.uploadPoints(shell(count));
plot.showPoints(cloud);
plot.frameScene();
return {
readout: `${count.toLocaleString("en-GB")} points`,
stream(at) {
// A cloud whose every point moved: the radius breathes.
plot.replacePoints(cloud, shell(count, 10 + Math.sin(at * 3)));
},
};Also called
3 in the code above, in the order it makes them
plot.uploadPoints(points: PointSet): PointsHandleUpload a point cloud and return a handle naming it.
plot.showPoints(handle: PointsHandle): voidDraw the point cloud
handlenames.plot.frameScene(): voidPoint the camera at the middle of everything uploaded, far enough back to see it.
Call after uploading. A scene measured in grid cells or in millimetres is nowhere near where a camera starts, and without this the first thing a caller sees is an empty canvas.