Spaces:
Sleeping
Sleeping
File size: 6,205 Bytes
252429d 112e757 252429d f00b2e2 252429d d7d27f0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | ---
title: Ideal Polyhedron Volume Toolkit
emoji: πΊ
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
license: mit
---
# Ideal Polyhedra Volume Toolkit
A Python toolkit for computing and optimizing volumes of ideal hyperbolic polyhedra using Delaunay triangulation, hull projection, and fast/exact Lobachevsky functions.
## Installation
Install the package in development mode:
```bash
pip install -e .
```
Dependencies: `numpy`, `scipy`, `mpmath`, `torch`
## Project Structure
```
ideal_poly_volume_toolkit/
βββ ideal_poly_volume_toolkit/ # Core package
β βββ geometry.py # Core geometry and volume computation functions
β βββ visualization.py # 3D visualization utilities
β βββ rivin_holonomy.py # Penner-Rivin holonomy computation
β βββ pointset_to_fuchsian.py # Full Fuchsian group pipeline
β βββ __init__.py
β
βββ bin/ # Command-line tools and GUI
β βββ gui.py # π¨ Interactive Gradio web interface
β βββ optimize_polyhedron.py # General optimization wrapper
β βββ analyze_distribution.py # Distribution analysis wrapper
β βββ README.md
β
βββ examples/ # Organized example scripts
β βββ distributions/ # Distribution analysis examples
β β βββ tetrahedron/ # Tetrahedron volume distributions
β β βββ five_vertex/ # 5-vertex polyhedra distributions
β β βββ six_vertex/ # 6-vertex polyhedra distributions
β β βββ euclidean/ # Euclidean tetrahedra analysis
β βββ optimization/ # Optimization examples by vertex count
β β βββ 7vertex/ # 7-vertex optimization (octahedron variants)
β β βββ 12vertex/ # 12-vertex optimization
β β βββ 20vertex/ # 20-vertex optimization (icosahedron)
β β βββ platonic/ # Platonic solid analysis
β βββ visualization/ # Visualization scripts
β βββ analysis/ # Statistical and theoretical analysis
β
βββ scripts/ # Active research/development scripts
βββ results/ # Output files
β βββ data/ # JSON configuration files
β βββ plots/ # PNG visualization outputs
β βββ logs/ # Optimization logs
βββ docs/ # Documentation
βββ RESULTS_SUMMARY.md
βββ PLATONIC_MAXIMALITY_RESULTS.md
```
## Core Functionality
### `ideal_poly_volume_toolkit.geometry` - Volume Computation
- **Stereographic projection**: `lift_to_sphere_with_inf()`, `inverse_stereographic_from_sphere_pts()`
- **Triangulation**: `delaunay_triangulation_indices()`, `hull_tris_projected_back()`
- **Lobachevsky function**: `lob_fast()` (PyTorch autodiff), `lob_exact()` (mpmath high-precision)
- **Volume computation**:
- `triangle_volume_from_points()` - Single triangle volume
- `ideal_poly_volume_via_delaunay()` - Full polyhedron via Delaunay
- `ideal_poly_volume_via_hull_project_back()` - Full polyhedron via convex hull
### `ideal_poly_volume_toolkit.rivin_holonomy` - Penner-Rivin Algorithm
- **Holonomy computation**: `generators_from_triangulation()` - Compute Fuchsian group generators
- **Arithmeticity testing**: Check if polyhedra have arithmetic holonomy (traces in number fields)
- **Triangulation structures**: `Triangulation` class for managing ideal triangulations
### `ideal_poly_volume_toolkit.pointset_to_fuchsian` - Full Pipeline
- **Group computation**: `group_from_pointset()` - Convert point sets to Fuchsian groups
- **Trace field analysis**: `invariant_trace_field_signature()` - Analyze arithmetic properties
- **Visualization**: `render_snapshot()` - High-quality rendering with iridescence and transparency
- **Mesh export**: `hull_to_mesh()`, `export_mesh_obj()` - Export to OBJ format
## Quick Start
### π¨ Interactive GUI (Easiest)
The fastest way to get started is with the Gradio web interface:
```bash
python bin/gui.py
```
Then open your browser to `http://127.0.0.1:7860`
**Features:**
- Interactive optimization with real-time progress
- Distribution analysis with automatic plotting
- 3D visualization in sphere and PoincarΓ© ball models
- No need to remember command-line arguments!
### Command-Line Tools
For scripting and batch processing, use the wrapper scripts in `bin/`:
```bash
# Optimize a 7-vertex polyhedron (10 trials)
python bin/optimize_polyhedron.py --vertices 7 --trials 10
# Analyze volume distribution for tetrahedra
python bin/analyze_distribution.py --vertices 4 --samples 10000
# Get help on any tool
python bin/optimize_polyhedron.py --help
```
See `bin/README.md` for detailed usage and examples.
### Computing a volume (Python API)
```python
import numpy as np
from ideal_poly_volume_toolkit.geometry import ideal_poly_volume_via_delaunay
# Define vertices in the complex plane (stereographic projection)
vertices = np.array([0.0+0.0j, 1.0+0.0j, 0.5+0.866j])
volume = ideal_poly_volume_via_delaunay(vertices)
print(f"Volume: {volume}")
```
### Running examples
Examples are organized by topic. For instance:
```bash
# 7-vertex optimization
cd examples/optimization/7vertex
python optimize_7vertex.py
# Tetrahedron distribution analysis
cd examples/distributions/tetrahedron
python tetrahedron_volume_distribution.py
# Visualization
cd examples/visualization
python visualize_golden_config.py
```
## Key Examples
- **7-vertex optimization**: Testing the hypothesis that the maximum volume is an octahedron with one stellated face
- **20-vertex optimization**: Finding maximal volume configurations for icosahedron-like polyhedra
- **Distribution analysis**: Statistical analysis of volume distributions for various polyhedra
- **Platonic solids**: Analysis of regular polyhedra and their perturbations
## Research Results
See `docs/RESULTS_SUMMARY.md` and `docs/PLATONIC_MAXIMALITY_RESULTS.md` for detailed findings.
## License
See LICENSE file.
|