prep animation
This commit is contained in:
parent
7b8a2dae26
commit
126be2e0e2
1 changed files with 8 additions and 2 deletions
10
torus.py
10
torus.py
|
|
@ -1,7 +1,6 @@
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from numpy.polynomial.polynomial import Polynomial
|
from numpy.polynomial.polynomial import Polynomial
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
import matplotlib.colors as colors
|
|
||||||
from matplotlib.widgets import Slider, Button
|
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)
|
return np.allclose(self.surface_point(phi, theta), self.sun+roots[0]*ray)
|
||||||
|
|
||||||
def illumination(self, phi, theta):
|
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)
|
return np.dot(self.ray_vector(phi, theta), -self.normal_vector(phi, theta)) * self.is_illuminated(phi, theta)
|
||||||
|
|
||||||
|
|
||||||
class NoInamge():
|
class NoInamge():
|
||||||
|
|
||||||
def __init__(self, rfrac_init=0.5, sun_init=np.pi/2):
|
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]})
|
fig, (ax_side, ax_top, ax_map) = plt.subplots(3, 1, gridspec_kw={'height_ratios': [2, 2, 1]})
|
||||||
self.fig = fig
|
self.fig = fig
|
||||||
|
|
@ -299,6 +298,13 @@ class ImageInteractive(NoInamge):
|
||||||
self.sliders['rfrac'].reset()
|
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__':
|
if __name__ == '__main__':
|
||||||
# ImageStatic()
|
# ImageStatic()
|
||||||
ImageInteractive()
|
ImageInteractive()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue