Last active
January 18, 2025 23:30
-
-
Save uwezi/3841c528b7ade9e1d310155037b192c2 to your computer and use it in GitHub Desktop.
[Theodorus spiral] A geometric construction. #manim #geometry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from manim import * | |
# https://discord.com/channels/581738731934056449/1318716633912573953/1318882699775311962 | |
class TheodorusSpiralDebug(Scene): | |
def construct(self): | |
# Initialize variables | |
origin_dot = Dot(point=ORIGIN) | |
last_line = Line(start=ORIGIN, end=RIGHT/2) | |
last_point = RIGHT/2 | |
# Add starting dot and first line segment | |
self.add(origin_dot) | |
self.play(last_line.animate()) | |
self.add(Dot(RIGHT/2)) | |
for _ in range(1, 17): # Adjust range for more triangles | |
# Create hypotenuse and oposite sides | |
#oposite_side = Line.perpendicular_to(last_line, last_point, length=0.5) | |
oposite_side = last_line.copy().scale(0.5/last_line.get_length(), about_point=last_point).rotate(90*DEGREES, about_point=last_point) | |
Hypotenuse = Line(oposite_side.get_end(), ORIGIN) | |
# Render hypotenuse and oposite sides | |
self.play(oposite_side.animate()) | |
self.play(Hypotenuse.animate()) | |
# Update variables | |
last_line = Hypotenuse | |
last_point = oposite_side.get_end() | |
# Add title | |
title = Text("Theodorus Spiral").to_edge(UP) | |
self.play(Write(title)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment