Skip to content

Feat: Gravity grids — Weierstrass arcs, polar shells, code cleanup#94

Merged
arossti merged 16 commits intomainfrom
Gravity
Feb 15, 2026
Merged

Feat: Gravity grids — Weierstrass arcs, polar shells, code cleanup#94
arossti merged 16 commits intomainfrom
Gravity

Conversation

@arossti
Copy link
Owner

@arossti arossti commented Feb 15, 2026

Summary

  • Gravity grid system: non-uniform shell spacing encoding gravitational acceleration
  • Weierstrass rational arcs (RT-pure) replace lerp-then-project for spherical mode
  • Cartesian polar grids: concentric circles on XY/XZ/YZ planes
  • IK rigid link solver for gravity demo bodies
  • Major code cleanup: -180 lines from grid dedup, RT-pure hexagons, slider quantization fix

Changes

  • modules/rt-grids.js: Gravity grid generators (chordal + spherical), Cartesian polar planes, extracted shared helpers (buildCartesianPlanes, buildQuadrayPlanes, _buildCartesianBasis), RT-pure hexagonal tiling, console.log → MetaLog, module constants
  • modules/rt-math.js: shellProjectionScale(), rationalArc() (Weierstrass parameterization), Float64 threshold documentation
  • modules/rt-ik-solvers.js: New — linkSpread2D, solveRigid2D/3D for gravity demo IK
  • modules/rt-init.js: Grid mode UI threading (uniform/gravity-chordal/gravity-spherical)
  • modules/rt-rendering.js: Grid rebuild wrappers with gridMode passthrough
  • modules/rt-ui-binding-defs.js: Slider bindings with gridMode awareness
  • index.html: Grid mode toggle buttons, tetScaleSlider step="any" fix
  • demos/rt-gravity-demo.js: Gravity numberline with IK link
  • Geometry Documents/Gravity-Grids.md: Full workplan and implementation guide

🤖 Generated with Claude Code

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 andy@openbuilding.ca

…vity

- Height changed from 100m to 144m (1m per cell, matching Quadray tessellation)
- Black Hole auto-scales to ~1.27 AU for visible 5-second animation
- SI prefix formatting (km, Mm, Gm, Tm) for extreme body values
- Body dropdown reordered by surface gravity: Moon → Mars → Earth → Jupiter → Sun → Black Hole
- Font sizes increased for readability (matching Weierstrass demo)
- Gravity-Grids.md updated with deployed demo docs and IK solver plan

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
….js consumer

New module rt-ik-solvers.js with RT-pure linkSpread2D (sin²θ from vertical),
plus solveRigid2D/3D for future constrained mode. Gravity demo draws a display-only
link line between the two body markers showing differential angle as they diverge.
Formula panel gains Link section with spread, angle, and quadrance.

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
Add Grid Mode toggle (Uniform/Gravity/Spherical-disabled) to Central Angle
section. Thread gridMode parameter through entire grid pipeline:
rt-math.js → rt-grids.js → rt-rendering.js → rt-init.js → rt-ui-binding-defs.js

Core technique: cumDist lookup table replaces constant edgeLength spacing.
Uses harmonic model (to be corrected to quadratic in next commit).
Includes createGravityCartesianPlane() for non-uniform Cartesian grids.

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
Replace inverse-square harmonic model (r_k = N/k) with quadratic model
cumDist[k] = totalExtent × (k/N)² matching the numberline demo pattern.

Harmonic created empty center + dense ring + extreme expansion.
Quadratic gives smooth, monotonically increasing gaps: dense near origin,
sparse far out — gaps grow as (2k+1)/N² (linear in k).

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
…r-axis cumDist

Per-axis cumDist applied quadratic warping independently to each basis component
(tensor product), pulling off-axis vertices inward to half their correct radius.
Replaced with radial shell projection: each vertex (i,j) is placed on the spherical
shell at cumDist[i+j] via RT.Gravity.shellProjectionScale(Q, shellRadius), preserving
angular direction from uniform grid. One √ per vertex at GPU boundary.

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
…buttons

