Add ImplicitSurface class for 3D implicit surface visualization #4499
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a new
ImplicitSurfacemobject that enables visualization of 3D surfaces defined by implicit functionsf(x, y, z) = 0, analogous to howImplicitFunctionhandles 2D implicit curves.Key Features
verify_surface()for accuracy validationNew Dependency
pymcubes>=0.1.0- Fast, lightweight marching cubes implementationExample Usage
Rendered Examples
Sphere (unit sphere with 3D axes):

Torus (major radius 2, minor radius 0.5):

Gyroid (minimal surface with salmon-to-pink gradient):

Files Changed
manim/mobject/three_d/implicit_surface.py- Main implementationmanim/mobject/opengl/opengl_implicit_surface.py- OpenGL renderer supporttests/module/mobject/test_implicit_surface.py- 10 unit teststests/test_graphical_units/test_threed.py- Graphical regression testsexample_scenes/implicit_surface_examples.py- 6 example scenespyproject.toml- Added pymcubes dependencyTest Plan
pytest tests/module/mobject/test_implicit_surface.py)ruff check)Related
ImplicitFunctionfor 2D curvesSurfaceclass for parametric surfaces