Skip to content

SuperInstance/constraint-theory-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

20 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Constraint Theory Web

Click once. Understand forever.

50 interactive simulations that make math click โ€” no math degree required.

๐ŸŽฎ TRY A DEMO NOW โ†’

Click the canvas. Watch geometry snap. Get it in 5 seconds.

GitHub stars License: MIT Deploy Cloudflare Pages


๐ŸŽฏ What Is This?

50 interactive HTML simulations (41 experiments + 9 simulators) for learning Constraint Theory, geometry, physics, and math. Built for students, teachers, and the perpetually curious.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                                                             โ”‚
โ”‚   ๐Ÿ“– Reading docs:  "The manifold consists of..."          โ”‚
โ”‚                      (2 minutes later) "Wait, what?"       โ”‚
โ”‚                                                             โ”‚
โ”‚   ๐Ÿ–ฑ๏ธ Interactive demo: Click canvas โ†’ See snap โ†’ Got it!  โ”‚
โ”‚                      (5 seconds to understanding)          โ”‚
โ”‚                                                             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โšก Zero setup. Zero build. Zero friction.


๐Ÿš€ Try It Now (Pick One)

I want to... Click here
See geometry snap Pythagorean Demo โ†’
Watch algorithms work KD-Tree Demo โ†’
Play with physics Swarm Demo โ†’
Browse all 50 Full Gallery โ†’
๐Ÿ’ป Prefer local? Clone it (optional)
git clone https://github.com/SuperInstance/constraint-theory-web.git
cd constraint-theory-web
open simulators/pythagorean/index.html   # That's it. No npm install.

โœจ The Ah-Ha Moment

Reading about Pythagorean snapping:

"The manifold consists of integer-ratio points on Sยน indexed by KD-tree with O(log n) lookup..."

...interesting, but what does it actually look like?

Opening our demo:

Click anywhere on the canvas. Watch your cursor snap to the nearest exact coordinate. See the noise. Understand instantly.

Try the Pythagorean demo โ†’


๐Ÿ“Š Demo Showcase

๐Ÿงฎ Start Here: Core Simulations

Demo What You'll Learn Seconds to Try
Pythagorean Snapping Click to snap โ€” see noise in real-time โ–ถ Play
KD-Tree Visualization Watch O(log n) in action โ–ถ Play
Swarm Behavior Boids with deterministic physics โ–ถ Play

๐Ÿ”ฌ Mathematical Visualizations (20+)

Demo What You'll See Quick Link
Mandelbrot Set Fractal zoom with color cycling โ–ถ
Fourier Series Circles drawing waves โ–ถ
Geometric Algebra Clifford algebra made visual โ–ถ
Holonomy Transport Parallel transport on manifolds โ–ถ
Quaternion 4D rotations projected โ–ถ
Complex Plane Mรถbius transforms โ–ถ
Cellular Automata Conway's Life & more โ–ถ

โšก Physics Simulations (15+)

Demo What You'll Experience
N-Body Gravitational chaos โ€” watch planets orbit
Fluid Dynamics Navier-Stokes in your browser
Soft Body XPBD constraint solver โ€” squishy physics
Wave Interference Constructive & destructive patterns
Voxel XPBD 3D physics engine

๐Ÿง  AI/ML Demonstrations (7+)

Demo What You'll Explore
Neural Network Forward pass visualization
Tree of Thoughts AI reasoning visualization
Constraint Network Agent coordination

โ†’ Browse all 50 simulations


๐Ÿ› ๏ธ Create Your Own Demo (Optional)

Want to build your own? Here's a minimal starting point:

๐Ÿ“ Show me the code
<!DOCTYPE html>
<html>
<head>
  <title>My First Constraint Demo</title>
  <style>
    canvas { border: 1px solid #333; cursor: crosshair; }
    #info { font-family: monospace; margin-top: 10px; }
  </style>
</head>
<body>
  <canvas id="demo" width="400" height="400"></canvas>
  <div id="info">Click anywhere to snap to nearest Pythagorean triple</div>
  
  <script>
    const canvas = document.getElementById('demo');
    const ctx = canvas.getContext('2d');
    const info = document.getElementById('info');
    
    const triples = [
      [3/5, 4/5], [4/5, 3/5], [5/13, 12/13], [8/17, 15/17], [7/25, 24/25]
    ];
    
    canvas.addEventListener('click', (e) => {
      const rect = canvas.getBoundingClientRect();
      const x = (e.clientX - rect.left) / 200 - 1;
      const y = (e.clientY - rect.top) / 200 - 1;
      
      let best = triples[0], minDist = Infinity;
      for (const [tx, ty] of triples) {
        const dist = Math.hypot(x - tx, y - ty);
        if (dist < minDist) { minDist = dist; best = [tx, ty]; }
      }
      
      ctx.clearRect(0, 0, 400, 400);
      ctx.beginPath();
      ctx.arc(200 + x * 200, 200 + y * 200, 5, 0, Math.PI * 2);
      ctx.fillStyle = 'red';
      ctx.fill();
      
      ctx.beginPath();
      ctx.arc(200 + best[0] * 200, 200 + best[1] * 200, 8, 0, Math.PI * 2);
      ctx.fillStyle = 'green';
      ctx.fill();
      
      info.textContent = `Snapped to (${best[0].toFixed(4)}, ${best[1].toFixed(4)}) - noise: ${minDist.toFixed(4)}`;
    });
  </script>
</body>
</html>

Copy-paste into a .html file, open in browser, and click!

โ†’ See contributing guide for more


๐ŸŽ“ Who Is This For?

๐Ÿงญ Quick Check

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚   Want to SEE math, not read it?โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                  โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚                        โ”‚                        โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”              โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”             โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”
    โ”‚ TEACHER โ”‚              โ”‚ STUDENT โ”‚             โ”‚ DEV     โ”‚
    โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜              โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜             โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜
         โ”‚                        โ”‚                        โ”‚
         โ–ผ                        โ–ผ                        โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”             โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”            โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ โœ“ Use   โ”‚             โ”‚ โœ“ Learn  โ”‚            โ”‚ โœ“ Debug  โ”‚
    โ”‚ in classโ”‚             โ”‚ by doing โ”‚            โ”‚ your codeโ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜             โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜            โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

If any of these sound like you, you're in the right place.

๐Ÿ“š For Teachers

Kinesthetic learning beats lecture. Students remember what they discover.

// In class: Open Pythagorean demo
// Students click around the unit circle
// They see which points snap to exact values
// Patterns emerge: (3,4,5), (5,12,13), (8,15,17)...
// No lecture needed โ€” they get it.

๐ŸŽ“ For Students

Struggling with a concept? Stop reading. Start clicking.

  • Fourier Series โ†’ Watch circles draw waves
  • Mandelbrot โ†’ Zoom into infinity
  • Swarm โ†’ See emergence in action

๐Ÿ’ป For Developers

Visual debugging catches what unit tests miss.

  • KD-Tree โ†’ Watch queries traverse partitions
  • N-Body โ†’ Validate your physics engine
  • Constraint Network โ†’ Debug agent coordination

๐Ÿ”ง Technology

  • Zero dependencies โ€” Vanilla JavaScript
  • Canvas 2D / WebGL โ€” Hardware-accelerated rendering
  • Responsive โ€” Desktop and mobile friendly
  • Self-contained โ€” Single HTML file per demo
  • Accessible โ€” ARIA attributes, keyboard navigation, screen reader support

๐ŸŒ Browser Compatibility

Browser Version Status
Chrome 90+ โœ… Full support
Firefox 88+ โœ… Full support
Safari 14+ โœ… Full support
Edge 90+ โœ… Full support
Mobile Safari 14+ โœ… Touch optimized
Chrome Mobile 90+ โœ… Touch optimized

๐ŸŒŸ Ecosystem

Repo What It Does Key Features
constraint-theory-core ๐Ÿฆ€ Rust crate ~100ns snap, SIMD batch, 82 tests
constraint-theory-python ๐Ÿ Python bindings NumPy integration, PyTorch compatible
constraint-theory-web ๐ŸŒ This repo 50 visualizations, zero setup
constraint-theory-research ๐Ÿ“š Mathematical foundations arXiv paper, proofs, open problems
constraint-ranch ๐ŸŽฎ Gamified learning Puzzle games, agent breeding
constraint-flow ๐Ÿ’ผ Business automation Exact financial calculations, workflow orchestration
constraint-theory-agent ๐Ÿค– Implementation agent Code audit, refactoring, expert explanations

๐Ÿ”— WASM Integration

Use Constraint Theory in the browser with WebAssembly:

// Install from npm (when published)
// npm install constraint-theory-wasm

// Or build from source
git clone https://github.com/SuperInstance/constraint-theory-core
cd constraint-theory-core
wasm-pack build --target web --out-dir ../constraint-theory-web/wasm

// Use in JavaScript
import init, { PythagoreanManifold } from './wasm/constraint_theory_core.js';

await init();
const manifold = new PythagoreanManifold(200);
const [exact, noise] = manifold.snap([0.577, 0.816]);
// exact = [0.6, 0.8] โ€” forever exact!

๐Ÿ“„ Research Papers

Cite our work in your papers:

@article{constraint_theory_2025,
  title={Constraint Theory: Deterministic Manifold Snapping via Pythagorean Geometry},
  author={SuperInstance},
  journal={arXiv preprint arXiv:2503.15847},
  year={2025},
  url={https://github.com/SuperInstance/constraint-theory-research}
}

Key papers:


๐Ÿ“ฐ Press Kit

For journalists, influencers, and community outreach:


๐Ÿšข Deployment

npm install -g wrangler
wrangler pages deploy . --project-name constraint-theory-web

๐Ÿค Contributing

Good First Issues ยท CONTRIBUTING.md

We welcome:

  • ๐ŸŽจ New demos โ€” Add your visualization
  • ๐ŸŒ Translations โ€” Make it global
  • ๐Ÿ“ฑ Mobile improvements โ€” Touch support, responsive design

๐Ÿ“œ License

MIT โ€” see LICENSE.


๐Ÿš€ Ready to Learn?

๐ŸŽฎ Try a Demo Now ยท โญ Star This Repo ยท ๐Ÿ“ฅ Clone Locally


Click once. Understand forever.

Releases

No releases published

Packages

 
 
 

Contributors