Arc subdivision (8 segments) projects ring-edge midpoints onto shells,
and Grid Mode buttons now appear in both Cartesian and Central Angle UI
sections (synced via shared data-grid-mode handler).

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
Document that lerp-then-project spherical mode still under-inflates
outermost shells. Weierstrass rational arcs (Phase 3) identified as
the RT-pure definitive fix. Checklist and discussion log updated.

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
rationalArc() in RT.Gravity generates great-circle arc points exactly
on the shell surface using the Weierstrass substitution u = tan(θ/2).
RT-pure intermediate math (add, mul, div only); 2√ per arc at GPU
boundary vs 8√ per arc with the old lerp-then-project approach.
Zero chord sag by construction.

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
Replace cumDist[k] = E×(k/N)² with E×(1-√(1-k/N)) to match the
gravity numberline tick distribution. The old formula concentrated
all non-uniformity near the origin (invisible sub-pixel), leaving
outer shells nearly uniform. The new formula produces visibly
expanding intervals from origin outward, matching the demo.

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
…ompression

XYZ gravity mode now strictly polar (gravity converges to origin, not axes).
Weierstrass rational parameterization for circle geometry (RT-pure, no trig).
Removed Gravity button from Cartesian UI (only Uniform/Polar), renamed
Spherical→Polar in Central Angle section.

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
XYZ grid planes colored by axis mix: XY=Yellow, XZ=Magenta, YZ=Cyan.
Circle resolution doubled (SPQ 8→16, 64 segments/circle).
Gravity-Grids.md updated with full journey from chord sag to great circles,
quadrance-spacing future direction, and revised checklist.

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
Polar mode now draws `divisions` circles (not halfDiv) within halfExtent
radius — slider=100 gives 100 concentric circles as expected.
All Cartesian grid materials (uniform + polar) use transparent: true,
opacity: 0.4 to match Quadray IVM grid intensity.

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
Cartesian polar gravity grids complete: true concentric great circles,
RT-pure Weierstrass parameterization, correct gravity spacing, per-plane
coloring, matched opacity. Next: apply same radial sweep model to Quadray.
Key insight — axis orientation is immaterial; same intervals from origin
produce the same circles regardless of basis vector (X/Y/Z/QW/QX/QY/QZ).

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
Expanded Phase 3 checklist with file paths, line numbers, function names,
root cause analysis, approach (concentric circles on tetrahedral planes
using basis vectors as local coordinate axes), and verification criteria.
Sufficient for a future agent to pick up without prior context.

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
Top-of-file briefing: what's done (XYZ great circles), what's next
(Quadray polar), the problem (triangular topology), the fix (concentric
circles on tetrahedral planes using basis vectors), key files table,
and verification criteria. Zero prior context needed.

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
rt-grids.js: Extract buildCartesianPlanes/buildQuadrayPlanes/
_buildCartesianBasis helpers (-181 lines). Replace trig hexagon
vertices with exact algebraic coords. Module constants for opacity,
arc segments, colors. console.log → MetaLog. Module-level flag
replaces window.gridIntervalLogged.

rt-math.js: Document Float64 threshold rationale (1e-24, 1e-20).

index.html: tetScaleSlider step="0.1" → step="any" — prevents
browser quantizing irrational tetEdge values (cube was ~1% small).

🤖 Co-Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Andy🤦‍♂️ & Claude🤖 <andy@openbuilding.ca>
@github-actions
Copy link

🤖 Claude Code Review

Looking through the diff and final file contents:

Git Diff Analysis: The diff shows only changes to a markdown documentation file (Geometry documents/Gravity-Grids.md) - no code files were modified.

Final File Contents: The only file provided is art.css, which contains CSS styling code.

Reviewing the CSS file for code quality issues:

No issues found.

The CSS file is well-structured with clear organization, consistent naming conventions, and no debug code, commented-out code blocks, code duplication, large functions, or unused variables present.


ℹ️ About this review

This automated review checks for:

  • Debug statements (console.log)
  • Commented-out code
  • Code duplication
  • Large functions (>50 lines)
  • Unused variables

Human review required - these are suggestions only.
Diff size: 104021 bytes

@arossti arossti self-assigned this Feb 15, 2026
@arossti arossti merged commit d09988b into main Feb 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant