Definition at line 733 of file general_optics.py. 00733 : 00734 "set_direction(from, to, set_info) points a mirror from object or coordinate 'from' to 'to'" 00735 if isinstance(from_obj, general_optic): 00736 fc=from_obj.exit_center() 00737 fn=from_obj.name 00738 else: 00739 fc=Numeric.array(from_obj) #assume is is a tuple or array 00740 fn=Numeric.array_str(fc, precision=3, suppress_small=1) 00741 if isinstance(to_obj, general_optic): 00742 tc=to_obj.entrance_center() 00743 tn=to_obj.name 00744 else: 00745 tc=Numeric.array(to_obj) #assume is is a tuple or array 00746 tn=Numeric.array_str(tc, precision=3, suppress_small=1) 00747 00748 self.looking_from_name=fn 00749 self.looking_to_name=tn 00750 self.looking_from_obj=from_obj 00751 self.looking_to_obj=to_obj 00752 00753 dx1=fc-self.center 00754 dx2=tc-self.center 00755 dx1hat=dx1/vec_mag(dx1) 00756 dx2hat=dx2/vec_mag(dx2) 00757 halfway=(dx1hat+dx2hat)/vec_mag(dx1hat+dx2hat) 00758 x,y,z=tuple(halfway.flat) 00759 rho=math.sqrt(x*x+y*y) 00760 theta=math.atan2(rho,z)/deg 00761 eta=math.atan2(y,x)/deg 00762 self.reset_angle((180+theta, eta, 0)) 00763 self.perp=Numeric.array((dx1hat[1]*dx2hat[2]-dx1hat[2]*dx2hat[1], 00764 dx1hat[2]*dx2hat[0]-dx1hat[0]*dx2hat[2], 00765 dx1hat[0]*dx2hat[1]-dx1hat[1]*dx2hat[0])) #cross product perpendicular to plane of incidence, for reference 00766 return self #make daisy-chaining easy 00767 def rotate_axis(self, axis_theta):
|