Tweaks to thumbnails, etc.

This commit is contained in:
Grant Sanderson 2021-11-01 13:19:26 -07:00
parent 33c013391e
commit c538cac3c6
3 changed files with 52 additions and 5 deletions

View file

@ -3562,6 +3562,9 @@ class MetaFractal(IntroNewtonFractal):
frame.target.move_to(point1)
frame.target.set_height(height1)
fractal.set_saturation_factor(2)
plane.remove(plane.coordinate_labels)
self.play(
MoveToTarget(frame),
run_time=8,

View file

@ -3607,7 +3607,7 @@ class SimpleFractalScene(IntroNewtonFractal):
colors = ROOT_COLORS_DEEP
display_polynomial_label = False
display_root_values = False
n_steps = 12
n_steps = 25
def construct(self):
self.init_fractal(root_colors=self.colors)
@ -5088,3 +5088,37 @@ class MetaFractal(IntroNewtonFractal):
),
run_time=10
)
class Thumbnail2(SimpleFractalScene):
def construct(self):
super().construct()
fractal = self.fractal
fractal.set_saturation_factor(4.5)
self.remove(self.plane)
self.remove(self.root_dots)
frame = self.camera.frame
frame.set_height(4)
fc = fractal.copy()
fc.set_saturation_factor(2)
fc.set_julia_highlight(0.01)
self.add(fc)
# self.clear()
# back = fractal.copy()
# back.set_saturation_factor(0)
# back.set_opacity(0.1)
# self.add(back)
# N = 20
# for x in np.linspace(np.log(1e-3), np.log(0.1), N):
# jh = np.exp(x)
# fc = fractal.copy()
# fc.set_saturation_factor(1)
# fc.set_julia_highlight(jh)
# fc.set_opacity(2 / N)
# self.add(fc)
self.embed()

View file

@ -591,11 +591,13 @@ class CubicFormula(RootCoefScene):
)
def add_crt_dots(self):
crt_dots = Dot(**self.sqrt_dot_config).replicate(2)
crt_dots = Dot(**self.sqrt_dot_config).replicate(3)
# TODO, refactor to prevent code duplication here
def update_crt_dots(dots):
q, p, zero, one = self.get_coefs()
coefs = self.get_coefs()
roots = coefficients_to_roots(coefs)
q, p, zero, one = coefs
disc = (q**2 / 4) + (p**3 / 27)
deltas = get_nth_roots(disc, 2)
# TODO add all the cube roots
@ -612,11 +614,17 @@ class CubicFormula(RootCoefScene):
self.add(crt_dots)
# Scenes
class Cubic(RootCoefScene):
coefs = [1, -1, 0, 1]
def construct(self):
self.embed()
class AmbientRootSwapping(RootCoefScene):
n_swaps = 20
n_swaps = 0
def construct(self):
for x in range(self.n_swaps):
@ -625,6 +633,8 @@ class AmbientRootSwapping(RootCoefScene):
self.swap_roots(*indices)
self.wait()
self.embed()
class CubicFormulaTest(CubicFormula):
def construct(self):