From 126be2e0e2a0f135eb8c3f9acc827c99d3be811e Mon Sep 17 00:00:00 2001 From: Daniel Mevec Date: Sat, 11 Feb 2023 13:17:05 +0100 Subject: [PATCH] prep animation --- torus.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/torus.py b/torus.py index ab343e0..581bee5 100644 --- a/torus.py +++ b/torus.py @@ -1,7 +1,6 @@ import numpy as np from numpy.polynomial.polynomial import Polynomial import matplotlib.pyplot as plt -import matplotlib.colors as colors from matplotlib.widgets import Slider, Button @@ -78,11 +77,11 @@ class TorusWorld: return np.allclose(self.surface_point(phi, theta), self.sun+roots[0]*ray) def illumination(self, phi, theta): - # return np.dot(self.ray_vector(phi, theta), -self.normal_vector(phi, theta)) return np.dot(self.ray_vector(phi, theta), -self.normal_vector(phi, theta)) * self.is_illuminated(phi, theta) class NoInamge(): + def __init__(self, rfrac_init=0.5, sun_init=np.pi/2): fig, (ax_side, ax_top, ax_map) = plt.subplots(3, 1, gridspec_kw={'height_ratios': [2, 2, 1]}) self.fig = fig @@ -299,6 +298,13 @@ class ImageInteractive(NoInamge): self.sliders['rfrac'].reset() +class AnimatedImage(NoInamge): + + def __init__(self, rfrac_init=0.5, sun_init=np.pi/2): + super().__init__(rfrac_init, sun_init) + plt.show() + + if __name__ == '__main__': # ImageStatic() ImageInteractive()