• Blog
  • Docs
  • Pricing
  • Weโ€™re hiring!
Log inSign up
spooky

spooky

AIDA

4d geometry
Public
Like
AIDA
Home
Code
6
backend
2
frontend
6
shared
3
FEATURES_SUMMARY.md
MATHEMATICAL_CONCEPTS.md
README.md
Branches
2
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data โ€“ all from the browser, and deployed in milliseconds.
Sign up now
Code
/
Code
/
Search
index.ts
https://spooky--fc8be6e859a211f0a457f69ea79377d9.web.val.run
README.md

Higher Dimensional Geometry Visualizer

A sophisticated Next.js application for visualizing and interacting with 4D and 5D geometric shapes and their transformations. This educational tool allows users to explore higher-dimensional mathematics through interactive 3D projections, real-time transformations, and cross-sectional analysis.

๐ŸŒŸ Features

Core Visualization

  • 4D/5D Shape Rendering: Visualize tesseracts, penteracts, simplexes, and other higher-dimensional polytopes
  • Real-time Transformations: Rotate, scale, and translate shapes in higher dimensions with immediate visual feedback
  • Multiple Projection Methods: Perspective, orthogonal, stereographic, and Schlegel projections
  • Interactive 3D Viewport: Mouse-controlled camera with zoom, pan, and rotation

Advanced Analysis Tools

  • Cross-section Analysis: Slice through 4D objects with 3D hyperplanes to reveal interior structure
  • Animation System: Smooth interpolation between transformation states with customizable easing
  • Performance Monitoring: Real-time FPS and vertex count tracking
  • Educational Interface: Built-in explanations of mathematical concepts

User Experience

  • Responsive Design: Optimized for desktop, tablet, and mobile devices
  • Keyboard Shortcuts: Quick access to common operations
  • Customizable Rendering: Toggle vertices, edges, faces, wireframe modes, and adjust opacity
  • Color Customization: Personalize the appearance with custom color schemes

๐ŸŽฏ Supported Shapes

4D Shapes

  • Tesseract (4D Cube): 16 vertices, 32 edges, 24 faces, 8 cells
  • 16-Cell (4D Cross-polytope): 8 vertices, 24 edges, 32 faces, 16 cells
  • 600-Cell: 120 vertices, 720 edges, 1200 faces, 600 cells
  • 120-Cell: 600 vertices, 1200 edges, 720 faces, 120 cells

5D Shapes

  • Penteract (5D Cube): 32 vertices, 80 edges, 80 faces, 40 cells, 10 hypercells
  • 5-Simplex (5D Tetrahedron): 6 vertices, 15 edges, 20 faces, 15 cells, 6 hypercells
  • 5-Orthoplex (5D Cross-polytope): 10 vertices, 40 edges, 80 faces, 80 cells, 32 hypercells
  • Custom Shapes: User-defined higher-dimensional objects

๐Ÿ›  Technology Stack

  • Frontend: React 18 with TypeScript
  • 3D Rendering: Three.js with WebGL
  • Styling: Tailwind CSS with custom components
  • Backend: Hono.js for API endpoints
  • Mathematics: Custom libraries for higher-dimensional calculations
  • Platform: Val Town serverless environment

๐Ÿš€ Getting Started

  1. Access the Application: Navigate to the deployed URL
  2. Choose Dimension: Select 4D or 5D from the control panel
  3. Select Shape: Pick from available geometric primitives using the shape buttons
  4. Explore Transformations: Use sliders to rotate, scale, and transform in real-time
  5. Analyze Cross-sections: Enable cross-section mode to slice through objects
  6. Customize Rendering: Adjust colors, opacity, and display options

๐ŸŽฎ Controls

Mouse Controls

  • Left Click + Drag: Rotate camera around the object
  • Scroll Wheel: Zoom in/out
  • Right Click + Drag: Pan camera (if implemented)

Keyboard Shortcuts

  • Space: Toggle auto-rotation animation
  • Ctrl+R: Reset all transformations to default
  • 1-4: Quick select shapes (Tesseract, 16-Cell, 600-Cell, 120-Cell)
  • V: Toggle vertex visibility
  • E: Toggle edge visibility
  • F: Toggle face visibility
  • W: Toggle wireframe mode
  • C: Toggle cross-section analysis
  • H: Show/hide help overlay

