Calculate effective radii for nD points when sliced.
When an nD hypersphere is sliced by a hyperplane, the visible cross-section has a smaller radius. This function computes that effective radius.
Point positions [numPoints * ndim]
Original point radii [numPoints]
Dimensions to display (typically [0,1,2]) [numDisplayDims]
Current slice position [ndim]
Which dims are spatial (1) vs discrete (0) [ndim]
Total number of dimensions
Number of points
Output effective radii [numPoints]
Number of points with non-zero effective radius (visible points)
Sort splats back-to-front by camera-space depth.
Produces the permutation consumed by the aSortedIndex instance
attribute: ordering[j] is the original splat index drawn at instance
slot j (slot 0 = farthest). Degenerate depth ranges (single depth
plane, everything behind the camera) yield the identity ordering.
Input is always projected 3D centers, so no ndim cap applies.
Projected 3D splat centers [count * 3]
Column-major 4x4 model-view matrix [16]
Output permutation [count]
Number of splats
Number of splats placed via depth keys (0 = identity fallback)
Decode quantized uint8 to float32. Maps [0,255] -> [minVal,maxVal]
Decode log-space quantized uint8. Result = expm1(normalized * maxLog)
Decode log-space quantized uint16. Result = expm1(normalized * maxLog)
Decode per-channel LINEAR (fixed-point) uint8 codes to float32.
Per-column [lo, hi] scales (f64, straight from the JSON attrs);
colOffset is the column phase of the first element.
Decode per-channel LINEAR (fixed-point) uint16 codes to float32.
Decode per-channel LOG uint8 codes to float32 (x = expm1(y)).
zeroLevel: true = reserved zero code 0 + codes 1..255 over the
nonzero-anchored scale; false = legacy all-levels mapping.
Decode per-channel LOG uint16 codes to float32.
Decode per-channel SIGNED-LOG uint8 codes (x = sign(y)·expm1(|y|)).
Decode per-channel SIGNED-LOG uint16 codes to float32.
Decode per-channel TRUE-log uint8 codes (x = exp(y); HDR colors).
Reserved zero level always on (name contract — no flag).
Decode per-channel TRUE-log uint16 codes to float32.
Decode LUT indices (uint8) to scalar float values
Decode LUT indices (uint16) to scalar float values
Decode LUT indices (uint8) to k-element vectors
Extract 3D positions from nD positions using display dimension indices.
Input nD positions [numPoints * ndim]
Which dimensions to display as X,Y,Z [3 or fewer]
Total number of dimensions
Number of points
Output 3D positions [numPoints * 3]
Compute Mahalanobis distance for a single point using packed Cholesky factor.
Given L (lower-triangular Cholesky of covariance), Mahalanobis distance = ||L⁻¹ · (x - μ)||
Difference vector (x - μ) [ndim]
Packed Cholesky factor [packedSize]
Dimensionality
Mahalanobis distance
Fused nD→3D GSplat projection in a single pass: discrete-visibility gate →
continuous attenuation (marginal Cholesky + shifted Gaussian) → visibility
(amplitude * attenuation >= minAmplitude) → COMPACTED outputs. Replaces the
former 6-call pipeline (compute_gsplats_attenuation + extract_3d_positions +
compact_by_mask ×2 + extract_visible_cholesky_3d +
compact_attenuated_amplitudes), eliminating ~5 passes and the repeated
large-array boundary copies. Bit-identical visible set + values.
Colors must be pre-normalized to f32 (white-filled when absent) — the kernel
takes a single Float32Array because wasm-bindgen can't accept a typed-array
union. Outputs are sized for the splatCount worst case; slice each to the
returned visible count.
Splat centers [splatCount * ndim]
Packed Cholesky factors [splatCount * packedSize]
Splat amplitudes [splatCount]
Pre-normalized RGB or RGBA [splatCount * colorComponents]
Precomputed discrete-dim gate [splatCount]
Current slice [ndim]
Sorted continuous hidden dims [numContinuous]
Display dims in requested order [2 or 3]
Total dimensionality
Number of splats
Color channel count (3 = RGB, 4 = RGBA); strides every color read/write
Visibility threshold
Truncation radius in sigmas
Output visible centers [splatCount * 3] worst-case
Output visible 3D Cholesky [splatCount * 6] worst-case
Output visible attenuated amplitudes [splatCount] worst-case
Output visible colors [splatCount * colorComponents] worst-case
Output SOURCE index per emitted splat [splatCount] worst-case. Compaction destroys the slot → source mapping, which picking needs to reach an on-disk element index (issue #1423). Pass an EMPTY array to opt out — the recording is then skipped entirely.
Number of visible splats written
Clip a single segment to the nD slice and return interpolation parameters.
Start vertex position [ndim]
End vertex position [ndim]
Current slice position [ndim]
Per-dimension tolerance [ndim]
Which dimensions to display [numDisplayDims]
Number of dimensions
Float32Array [visible, t1, t2] where visible is 1.0 or 0.0
Batch clip all segments and output visibility mask and interpolation parameters.
Vertex positions [numVertices * ndim]
Segment indices [numSegments * 2]
Current slice position [ndim]
Per-dimension tolerance [ndim]
Which dimensions to display [numDisplayDims]
Number of dimensions
Number of segments
Output visibility mask [numSegments]
Output t1 parameters [numSegments]
Output t2 parameters [numSegments]
Number of visible segments
Interpolate clipped positions to 3D display space.
Vertex positions [numVertices * ndim]
Segment indices [numSegments * 2]
Visibility mask [numSegments]
Start interpolation parameters [numSegments]
End interpolation parameters [numSegments]
Which dimensions to display [3]
Number of dimensions
Total number of segments
Output start positions [visibleCount * 3]
Output end positions [visibleCount * 3]
Number of visible segments written
Batch interpolate scalar attributes for visible segments.
Per-vertex attribute values [numVertices]
Segment indices [numSegments * 2]
Visibility mask [numSegments]
Start interpolation parameters [numSegments]
End interpolation parameters [numSegments]
Total number of segments
Output interpolated start values [visibleCount]
Output interpolated end values [visibleCount]
Number of visible segments written
Batch interpolate RGB color attributes for visible segments.
Per-vertex RGB colors [numVertices * 3]
Segment indices [numSegments * 2]
Visibility mask [numSegments]
Start interpolation parameters [numSegments]
End interpolation parameters [numSegments]
Total number of segments
Output interpolated start colors [visibleCount * 3]
Output interpolated end colors [visibleCount * 3]
Number of visible segments written
Calculate 3D segment lengths for visible segments.
Clipped start positions [visibleCount * 3]
Clipped end positions [visibleCount * 3]
Number of visible segments
Output segment lengths [visibleCount]
Per-endpoint joint code: how the line shader should treat this endpoint, and — at an ordinary two-segment joint — which segment it joins.
0 free polyline end (keep the soft cap); -1 slice-clipped (suppress the
cap; no neighbour will arrive); -2 degree->=3 hub (keep the cap);
+(slot + 1) joins visible segment slot at that segment's START;
-(slot + 3) joins it at that segment's END. slot is a line-texture
storage slot, so it survives the depth-sort worker's draw-order
permutation. Purely topological — no positions, no angle: the vertex stage
measures the bend in SCREEN space so it tracks the camera. See
wasm/rust/src/lines_clipping.rs for the full derivation.
Vertex index pairs [numSegments * 2]
Visibility mask [numSegments]
Start interpolation parameters [numSegments]
End interpolation parameters [numSegments]
Total number of segments
Total number of source vertices
Output start joint codes [visibleCount]
Output end joint codes [visibleCount]
Number of visible segments written
Compute per-vertex nD slab membership for a mesh.
For each non-displayed ("hidden") dimension d, with
sliceMin = slicePosition[d] - tolerance[d] and
sliceMax = slicePosition[d] + tolerance[d], a vertex is in iff
v[d] >= sliceMin && v[d] <= sliceMax for every such d. This is the
p1_in branch of WasmModule.clip_segment_single applied per vertex.
A NaN or ±Inf coordinate on any hidden dimension makes the vertex
invisible (the #806 rule, shared with the lines backends).
Unlike lines, nothing is clipped or interpolated — see
WasmModule.compact_visible_faces for the whole-triangle rule and
docs/specs/MESH_NODE_SPEC.md §5 for why v1 does not clip.
The WASM implementation calls validate_ndim and therefore panics above 16
dimensions; pickBackend(ctx, ndim) routes ndim > 16 to the uncapped
TypeScript backend.
Vertex positions [numVertices * ndim]
Current slice position [ndim]
Per-dimension tolerance [ndim]
Which dimensions are displayed [numDisplayDims]
Number of dimensions
Number of vertices
Output visibility mask [numVertices] (1 = in, 0 = out)
Number of visible vertices
Compact faces to those whose three vertices are all visible.
Writes ORIGINAL (un-remapped) vertex indices, so a slice change rebuilds only the index buffer while the vertex attribute buffers stay uploaded in full. The authored per-face index order is preserved, so this is winding-agnostic.
A face index >= vertexMask.length drops the whole face rather than reading
out of bounds — the indices are store-supplied, and the two backends fail
differently without the guard (a Rust out-of-bounds read traps with an
uncatchable RuntimeError: unreachable; the TS read yields undefined).
Triangle vertex indices [numFaces * 3]
Per-vertex visibility from
WasmModule.mesh_vertex_visibility_mask; its LENGTH defines the
valid vertex range, so pass a view sized exactly numVertices
Number of triangles
Output indices [numFaces * 3] worst case
Number of visible faces written (slice output to 3x this)
WASM module interface: projection, effective-radius, and decode kernels.
This interface defines the contract between TypeScript and the WASM module. Both the compiled WASM and the TypeScript fallback implement this interface.