nD Transform utilities for non-displayed dimension transforms.
These transforms operate per-dimension on non-displayed dimensions:
Continuous/discrete: affine (scale * x + offset)
Categorical: permutation (index remapping)
Design: Inverse-Query Approach
Instead of transforming millions of point coordinates per frame (O(N)),
we inverse-transform the query (slicePosition + tolerance) once (O(1)).
The spatial index stores raw (untransformed) coordinates, so we convert
the viewer's world-space query back to local space before querying.
This means no changes are needed in the per-element projection kernels
(projectTo3D, clipSegmentToSlice, projectLinesTo3D, the WASM/TS
effective-radii kernels): they keep comparing raw coordinates against a
query they never know was transformed.
The one exception is the no-preimage rule below — a world slice that no local
value can occupy is not expressible as a query position, so each geometry's
range query carries a single early-out for it. See
invertNdTransformForQuery.
nD Transform utilities for non-displayed dimension transforms.
These transforms operate per-dimension on non-displayed dimensions:
Design: Inverse-Query Approach
Instead of transforming millions of point coordinates per frame (O(N)), we inverse-transform the query (slicePosition + tolerance) once (O(1)). The spatial index stores raw (untransformed) coordinates, so we convert the viewer's world-space query back to local space before querying.
This means no changes are needed in the per-element projection kernels (projectTo3D, clipSegmentToSlice, projectLinesTo3D, the WASM/TS effective-radii kernels): they keep comparing raw coordinates against a query they never know was transformed.
The one exception is the no-preimage rule below — a world slice that no local value can occupy is not expressible as a query position, so each geometry's range query carries a single early-out for it. See invertNdTransformForQuery.