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
| Parameter | Type |
|---|---|
layout | Pick<LineLayout, "vertexCount" | "source"> & object |
input | Pick<LineGeometryInput, "x" | "y" | "z"> |
transform | { offset: readonly [number, number, number]; scale: readonly [number, number, number]; } |
transform.offset | readonly [number, number, number] |
transform.scale | readonly [number, number, number] |
screen | ScreenMatrix |
period | number |
out | Float32Array |
Returns
void