#! /usr/bin/env python # -*- coding: UTF-8 -*- """ PyRifrations, simulatore di rifrazione in python creato da Eu (thefox.eu@gmail.com) col contributo di Frafra (francesco.it@gmail.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. """ __module_name__ = "PyRifrations" __module_version__ = "0.2" __module_description__ = "Simula la rifrazione della luce" from math import asin, pi, sin print "PyRifrations" a = input("Angolo di indicidenza > ") n1 = float(raw_input("Indice di rifrazione mezzo 1 > ")) n2 = float(raw_input("Indice di rifrazione mezzo 2 > ")) n = n2 / n1 print "\nIndice di rifrazione (2->1):", n lrad = (asin(1/n1)) l = (lrad*180)/pi print l if a < l: rada= (a * pi)/180 sinr = sin(rada)/n rr = asin(sinr) r = (rr*180)/pi print "Angolo di Rifrazione:", r else: print "Riflessione totale"