mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
tiling space with hilbert curve
This commit is contained in:
parent
d6d47e4e06
commit
74c84b48cb
1 changed files with 60 additions and 6 deletions
|
@ -10,9 +10,9 @@ from animation import Animation
|
||||||
from animation.transform import \
|
from animation.transform import \
|
||||||
Transform, CounterclockwiseTransform, ApplyMethod,\
|
Transform, CounterclockwiseTransform, ApplyMethod,\
|
||||||
GrowFromCenter, ClockwiseTransform, ApplyPointwiseFunction, \
|
GrowFromCenter, ClockwiseTransform, ApplyPointwiseFunction, \
|
||||||
ShrinkToCenter
|
ShrinkToCenter, ShimmerIn, FadeOut, FadeIn
|
||||||
from animation.simple_animations import \
|
from animation.simple_animations import \
|
||||||
ShowCreation, ShimmerIn, FadeOut, FadeIn, Homotopy
|
ShowCreation, Homotopy
|
||||||
from animation.meta_animations import \
|
from animation.meta_animations import \
|
||||||
DelayByOrder, TransformAnimations
|
DelayByOrder, TransformAnimations
|
||||||
from animation.playground import Vibrate
|
from animation.playground import Vibrate
|
||||||
|
@ -945,12 +945,66 @@ class FormalDefinitionOfHilbertCurve(Scene):
|
||||||
|
|
||||||
class ThreeThingsToProve(Scene):
|
class ThreeThingsToProve(Scene):
|
||||||
def construct(self):
|
def construct(self):
|
||||||
|
definition = TexMobject([
|
||||||
|
"\\text{HC}(", "x", ")",
|
||||||
|
"=\\lim_{n \\to \\infty}\\text{PHC}_n(", "x", ")"
|
||||||
|
])
|
||||||
|
definition.to_edge(UP)
|
||||||
|
definition.split()[1].highlight(BLUE)
|
||||||
|
definition.split()[-2].highlight(BLUE)
|
||||||
intro = TextMobject("Three things need to be proven")
|
intro = TextMobject("Three things need to be proven")
|
||||||
|
prove_that = TextMobject("Prove that HC is $\\dots$")
|
||||||
|
prove_that.scale(0.7)
|
||||||
|
prove_that.to_edge(LEFT)
|
||||||
items = TextMobject([
|
items = TextMobject([
|
||||||
"\\begin{enumerate}",
|
"\\begin{enumerate}",
|
||||||
"\\item Points on Pseudo-Hilbert-curves really do converge",
|
"\\item Well-define: ",
|
||||||
"\\item Limit function HC is continuous",
|
"Points on Pseudo-Hilbert-curves really do converge",
|
||||||
"\\item Limit function HC touches all points in the unit square"
|
"\\item A Curve: ",
|
||||||
|
"HC is continuous",
|
||||||
|
"\\item Space-filling: ",
|
||||||
|
"Each point in the unit square is an output of HC",
|
||||||
"\\end{enumerate}",
|
"\\end{enumerate}",
|
||||||
])
|
]).split()
|
||||||
|
items[1].highlight(GREEN)
|
||||||
|
items[3].highlight(YELLOW_C)
|
||||||
|
items[5].highlight(MAROON)
|
||||||
|
Mobject(*items).to_edge(RIGHT)
|
||||||
|
|
||||||
|
self.add(definition)
|
||||||
|
self.play(ShimmerIn(intro))
|
||||||
|
self.dither()
|
||||||
|
self.play(Transform(intro, prove_that))
|
||||||
|
for item in items[1:-1]:
|
||||||
|
self.play(ShimmerIn(item))
|
||||||
|
self.dither()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class TilingSpace(Scene):
|
||||||
|
def construct(self):
|
||||||
|
coords_set = [ORIGIN]
|
||||||
|
for n in range(int(2*SPACE_WIDTH)):
|
||||||
|
for vect in UP, RIGHT:
|
||||||
|
for k in range(n):
|
||||||
|
new_coords = coords_set[-1]+((-1)**n)*vect
|
||||||
|
coords_set.append(new_coords)
|
||||||
|
square = Square(side_length = 1, color = WHITE)
|
||||||
|
squares = Mobject(*[
|
||||||
|
square.copy().shift(coords)
|
||||||
|
for coords in coords_set
|
||||||
|
]).ingest_sub_mobjects()
|
||||||
|
self.play(
|
||||||
|
DelayByOrder(FadeIn(squares)),
|
||||||
|
run_time = 3
|
||||||
|
)
|
||||||
|
curve = HilbertCurve(order = 6).scale(1./6)
|
||||||
|
for coords in coords_set:
|
||||||
|
self.play(ShowCreation(
|
||||||
|
curve.copy().shift(coords)
|
||||||
|
))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue