import sys sys.path.append('../hallucinator') import hallucinator import math import operator import numpy as np f = lambda u: math.sin(100 * u / (2 * np.pi)) / u source1 = hallucinator.wave_2(f, v=2, source=(3, 0), falloff=0.5) source2 = hallucinator.wave_2(f, v=2, source=(-3, 0), falloff=0.5) '''source3 = hallucinator.wave_2(f, v=50, source=(0, 0)) source4 = hallucinator.wave_2(f, v=50, source=(1, 0)) source5 = hallucinator.wave_2(f, v=50, source=(2, 0))''' #source6 = hallucinator.wave_2(f, v=50, source=(1, 0)) #source7 = hallucinator.wave_2(f, v=50, source=(2, 0)) #source8 = hallucinator.wave_2(f, v=50, source=(3, 0)) #source9 = hallucinator.wave_2(f, v=50, source=(9, 0)) superposition = lambda x, y, t: tuple( map(operator.add, source1(x, y, t), source2(x, y, t))) '''superposition2 = lambda x, y, t: tuple(map(operator.add, superposition(x, y, t), source3(x, y, t))) superposition3 = lambda x, y, t: tuple(map(operator.add, superposition2(x, y, t), source4(x, y, t))) superposition4 = lambda x, y, t: tuple(map(operator.add, superposition3(x, y, t), source5(x, y, t)))''' #superposition5 = lambda x, y, t: tuple(map(operator.add, superposition4(x, y, t), source6(x, y, t))) #superposition6 = lambda x, y, t: tuple(map(operator.add, superposition5(x, y, t), source7(x, y, t))) #superposition7 = lambda x, y, t: tuple(map(operator.add, superposition6(x, y, t), source8(x, y, t))) #superposition8 = lambda x, y, t: tuple(map(operator.add, superposition7(x, y, t), source9(x, y, t))) hallucinator.wave_2_gradient_video(superposition, t_range=(0, 10), x_range=(-10, 10),
import sys sys.path.append('../hallucinator') import hallucinator import operator f = lambda y: 3 / (2 * y**2 + 1) source1 = hallucinator.wave_2(f, v=3, source=(2.5, 0), falloff=0.5, starttime=1) source2 = hallucinator.wave_2(f, v=3, source=(2, 0), falloff=0.5, starttime=1.5) source3 = hallucinator.wave_2(f, v=3, source=(1, 0), falloff=0.5, starttime=2) source4 = hallucinator.wave_2(f, v=3, source=(0, 0), falloff=0.5, starttime=2.5) source5 = hallucinator.wave_2(f, v=3, source=(-1, 0), falloff=0.5, starttime=3) source6 = hallucinator.wave_2(f, v=3, source=(-1.5, 0), falloff=0.5, starttime=3.5) source7 = hallucinator.wave_2(f, v=3, source=(-1.5, 0),
import sys sys.path.append('../hallucinator') import hallucinator import math import numpy as np frequency = 100 amplitude = 1 f = lambda u: amplitude * math.sin(frequency * u / (2 * np.pi)) source1 = hallucinator.wave_2(f=f, v=1, source=(0, 0), falloff=0.5) rect_region = lambda fu: hallucinator.surface_region(f=fu, x_range=(-1, 1), y_range=(-2, 2), density=10) hallucinator._deprecated_video(frame_func=lambda t: hallucinator.regional_gradient_frame(f=source1, t=t, region=rect_region, x_range=(-5, 5), y_range=(-5, 5), resolution=5, white_ref=1.0, black_ref=-1.0, default=hallucinator.RED), filename='grad_path_vid_test', t_range=(1, 10),
import sys sys.path.append('../hallucinator') import hallucinator as hl import math import numpy as np frequency = 75 amplitude = 1 f = lambda u: amplitude * math.sin(frequency * u / (2 * np.pi)) center1 = (0, 0.3) center2 = (0, -0.3) source1 = hl.wave_2(f=f, v=1, source=center1, falloff=0) source2 = hl.wave_2(f=f, v=1, source=center2, falloff=0) superposition = hl.superposition(source1, source2) scene = hl.GrayscaleScene() wave = hl.ParaObject2(f=superposition, region_type="surface", region_params={"a_range": (-10, 10), "b_range": (-10, 10), "a_name": 'x', "b_name": 'y'}, species='wave_superposition') scene.add_object(wave.rotate(theta=math.pi / 2, p=(0, 0)), name='wave')
import sys sys.path.append('../hallucinator') import hallucinator f = lambda y: 3 / (2 * y**2 + 1) wf = hallucinator.wave_2(f, v=2, source=(1, 1)) print('wf(0, 0, 0): ', wf(0, 0, 0)) print('wf(0, 0, 1): ', wf(0, 0, 1)) print('wf(0, 1, 1): ', wf(0, 1, 1)) print('wf(1, 0, 1): ', wf(1, 0, 1)) frame1 = hallucinator.gradient_frame(f=wf, t=0, white_ref=4, black_ref=0, x_range=(-5, 5), y_range=(-5, 5), resolution=20) frame2 = hallucinator.gradient_frame(f=wf, t=1, white_ref=4, black_ref=0, x_range=(-5, 5), y_range=(-5, 5), resolution=20) hallucinator.render_from_array(frame1) hallucinator.render_from_array(frame2) hallucinator.wave_2_gradient_video(wf, t_range=(0, 5),