| Wave interferences - Interferencia de ondas
| Adaptacion de Galileo (2016)
^r4/lib/gui.txt
| Coordenadas de origen de las ondas
#x1 150
#y1 300
#x2 0
#y2 0
#d1 #d2 #s1 #s2
:color | c --
16 >> dup dup 8 << or 8 << or ink ;
:calcula | n x y --
over x1 - dup * over y1 - dup * + sqrt 16 << 'd1 !
over x2 - dup * over y2 - dup * + sqrt 16 << 'd2 !
pick2
dup d1 5.0 /. swap - 6.2832 /. sin 60.0 *. 's1 !
dup d2 5.0 /. swap - 6.2832 /. sin 60.0 *. 's2 !
5.0 *.
d2 >=? ( 122.0 s2 + color )( 122.0 s1 + color )
d1 >=? ( d2 >=? ( 122.0 s1 s2 + + color ) )
d1 <=? ( d2 <=? ( 128.0 color ) )
drop
2dup 4 fcircle
;
:bucley | n x --
0 ( 300 <? )( calcula 5 + ) drop ;
:buclex | n --
0 ( 300 <? )( bucley 5 + ) drop ;
:waves
1.0 ( 100.0 <? )( redraw buclex 0.2 + ) drop ;
: cls waves show 'exit >esc< ;