High-performance physics simulation library with a C++ core engine and Pythonic API.
Project description
🌟 pylumina
High-performance physics simulation library — C++ engine, Pythonic API.
pylumina is a physics simulation library that pairs a C++ numerical engine with a clean Python API, giving you the best of both worlds: blazing-fast computation and expressive scripting.
✨ Features
| Feature | Description |
|---|---|
| Collisions & Resolution | Analytical narrow-phase (Sphere-Sphere, Sphere-Plane, Box-Box) with impulse resolution. |
| NumPy Batch Processing | Simulate 100,000+ particles instantly mapping NumPy arrays to C++ SoA layout. |
| Data Export (VTK/HDF5) | Auto-export history. Play back simulations directly in ParaView! |
| CLI Runner | Run scripts with pylumina run script.py --output out/ --format vtk. |
| Rigid Body Dynamics | Full motion: linear + angular velocity, moments of inertia. |
| Forces (Gravity, Wind, Drag) | Built-in physically accurate forces. |
| pybind11 | Zero-copy C++ ↔ Python bridge for minimal overhead. |
🚀 Installation
Prerequisites
| Tool | Version |
|---|---|
| Python | ≥ 3.8 |
| C++ compiler | C++17 capable (GCC ≥ 7, Clang ≥ 5, MSVC ≥ 2017) |
| CMake | ≥ 3.15 |
Install from source
# Clone the repository
git clone https://github.com/yourusername/pylumina.git
cd pylumina
# Install (builds C++ extension automatically)
pip install .
# For HDF5 export support:
pip install .[hdf5]
🎯 Quick Start
Check out the full Usage Guide for detailed tutorials.
from pylumina import Simulation
sim = Simulation()
sim.enable_gravity(y=-9.81)
sim.enable_collisions(True, restitution=0.8)
# Add Ground
sim.add_plane(normal=(0, 1, 0), offset=0)
# Add Ball
ball = sim.add_particle("tennis_ball", position=(0, 10, 0), mass=1.0)
sim.add_sphere(ball, radius=0.5)
# Simulate for 5 seconds
sim.run(steps=500, dt=0.01)
print(f"Final vertical position: {ball.position.y:.2f} m")
🖥️ Command-Line auto-export
Pylumina has a built in CLI tool that automatically captures simulation history and exports it.
# In your script, enable recording:
# sim.enable_recording()
# Run the script via the CLI
pylumina run my_script.py --output results/ --format vtk
# It will automatically generate ParaView-compatible VTK files!
📁 Documentation
Read the rest of our dedicated documentation!
- 📖 Usage & API Guide: comprehensive tutorial of all features.
- 🏗️ Architecture: learn how the C++ ↔ Python pipeline works.
🗺️ Roadmap
- Constraint solver (springs, joints)
- Broad-phase collision culling (Spatial partitioning/Octree)
- GPU acceleration (CUDA)
- WASM build for browser demos
🤝 Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/awesome) - Commit your changes
- Push to the branch
- Open a Pull Request
📄 License
This project is licensed under the MIT License — see LICENSE for details.
pylumina — illuminate your physics simulations ✨
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file pylumina-0.2.0.tar.gz.
File metadata
- Download URL: pylumina-0.2.0.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd5adc866908781ea50f009a5745d4ce72496664fb90932fb8c45149e713060a
|
|
| MD5 |
71695ffd3bf2897c33a2c2d052dfbeb6
|
|
| BLAKE2b-256 |
7b4ba67bcc6e557101fe92a52f651d8701bb301efc80f16b234471c441098b88
|