Skip to content

Function: computeDashDistances() ​

ts
function computeDashDistances(layout, input, transform, screen, period, out): void;

Experimental

Compute per-stream-vertex dash distances: [phase, segmentLength] pairs where phase is the cumulative screen-space length from the polyline (or post-gap) start modulo period, and segmentLength is the screen length of the segment leaving that vertex.

Storing the phase modulo the pattern period (computed in float64) keeps dashes exact on arbitrarily long lines, where a raw float32 cumulative length would lose sub-pixel precision.

Positions are recomputed in float64 from the source arrays (not the float32 stream) so the result matches the GPU projection. Vertices behind the camera (w ≤ 0) contribute zero length.

Parameters ​

ParameterType
layoutPick<LineLayout, "vertexCount" | "source"> & object
inputPick<LineGeometryInput, "x" | "y" | "z">
transform{ offset: readonly [number, number, number]; scale: readonly [number, number, number]; }
transform.offsetreadonly [number, number, number]
transform.scalereadonly [number, number, number]
screenScreenMatrix
periodnumber
outFloat32Array

Returns ​

void

Released under the MIT License.