Clicked points chained into a run, with the length of every leg, the angle at every corner and the total on screen. More...
| Import Statement: | import Clayground.Lab |
| Inherits: |
A lab answers "what does this do" all day and "how far is that" never, because nothing could be asked. This is the asking: with the tape in hand a left click drops a point, the next one chains to it, and the picture carries its own dimensions. Dragging still moves the world - the camera is never taken away, whatever is in the hand.
One of the two instruments the kernel ships in every lab, because every lab has a ground plane to measure on; a kit's own instruments (a voltmeter) come with the kit. See InstrumentBelt.
A measurement belongs to the moment it is taken. Backspace takes the last point back, Esc clears the run, and putting the tape away clears it too; nothing here goes into a lab's viewState, so a reload does not restore a question nobody is asking any more. Pinning is the deliberate exception - that is what "this one is worth keeping" means, and it turns the reading into a probe the run record carries.
The ink is 2D and drawn over the view, not laid on the ground: world content is legitimately occluded by geometry, and a dimension that disappears into a house is worse than useless. Drawn as UI it cannot z-fight, keeps its pixel size at any distance, and stays readable close up over cars and parts.
The arithmetic is not here either - it is measure.js, checked by node measure.test.js, so no length or angle is only as right as a screenshot looks.
See also HandheldInstrument, InstrumentBelt, and CameraAnchorMark.
angles : var |
Angle at each interior corner, in degrees.
arcPx : real |
Radius of the angle arc, in pixels.
dotPx : real |
Radius of a vertex dot, in pixels.
lengths : var |
Length of each leg.
plan : var |
The run projected into view pixels - what the overlay draws.
{ pts, segs, verts, total }, each entry carrying an ok that is false where a point sits behind the camera: that segment is not drawn, while the measurement itself is untouched. Walking behind your own tape measure must not delete it.
Projected with the camera's motion as EXPLICIT dependencies - the WorldLabel trap: without the scenePosition / sceneRotation reads the whole overlay freezes the moment the camera moves.
readout : var |
The whole measurement as data: segments, vertices and total.
Straight out of measure.js, with this lab's unit and decimal notation already applied - what the overlay draws and what a test or an agent asserts against, so both read the same numbers.
total : real |
Total length of the run.