A Manim extension for creating astronomical visualizations
Project description
🌌 Astronomy Plugin for Manim
✨ A Manim Extension for Creating Astronomical Visualizations
⚠️ Currently in Development: This plugin is a work in progress. Features and functionality may change as we refine the project!
⚠️ Disclaimer
This plugin is not a scientific simulation tool and may not depict accurate physics or astronomical phenomena. It is designed for visualization purposes only. For accurate astronomical simulations, consider using specialized tools!
Features
- 🪐 Elliptical Orbits: Visualize planetary orbits with elliptical paths.
- 🌟 Celestial Bodies: Create and animate stars, planets, moons, and more in a 3D space.
- ☀️ Solar System Models: Build solar system representations .
- 🕳️ Space-Time Grids: Visualize the concept of spacetime curvature using space-time grids.
Installation
pip install manim-Astronomy
Usage
Here's a quick example of how to use the plugin to create an animation of a planet orbiting a star:
from manim import *
from manim_Astronomy.stellar_objects import Planet,Star
config.renderer = "opengl"
class KeplersSecondLaw(ThreeDScene):
def construct(self):
star = Star(radius=1, size_of_particle=0.001, colors=[YELLOW])
self.add(star)
planet = Planet(center=[1, 0, 0], radius=0.05)
self.add(planet)
a = 4
b = 6
orbit = ParametricFunction(
lambda t: np.array([a * np.cos(t), b * np.sin(t), 0]),
t_range=[0, TAU],
color=BLUE
)
self.add(orbit)
last_pos = [orbit.point_from_proportion(1)]
def trace(mob):
curr_pos = mob.get_center()
self.add(Line3D(last_pos[0], curr_pos, color=BLUE))
last_pos[0] = curr_pos
time_tracker = ValueTracker(0)
planet.add_updater(lambda mob: mob.move_to(orbit.point_from_proportion(time_tracker.get_value())))
def get_swept_sector(start, end, close_factor=0.1):
num_points = 50
start = np.clip(start, 0, 1)
end = np.clip(end, 0, 1)
points = [orbit.point_from_proportion(start)]
for alpha in np.linspace(start, end, num_points):
points.append(orbit.point_from_proportion(alpha))
last_point = orbit.point_from_proportion(end)
closing_point = last_point * close_factor
points.append(closing_point)
return Polygon(*points, fill_opacity=0.3, color=YELLOW)
sweep_intervals = [(0.1, 0.2), (0.4, 0.5), (0.7, 0.8)]
cumulative_sweep = VGroup()
def update_swept_area():
current_time = time_tracker.get_value()
for start, end in sweep_intervals:
if start <= current_time <= end:
new_swept_area = get_swept_sector(start, current_time)
cumulative_sweep.add(new_swept_area)
return cumulative_sweep
sweep_area = always_redraw(lambda: update_swept_area())
self.add(sweep_area)
self.move_camera(phi=70 * DEGREES, theta=-90 * DEGREES)
planet.add_updater(trace)
self.play(time_tracker.animate.set_value(1), run_time=5, rate_func=linear)
self.wait(5)
📚 Documentation
For detailed documentation, please visit: Documentation Link
Main Components
- Planet: Create spherical objects representing planets.
- Star: Create a Star using particles.
- SpaceTimeFabric: A grid-like representation of space-time, often used to demonstrate the concept of gravitational curvature.
Contributing
We welcome contributions! Please submit issues or pull requests to help improve the plugin. Make sure to follow our contribution guidelines for code style and testing. 🤝
License
This project is licensed under the MIT License - see the LICENSE file for details. 📜
Credits
Developed by Hassam ul Haq. Special thanks to the Manim Community for making this project possible! 🌟
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file manim_astronomy-0.0.5.tar.gz.
File metadata
- Download URL: manim_astronomy-0.0.5.tar.gz
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7011b254e5851a1f328314c05ef9b1cb936027baf98d91a6560b3e3e7b3052f6
|
|
| MD5 |
39fe8c29f5e145e7d4713af9bf98eb50
|
|
| BLAKE2b-256 |
f50513c3428c716c9467b21f0ee875240652c2ef7625f088d05a6d5917bb15eb
|
File details
Details for the file manim_astronomy-0.0.5-py3-none-any.whl.
File metadata
- Download URL: manim_astronomy-0.0.5-py3-none-any.whl
- Upload date:
- Size: 1.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
740238e30be5bf08b4d206de1c7745ffcb05d1711c5f0bec79106c29e123eff9
|
|
| MD5 |
292b10eae51a24cd84ee09fe5233f2f5
|
|
| BLAKE2b-256 |
9afafc7f10dc7129ea36405443be085458a8c1b06172fafbb54358ca987e171d
|