Expand description
Fixed-width exact predicate tier — the FAST exact arithmetic between the interval filter and the BigRational fallback.
num-rational is correct but ~3ms/call (heap-allocated BigInt + the Ratio
wrapper on every op). The orient predicates are sign-invariant under uniform
positive coordinate scaling, so on-grid coords (the f32-snap grid, k/2^16)
scale to EXACT i64 integers and the whole lambda/determinant computes in
stack-allocated bnum integers — no heap, no GCD. Every op is CHECKED: an
overflow (the chosen width is too narrow) OR an off-grid coord returns None.
TIERED WIDTH: the same predicate is generated (by the fixed_impl! macro) at
I256 / I512 / I1024. The public dispatch tries the NARROWEST first — most LPI
predicates on building-scale coords fit I256 (4× faster than I1024) — and
escalates on overflow. So the result is always a sign identical to
BigRational, or a deferral up the cascade and finally to BigRational.
DUAL SCALE (crack-family fix): the exact-plane lift in mesh_bridge welds
near-coplanar cutter vertices onto host planes at the FINER k/2^36 grid
(2^16 snap grid × the 2^20 α,β quantization). Those coordinates fail the
coarse gi fract check and previously fell to the ~3 ms BigRational tier on
EVERY predicate. The cascade therefore carries a second, fine-scale family
(f256/f512/f1024/f2048, gi scale 2^36) tried only after the coarse
family declines — orientation predicates are sign-invariant under uniform
positive scaling, so a per-call uniform scale is exactly equivalent. The
extra f2048 rung exists because second-order TPI×TPI products at the fine
scale reach ≈1340 bits (overflow I1024). Coarse-grid inputs keep resolving
in the unchanged coarse family ⇒ zero cost on the common path.
Functions§
- cmp_
along - cmp_lex
- cmp_
lex_ from_ lam - Lexicographic compare of two interned points from their cached lambdas.
- indirect_
orient2d - indirect_
orient3d - lambda1024
- The I512 homogeneous lambda of an implicit point (the value cached per Vid).
- orient2d_
2i - orient2d_
3i - orient2d_
from_ lam - 2-D orientation of three interned points from their cached lambdas.
- point_
to_ f64 - Materialize an implicit point to f64 via the FIXED-width (I1024) homogeneous
lambda — the fast path for the BigRational
rational::point_of. The lambda is computed in thegi-scaled domain (coords × 2^16), so the real coordinate islambda[k] / (d · 2^16). ReturnsNoneon off-grid coords / overflow, where the caller falls back to the exact BigRational materialization. Used for the classifier centroids AND the output verts (the dominant per-op cost).