Appearance
Scientific geometry
Implicit surfaces
const pair = [
{ kind: "sphere", centre: [-2.5, 0, 0], radius: 3 },
{ kind: "sphere", centre: [2.5, 0, 0], radius: 3 },
];
const solid = plot.uploadShapes(pair, [0.9, 0.6, 0.3], how, how === "smooth" ? 3 : 0);
plot.showShapes(solid);
plot.frameScene();Calls
3 in the code above, in the order it makes them
plot.uploadShapes(shapes: readonly Shape[], colour: Colour | Hex, combine?: Combine, blend?: number): ShapesHandleRegister a set of shapes given by their distance functions, and return a handle naming them.
Nothing reaches the GPU: a sphere is four numbers and the renderer marches a ray against them each frame, so the shape is exact at every zoom and there is no tessellation to be too coarse. At most sixteen in one set, which is what the shader evaluates.
blendis the radius the junctions are rounded off by, and is read only whencombineis"smooth".plot.showShapes(handle: ShapesHandle): voidDraw the shapes
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.