prep animation

This commit is contained in:
Daniel Mevec 2023-02-11 13:17:05 +01:00
parent 7b8a2dae26
commit 126be2e0e2

View file

@ -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()