How devyanyadav/4d-physics-sandbox works
This is a small interactive 4D physics sandbox. Users steer a camera and control simulation time and boundaries while the app advances charged, massive tesseracts, projects them into a 2D view, and draws the scene. The runtime is centered in main.py, with geometry, camera/rotation, projection and physics helpers. physics.py also contains a standalone integrator-comparison and energy-drift analysis. The excerpts show the main runtime calls; unsampled drawing details are kept within the main-loop component.
Main entry points: main.py Simulation loop · tesseract.py Tesseract model · camera.py Camera controls · physics.py RK4 integrator
Components 12
Sandbox runtime
- Simulation loop
main.py
4D view and geometry
- Tesseract model
tesseract.py - Edges and bounds
functions.py - Camera controls
camera.py - 4D rotations
rotation.py - View transforms
functions.py - Projection and clipping
functions.py
Physics and analysis
- RK4 integrator
physics.py - Force calculation
physics.py - Wall collisions
functions.py - Integrator analysis
physics.py
Other components
- Sandbox user
Connections 12
- Sandbox user → Simulation loop: controls
main.py - Simulation loop → Tesseract model: creates models
main.py - Simulation loop → Edges and bounds: builds geometry
main.py - Tesseract model → Edges and bounds: gets edge list
tesseract.py - Simulation loop → Camera controls: updates camera
main.py - Camera controls → 4D rotations: uses rotation matrices
camera.py - Simulation loop → 4D rotations: rotates objects
main.py - Simulation loop → View transforms: transforms view
main.py - Simulation loop → Projection and clipping: projects vertices
main.py - Simulation loop → RK4 integrator: advances state
main.py - RK4 integrator → Force calculation: computes acceleration
physics.py - Simulation loop → Wall collisions: applies walls
main.py