This file contains 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
def H(z,a,b,l): | |
''' | |
from https://codegolf.stackexchange.com/questions/11767/the-centers-of-a-triangle | |
1 - Incenter | |
2 - Centroid | |
3 - Circumcenter | |
4 - Orthocenter | |
5 - Equation of Euler Line | |
(if the Euler Line is vertical, output the `x` value of the line |
This file contains 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 scipy import signal | |
class stepResponse(Scene): | |
def construct(self): | |
T = np.linspace(0,10,1000) | |
sys = signal.TransferFunction([1,3,3], [1,2,1]) | |
t, y1 = sys.impulse(T=T) | |
t, y2 = sys.step(T=T) | |
ax = Axes( | |
x_range=[-1,12,1], | |
x_length=[13], |
This file contains 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 * | |
# by dudewaldo4 | |
# https://discord.com/channels/581738731934056449/976376734935048223/1161709114154569819 | |
# https://www.youtube.com/watch?v=Bg999qefIic | |
# | |
def ir(a,b): # inclusive range, useful for TransformByGlyphMap | |
return list(range(a,b+1)) |
This file contains 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/1096718885606150154/1096718885606150154 | |
class arc3d(VMobject): | |
def __init__(self, A=None, B=None, center=None, radius=1, segments=40, **kwargs): | |
super().__init__(**kwargs) | |
start = center + (A-center)*radius/np.linalg.norm(A-center) | |
end = center + (B-center)*radius/np.linalg.norm(B-center) | |
self.set_points([start]) | |
for i in np.linspace(0,1,segments,endpoint=True): |
This file contains 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.mobject.text.numbers import string_to_mob_map as cache | |
# https://discord.com/channels/581738731934056449/1243063440206073907/1243210818837811230 | |
class numText(Text): | |
def __init__(self, text: str, **kwargs) -> None: | |
print('hello') | |
super().__init__(text, font="Roboto", **kwargs) | |
class Test(Scene): | |
def construct(self): |
This file contains 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
class inoutcircleTriangle(Scene): | |
def construct(self): | |
triangle = VMobject() | |
incirc = VMobject() | |
outcirc = VMobject() | |
for i in range(5): | |
A = np.array([np.random.uniform(-5,5),np.random.uniform(-3,3),0]) | |
B = np.array([np.random.uniform(-5,5),np.random.uniform(-3,3),0]) | |
C = np.array([np.random.uniform(-5,5),np.random.uniform(-3,3),0]) | |
a = np.linalg.norm(B-C) |
This file contains 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 * | |
import sys | |
class findpython(Scene): | |
def construct(self): | |
text = Text(sys.executable).scale_to_fit_width(14) | |
self.add(text) |
This file contains 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
import cv2 | |
from PIL import Image, ImageOps | |
from dataclasses import dataclass | |
@dataclass | |
class VideoStatus: | |
time: float = 0 | |
videoObject: cv2.VideoCapture = None | |
def __deepcopy__(self, memo): | |
return self |
This file contains 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 * | |
class PathFinder(MovingCameraScene): | |
def construct(self): | |
# thanks ChatGPT | |
def closest_neighbor(given_point, points): | |
# Convert points to numpy array for efficient calculations | |
points_array = np.array(points) | |
# Calculate Euclidean distance between given_point and all points |
This file contains 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
# https://discord.com/channels/581738731934056449/1214983872413044786/1214983872413044786 | |
from manim import * | |
class PathAutoSorted(MovingCameraScene): | |
def construct(self): | |
# thanks ChatGPT | |
def closest_neighbor(given_point, points): | |
# Convert points to numpy array for efficient calculations | |
points_array = np.array(points) |
NewerOlder