to fotoraggi terra levaraggi ifelse (abs :inew) < :anglim [make "riflessione "false make "rnew rifratto :inew :indice] [make "riflessione "true make "rnew :inew] ;;rifrif raggioi :inew :colinc raggior :rnew :colrif make "iold :inew make "rold :rnew end to iniziacerchio setpencolor :colterra setscreencolor :sfondo circle :raggio+1 terrabase pu fd 10 pd setfloodcolor :colmez1 fill pu bk 20 pd setfloodcolor :colmez2 fill pu fd 10 pd end to inizio ht iniziacerchio make "finestra "false scrobar inizio1 end to inizio1 make "iold 20 make "inew 20 make "rold 20 make "rnew 20 make "indice 1.5 make "raggio 196 make "proiezioni "false make "normale "false make "riflessione "false inizio2 end to inizio2 make "sfondo [0 0 0] make "colmez1 [0 0 255] make "colmez2 [0 255 0] make "colinc [255 255 0] make "colrif [255 255 255] make "colterra [128 128 128] make "colind [0 255 255] terrabase end to leggich if :finestra [ ifelse checkboxget "nor [make "normale "true] [make "normale "false] ifelse checkboxget "pro [make "proiezioni "true] [make "proiezioni "false] ] end to levaraggi ifelse :riflessione [make "colore :colmez1][make "colore :colmez2] raggioi :iold :colmez1 ;;rifles :iold :sfondo raggior :rold :colore ;;rifrat end to raggioi :ainc :col setpencolor :col lt :ainc fd :raggio fd -:raggio rt :ainc end to raggior :arif :col setpencolor :col ifelse :riflessione [rt :arif fd :raggio fd -:raggio lt :arif] [rt 180 lt :arif fd :raggio bk :raggio rt :arif rt 180] end to rifratto :ainc :ind output arcsin ((sin :ainc) / :ind) end to screg make "inew scrollbarget "regolazione www 90-:inew staticupdate "rginc sentence sentence [angolo incidenza] abs :inew "gradi ifelse :riflessione [staticupdate "rgrif sentence sentence [riflessione totale] abs :rnew "gradi][staticupdate "rgrif sentence sentence [angolo rifrazione] form abs :rnew 6 2 "gradi] end to scrindi make "anglim 90 if :indice<1 [make "indice 1/:indice make "anglim rifratto 90 :indice make "indice 1/:indice] ;;;;;; end to scrobar windowcreate "uno "inc [legge della rifrazione] 240 38 68 70 [] staticcreate "inc "rginc [angolo incidenza] 4 4 58 18 staticcreate "inc "rgrif [angolo rifrazione] 4 34 58 18 scrollbarcreate "inc "regolazione 4 22 50 20 [screg] scrollbarset "regolazione 1 179 90 windowcreate "tre "opt [opzioni] 6 90 60 70 [] groupboxcreate "opt "myg1 4 0 50 26 checkboxcreate "opt "myg1 "nor [normale] 10 5 40 20 groupboxcreate "opt "myg2 4 28 50 26 checkboxcreate "opt "myg2 "pro [proiezioni] 10 33 40 20 windowcreate "due "rif [indice rifrazione] 6 38 60 50 [] staticcreate "rif "raind [n1/n2=] 4 25 50 25 scrollbarcreate "rif "rego 4 6 50 25 [make "indice (scrollbarget "rego)/10 www :inew staticupdate "raind sentence [n1/n2=] :indice screg] scrollbarset "rego 2 30 15 make "finestra "true end to terra ;;segnalatasti ifelse :normale [make "col1 :colterra make "col2 :col1][make "col1 :colmez1 make "col2 :colmez2] setpencolor :col1 fd :raggio fd -:raggio setpencolor :col2 fd -:raggio fd :raggio terrabase if :proiezioni [setpencolor :colinc lt 90 make "pro1 :raggio*sin :iold fd :pro1 fd -:pro1 rt 90 setpencolor :colrif rt 90 make "pro2 :raggio*sin :rold fd :pro2 fd -:pro2 lt 90] end to terrabase setpencolor :colterra rt 90 fd :raggio fd -:raggio*2 fd :raggio rt -90 end to www :ang leggich make "inew :ang scrindi fotoraggi end Make "anglim 90 Make "col1 [0 0 255] Make "col2 [0 255 0] Make "colinc [255 255 0] Make "colind [0 255 255] Make "colmez1 [0 0 255] Make "colmez2 [0 255 0] Make "colore [0 255 0] Make "colrif [255 255 255] Make "colterra [128 128 128] Make "finestra "true Make "indice 1.5 Make "inew 61 Make "iold 61 Make "k [0 0 255] Make "normale "false Make "pro1 0 Make "pro2 0 Make "proiezioni "false Make "raggio 196 Make "riflessione "false Make "rnew 35.6674525382646 Make "rold 35.6674525382646 Make "sfondo [0 0 0] Make "sides 3 Make "startup [show [by Giorgio Pietrocola] inizio] Make "v "false