One distance measurement — two world-space anchors plus the overlay DOM/SVG that shows the diagonal length and its X / Y / Z component decomposition.

Instances are created and owned by DistanceMeasurementTool; external callers should go through the tool's DistanceMeasurementTool.createMeasurement factory and call DistanceMeasurementTool.destroyMeasurement (or DistanceMeasurementTool.clear) to tear them down.

The measurement composes 4 wires and 4 labels:

Wire Color Goes from … to …
length orange origin → target (the actual diagonal)
x red origin → (target.x, origin.y, origin.z)
y green (target.x, origin.y, origin.z) → (target.x, target.y, origin.z)
z blue (target.x, target.y, origin.z) → target

The X / Y / Z polyline traces the right-angled "stair-step" between the two anchors so the user can visualise each component separately. The four label divs sit at each wire's midpoint.

Toggles visible, wireVisible, axisVisible, labelsVisible compose like CSS visibility — hiding the whole measurement (visible = false) overrides the others.

Constructors

Properties

id: string

Stable id for this measurement. Used as the registry key.

Accessors

Methods

  • Internal

    Recompute screen positions of all sub-elements. Called by the tool once per camera-update tick — endpoints in world space, canvas in pixels.

    project(worldPos) must return [canvasX, canvasY, w] where w is the homogeneous w-component of the clip-space coordinate; a non-positive w means "behind the camera" and the corresponding sub-element is hidden.

    Parameters

    • project: (p: Vec3, out: [number, number, number]) => void

    Returns void