Control Panel Features

  • Shape Selection: Choose dimension and geometric primitive
  • Transformation Controls: 6 rotation planes for 4D, 10 for 5D
  • Projection Settings: Adjust projection distance and camera FOV
  • Cross-section Tools: Position hyperplane and analyze intersections
  • Rendering Options: Customize visual appearance with real-time updates

๐Ÿ“ Mathematical Background

This application implements advanced concepts from higher-dimensional geometry:

Projection Theory

  • Perspective Projection: Projects from nD to 3D using distance-based scaling
  • Orthogonal Projection: Simple coordinate dropping for quick visualization
  • Stereographic Projection: Maps hypersphere to hyperplane avoiding singularities

Transformation Mathematics

  • 4D Rotations: 6 rotation planes (XY, XZ, XW, YZ, YW, ZW)
  • 5D Rotations: 10 rotation planes with complex interaction matrices
  • Composite Transformations: Matrix multiplication for combined operations

Cross-sectional Analysis

  • Hyperplane Intersection: Calculate where nD objects intersect (n-1)D planes
  • Edge-Plane Intersection: Linear interpolation for precise intersection points
  • Topological Analysis: Understand interior structure through slicing

For detailed mathematical explanations, see MATHEMATICAL_CONCEPTS.md.

๐Ÿ— Project Structure

โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ index.ts              # Main API server with Hono
โ”‚   โ””โ”€โ”€ routes/               # API endpoints for calculations
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ App.tsx          # Main application component
โ”‚   โ”‚   โ”œโ”€โ”€ GeometryViewer.tsx # 3D visualization with Three.js
โ”‚   โ”‚   โ”œโ”€โ”€ ControlPanel.tsx  # User interface controls
โ”‚   โ”‚   โ””โ”€โ”€ CrossSection.tsx  # Cross-section analysis tools
โ”‚   โ”œโ”€โ”€ index.html           # Main HTML template with styling
โ”‚   โ”œโ”€โ”€ index.tsx            # Frontend entry point and initialization
โ”‚   โ””โ”€โ”€ style.css            # Additional CSS styles
โ”œโ”€โ”€ shared/
โ”‚   โ”œโ”€โ”€ math/
โ”‚   โ”‚   โ”œโ”€โ”€ geometry4d.ts    # 4D geometric calculations and shapes
โ”‚   โ”‚   โ”œโ”€โ”€ geometry5d.ts    # 5D geometric calculations and shapes
โ”‚   โ”‚   โ”œโ”€โ”€ projections.ts   # Projection algorithms and methods
โ”‚   โ”‚   โ””โ”€โ”€ transformations.ts # Transformation matrices and operations
โ”‚   โ”œโ”€โ”€ types.ts             # Shared TypeScript type definitions
โ”‚   โ””โ”€โ”€ utils.ts             # Utility functions and helpers
โ”œโ”€โ”€ MATHEMATICAL_CONCEPTS.md  # Detailed mathematical documentation
โ””โ”€โ”€ README.md                # This file

๐Ÿ”ง API Endpoints

  • GET /: Main application interface
  • GET /api/health: Application health check
  • GET /api/shapes/:dimension/:shape: Shape metadata and properties
  • POST /api/calculate: Mathematical computation endpoints
  • GET /api/performance: Performance monitoring data

๐ŸŽ“ Educational Value

This visualizer serves as an educational tool for:

Students

  • Spatial Reasoning: Develop intuition for higher-dimensional spaces
  • Mathematical Visualization: See abstract concepts in concrete form
  • Interactive Learning: Hands-on exploration of geometric properties

Educators

  • Teaching Aid: Demonstrate complex mathematical concepts visually
  • Curriculum Support: Supplement traditional geometry and topology courses
  • Research Tool: Explore new visualization techniques

Researchers

  • Prototype Development: Test new projection and rendering methods
  • Data Visualization: Apply techniques to high-dimensional datasets
  • Algorithm Validation: Verify mathematical calculations visually

โšก Performance Optimizations

Rendering Optimizations

  • Level of Detail (LOD): Reduce complexity for distant objects
  • Frustum Culling: Skip rendering of off-screen geometry
  • Instanced Rendering: Efficient handling of repeated elements
  • Adaptive Quality: Adjust rendering quality based on performance

Mathematical Optimizations

  • Matrix Caching: Reuse computed transformation matrices
  • Incremental Updates: Only recalculate changed elements
  • Web Workers: Offload heavy calculations to background threads
  • Memory Pooling: Reuse objects to reduce garbage collection

User Experience Optimizations

  • Progressive Loading: Load complex shapes incrementally
  • Responsive Controls: Debounced input handling for smooth interaction
  • Efficient State Management: Minimize unnecessary re-renders
  • Caching Strategy: Store computed results for quick access

๐ŸŒ Browser Compatibility

Recommended Browsers

  • Chrome 90+: Full WebGL 2.0 support with best performance
  • Firefox 88+: Complete feature support with good performance
  • Safari 14+: WebGL support with some limitations
  • Edge 90+: Full compatibility with Chrome engine

Required Features

  • WebGL 2.0: For advanced rendering capabilities
  • ES6 Modules: For modern JavaScript features
  • CSS Grid: For responsive layout design
  • Web Workers: For background mathematical calculations (optional)

๐Ÿ”ฎ Future Enhancements

Planned Features

  • 6D and Higher: Extend to even higher dimensions
  • Custom Shape Builder: User-defined geometric primitives
  • Animation Timeline: Keyframe-based transformation sequences
  • Export Capabilities: Save visualizations as images or videos
  • VR/AR Support: Immersive higher-dimensional exploration

Advanced Mathematics

  • Non-Euclidean Geometry: Hyperbolic and spherical spaces
  • Fractal Dimensions: Self-similar structures in higher dimensions
  • Topology Visualization: Manifolds, fiber bundles, and exotic spaces
  • Physics Applications: String theory and quantum field visualizations

Educational Enhancements

  • Guided Tours: Step-by-step exploration of concepts
  • Interactive Tutorials: Learn-by-doing mathematical lessons
  • Assessment Tools: Quiz and problem-solving features
  • Collaboration Features: Share and discuss visualizations

๐Ÿค Contributing

This project welcomes contributions from mathematicians, developers, and educators:

Areas for Contribution

  • Mathematical Accuracy: Verify and improve calculations
  • Performance Optimization: Enhance rendering and computation speed
  • Educational Content: Add explanations and learning materials
  • User Interface: Improve accessibility and usability
  • Documentation: Expand mathematical and technical documentation

Development Guidelines

  • Follow TypeScript best practices
  • Maintain mathematical accuracy and precision
  • Ensure cross-browser compatibility
  • Write comprehensive tests for mathematical functions
  • Document complex algorithms and mathematical concepts

๐Ÿ“š References and Further Reading

Mathematical Sources

  1. Coxeter, H.S.M. "Regular Polytopes" - Comprehensive reference for higher-dimensional geometry
  2. Branko Grรผnbaum "Convex Polytopes" - Advanced polytope theory
  3. Charles Howard Hinton "The Fourth Dimension" - Historical perspective on 4D visualization

Technical Resources

  1. Three.js Documentation - 3D rendering techniques
  2. WebGL Specification - Low-level graphics programming
  3. Linear Algebra References - Matrix operations and transformations

Educational Materials

  1. "Flatland" by Edwin Abbott - Introduction to dimensional thinking
  2. "Sphereland" by Dionys Burger - Extension to higher dimensions
  3. Online courses in topology and differential geometry

๐Ÿ“„ License

This project is open source and available under the MIT License. Feel free to use, modify, and distribute according to the license terms.

๐Ÿ™ Acknowledgments

  • Mathematical Community: For developing the theoretical foundations
  • Three.js Team: For providing excellent 3D rendering capabilities
  • Val Town Platform: For hosting and serverless infrastructure
  • Open Source Contributors: For tools and libraries that made this possible

Explore the fascinating world of higher-dimensional geometry! ๐ŸŒŒ

For questions, suggestions, or collaboration opportunities, please reach out through the platform's communication channels.

HTTP
  • index.ts
    spooky--fcโ€ฆd9.web.val.run
Code
backendfrontendsharedFEATURES_SUMMARY.mdMATHEMATICAL_CONCEPTS.mdREADME.md
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
Weโ€™re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
ยฉ 2025 Val Town, Inc.