Reimplemented from general_optic. Definition at line 953 of file general_optics.py. 00953 : 00954 00955 dot=Numeric.dot 00956 00957 self.update_strength() 00958 00959 kx, ky, kz=self.beam.local_direction 00960 00961 #must rotate by the appropriate refraction angle _in the plane of incidence_ 00962 sin_theta_in=math.sqrt(kx*kx+ky*ky) #incoming k had better be a unit vector! 00963 if abs(sin_theta_in) < 1e-6: return 00964 cphi, sphi = kx / sin_theta_in, ky/sin_theta_in 00965 00966 n1=self.ambient_index 00967 n2=self.medium_index 00968 00969 if kz < 0.0: 00970 n1, n2 = n2, n1 #we're going backwards through the interface 00971 sin_theta_in=-sin_theta_in 00972 00973 self.final_index=n2 00974 00975 sin_theta_out= n1/n2*sin_theta_in 00976 dtheta=math.asin(sin_theta_out)-math.asin(sin_theta_in) 00977 c,s = math.cos(dtheta), math.sin(dtheta) 00978 phimat= Numeric.array(((cphi,-sphi, 0),( sphi, cphi, 0),(0,0,1.))) 00979 phimati=Numeric.array(((cphi, sphi, 0),(-sphi, cphi, 0),(0,0,1.))) 00980 00981 #this matrix is a rotation by by phi to put the incident beam on x, rotate about x-z by dtheta, then undo the phi 00982 self.beam.transform(self.globalize_transform(dot(phimat,dot(Numeric.array(((c,0,s),(0,1,0),(-s,0,c))), phimati)))) 00983 self.q_transform() 00984 00985 def update_strength(self):
|