Skip to content

Instantly share code, notes, and snippets.

View uwezi's full-sized avatar

Uwe Zimmermann uwezi

View GitHub Profile
@uwezi
uwezi / 20250123_openglsphere.py
Last active January 23, 2025 19:41
[openglSphere] A sphere for the opengl renderer. #manim #3D #sphere #opengl
# https://discord.com/channels/581738731934056449/1332024484496150589/1332024484496150589
from manim import *
from manim.opengl import *
config.renderer="opengl"
config.write_to_movie=True
class openglSphere(OpenGLSurface):
def __init__(self, radius=1, **kwargs):
def uvfunc(u,v):
return radius * np.array([np.cos(v)*np.cos(u),np.cos(v)*np.sin(u),np.sin(v)])
@uwezi
uwezi / 20241218_theodorus.py
Last active January 18, 2025 23:30
[Theodorus spiral] A geometric construction. #manim #geometry
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
@uwezi
uwezi / 20241229_brace3d.py
Created December 30, 2024 08:20
[Brace3D II] A flexible brace object for 3D. #manim #3D #brace
from manim import *
class Brace3D(Brace):
def __init__(self, line, rotation=0, **kwargs):
flatline = Line(ORIGIN, line.get_length()*RIGHT)
super().__init__(flatline, direction=np.array([0., -1., 0.]), **kwargs)
dline = line.get_end()-line.get_start()
self.rotate(angle=rotation, about_point=flatline.get_start(),axis=RIGHT)
self.rotate(-np.asin(dline[2]/np.linalg.norm(dline)), about_point=flatline.get_start(), axis=UP)
self.rotate(np.atan2(dline[1],dline[0]), about_point=flatline.get_start(), axis=OUT)
@uwezi
uwezi / 20241202_itheta.py
Last active March 31, 2025 12:14
[Rationale] Visualization of e^(iθ)+e^(n iθ). #manim #animation #complex #math
# https://discord.com/channels/581738731934056449/585955412436713495/1312571596287774781
# https://youtube.com/shorts/dzjnM2EDDpE?si=_M8UHJR_ku6y2qIx
from manim import *
config.frame_rate=60
class compass2(Scene):
def construct(self):
l = 2
n = np.sqrt(2) # speed multiplier on second arm
θ = ValueTracker(0)
def Zfunc(x):
@uwezi
uwezi / 20241119_brace3d.py
Last active November 19, 2024 19:34
[Brace 3D] Braces in 3D. #manim #brace3d #brace #threedscene #3D
class brace3D(ThreeDScene):
def construct(self):
axes = ThreeDAxes(
x_range=[-5,5,1],
y_range=[-5,5,1],
z_range=[-5,5,1]
)
self.set_camera_orientation(phi=75 * DEGREES, theta=-45 * DEGREES)
self.add(axes)
@uwezi
uwezi / 20241119_timer.py
Created November 19, 2024 10:31
[timer] A Timer mobject. #manim #animate #decimalnumber #timer
# https://discord.com/channels/581738731934056449/1308355923583963197/1308355923583963197
from manim import *
class Timer(VGroup):
def __init__(self, starttime=99, countdown=True, run=True):
super().__init__()
self.currenttime = starttime
self.starttime = starttime
self.countdown = countdown
self.dorun = run
self.minten = DecimalNumber(0,num_decimal_places=0)
@uwezi
uwezi / 20241029_latex.py
Last active October 29, 2024 22:02
[Aligned LaTeX] Different alignments in LaTeX. #manim #latex #tex #flushleft #flushright #center #minipage
from manim import *
class myParagraph(Scene):
def construct(self):
paragraph = Tex(r'''{12em}
No, this is an awesome paragraph with \\ Newlines and Alignments\\
\begin{center}
center
\end{center}
@uwezi
uwezi / 20241024_intersections.py
Last active October 24, 2024 19:56
[Intersection helpers] Intersections between lines and circles. #manim #geometry #math #circle #line
from manim import *
def circle_line_intersection(circle: Circle, line: Line):
# source https://mathworld.wolfram.com/Circle-LineIntersection.html
cline = line.copy().shift(-circle.get_arc_center())
x0,y0 = circle.get_arc_center()[0:2]
x1,y1 = cline.get_start()[0:2]
x2,y2 = cline.get_end()[0:2]
r = circle.width/2
@uwezi
uwezi / 20241024_heptadecagon.py
Last active October 24, 2024 18:15
[Heptadecagon] Geometric construction of a heptadecagon. #manim #animation #geometry #circle #intersection #line #compass
from manim import *
# https://discord.com/channels/581738731934056449/1298699478194196612/1298699478194196612
class heptadecagon(MovingCameraScene):
def construct(self):
# after https://www.youtube.com/watch?v=xGUWVPOks00 AleeDrawing
self.add(NumberPlane().add_coordinates())
def circle_line_intersection(circle, line):
# source https://mathworld.wolfram.com/Circle-LineIntersection.html
cline = line.copy().shift(-circle.get_arc_center())
@uwezi
uwezi / 20231006_computer_02.svg
Last active October 18, 2024 19:38
[Computer] Animated sequence of a computer adding two numbers. #manim #svg #animate
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.