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.
- 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
- 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
- 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
- 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
- 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
- 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
- Access the Application: Navigate to the deployed URL
- Choose Dimension: Select 4D or 5D from the control panel
- Select Shape: Pick from available geometric primitives using the shape buttons
- Explore Transformations: Use sliders to rotate, scale, and transform in real-time
- Analyze Cross-sections: Enable cross-section mode to slice through objects
- Customize Rendering: Adjust colors, opacity, and display options
- Left Click + Drag: Rotate camera around the object
- Scroll Wheel: Zoom in/out
- Right Click + Drag: Pan camera (if implemented)
- 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
- 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
This application implements advanced concepts from higher-dimensional geometry:
- 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
- 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
- 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.
├── 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
GET /
: Main application interfaceGET /api/health
: Application health checkGET /api/shapes/:dimension/:shape
: Shape metadata and propertiesPOST /api/calculate
: Mathematical computation endpointsGET /api/performance
: Performance monitoring data
This visualizer serves as an educational tool for:
- Spatial Reasoning: Develop intuition for higher-dimensional spaces
- Mathematical Visualization: See abstract concepts in concrete form
- Interactive Learning: Hands-on exploration of geometric properties
- Teaching Aid: Demonstrate complex mathematical concepts visually
- Curriculum Support: Supplement traditional geometry and topology courses
- Research Tool: Explore new visualization techniques
- Prototype Development: Test new projection and rendering methods
- Data Visualization: Apply techniques to high-dimensional datasets
- Algorithm Validation: Verify mathematical calculations visually
- 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
- 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
- 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
- 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
- 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)
- 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
- 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
- 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
This project welcomes contributions from mathematicians, developers, and educators:
- 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
- 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
- Coxeter, H.S.M. "Regular Polytopes" - Comprehensive reference for higher-dimensional geometry
- Branko Grünbaum "Convex Polytopes" - Advanced polytope theory
- Charles Howard Hinton "The Fourth Dimension" - Historical perspective on 4D visualization
- Three.js Documentation - 3D rendering techniques
- WebGL Specification - Low-level graphics programming
- Linear Algebra References - Matrix operations and transformations
- "Flatland" by Edwin Abbott - Introduction to dimensional thinking
- "Sphereland" by Dionys Burger - Extension to higher dimensions
- Online courses in topology and differential geometry
This project is open source and available under the MIT License. Feel free to use, modify, and distribute according to the license terms.
- 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.