3b1b-manim/sample_script.py

33 lines
834 B
Python
Raw Normal View History

2015-06-10 22:00:35 -07:00
#!/usr/bin/env python
import numpy as np
import itertools as it
from copy import deepcopy
import sys
from animation import *
from mobject import *
from constants import *
from region import *
2015-06-19 08:31:02 -07:00
from scene import Scene, GraphScene
2015-06-10 22:00:35 -07:00
from script_wrapper import command_line_create_scene
2015-06-19 08:31:02 -07:00
class SampleScene(GraphScene):
2015-06-10 22:00:35 -07:00
def construct(self):
2015-06-19 08:31:02 -07:00
GraphScene.construct(self)
self.generate_regions()
self.generate_dual_graph()
self.generate_spanning_tree()
self.add(self.spanning_tree)
for count in range(len(self.regions)):
self.add(tex_mobject(str(count)).shift(self.dual_points[count]))
for count in range(len(self.edges)):
self.add(tex_mobject(str(count)).shift(self.edges[count].get_center()))
2015-06-10 22:00:35 -07:00
if __name__ == "__main__":
2015-06-19 08:31:02 -07:00
command_line_create_scene()