a replacement to lamination builder that uses manim instead of the browser
Project description
This is a re-implementation of lamination-builder that runs in python without dependencies on a browser and focusing on animations and convenient generation of figures. Instead it uses Manim, and which has several dependencies.
Installation:
Please refer to to manim's installation instructions. It and its dependencies are required, with the possible exception of tex. Afterward, you can simply run
pip install manim_lamination_builder
Example Uses:
render multiple laminations in one image
python -m manim_lamination_builder file.json5
The input format is as follows: A json or json5 list of laminations to be placed in the figure (tilling is a best effort left to right and top to bottom placemen). The blank lamination is permitted.
[
{
polygons:[["_001","_010","_100"]],
chords:[["_1","2"]],
points: ["3"],
radix: 4
},
{
"polygons": [["0_003", "0_030", "0_300"],
["1_003", "3_030", "3_300"],
["2_003", "2_030", "2_300"],
["3_003", "1_030", "1_300"]],
"chords": [],
"points": [],
"radix": 4
},
{ radix: 4}
]
generate and render laminations to verify my research
from manim import tempconfig
from manim_lamination_builder import generate_unicritical_lamination, Main
with tempconfig({"quality": "high_quality", "preview": True}):
Main(generate_unicritical_lamination(4, 3)).render()
animate the leaves and points moving to their images
Please note that the animation does over its duration what sigma_3 does in one step. Moreover, this relies on the understanding that sigma_d is a dilation of angular position with wrapping (by a factor of d). So the forgotten digit is recorded and used to determine how many times to wrap around, which might not always be desirable.
from manim import Scene, WHITE, tempconfig
from manim_lamination_builder import (
parse_lamination,
curried_colorize_with_respect_to,
sigma,
AnimateLamination,
)
class MyScene(Scene):
def construct(self):
initial = parse_lamination(
'{polygons: [["_200","_002","_020"]], points:[0.1,"200","201"], radix: 3 }'
)
initial.auto_populate()
initial.colorizer = curried_colorize_with_respect_to(initial.polygons[0])
final = initial.apply_function(sigma)
mob = initial.build(3)
mob.submobjects[2].set_color("#008080")
self.add(mob)
self.wait(2)
self.play(AnimateLamination(initial, final, start_mobject=mob, run_time=5))
self.wait(2)
with tempconfig(
{"quality": "high_quality", "preview": True, "background_color": WHITE}
):
scene = MyScene()
scene.render()
Developments
Feature requests will be entertained, however this is intended to be used in combination with other tools like latex and your own python scripts. I hope this is a reasonable API.
License
Licensed under the The AGPLv3 License (AGPLv3) Copyright (c) 2023 Forrest M. Hilton forrestmhilton@gmail.com You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.
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
Built Distribution
File details
Details for the file manim_lamination_builder-0.2.6.tar.gz
.
File metadata
- Download URL: manim_lamination_builder-0.2.6.tar.gz
- Upload date:
- Size: 48.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9e9a76b111d42dcb099f7ef9d3185cde811ec142c57136884d37899b26e68de |
|
MD5 | adf2955f7f2f890ee8e20c645db48530 |
|
BLAKE2b-256 | d8f71136bd5214a1df62e4e5c70f1b2287c2d16068a1f6f10a3963889f92443d |
File details
Details for the file manim_lamination_builder-0.2.6-py3-none-any.whl
.
File metadata
- Download URL: manim_lamination_builder-0.2.6-py3-none-any.whl
- Upload date:
- Size: 39.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d11cf0d0863c3e63770247adced76539e93dba4d524d5060e1547a44b1cfd35 |
|
MD5 | 0b88def934f7989ab424b2302d1937df |
|
BLAKE2b-256 | 76a5b6ff19579ffa0e0f4fc0a728176532e7ec30786de9f33ec84788929a0c8a |