In [ ]:
from pyoptools.all import *
from numpy import pi,sqrt
A bi-convex lens can described as a piece of glass limited by 2 spherical surfaces (the 2 lens faces), and a a cylindrical surface (the lens border). In the next example, this surfaces will be:
In [ ]:
S0=Spherical(shape=Circular(radius=50),curvature=1./200.)
S1=Spherical(shape=Circular(radius=50),curvature=1./200.)
S2=Cylinder(radius=50,length=10)
With the created surfaces we will create the Component. The component constructor receives 2 important arguments:
surflist
List of tuples of the form
(surface, (PosX,PosY,PosZ), (RotX,RotY,RotZ)
wheresurface
is an instance of a subclass of Surface,PosX,PosY,PosZ
are the surface’s vertex coordinates, andRotX,RotY,RotZ
are the rotation angles of the surface around the X , Y , and Z axes, given in radians. The rotation about the Z axis if applied first, then the rotation about the Y axis, and finally the rotation about the X axis.
material
Instance of the class Material with the material definition, or a floating point number to indicate a constant refraction index material.
In [ ]:
L1=Component(surflist=[(S0,(0,0,-5),(0,0,0)),
(S1,(0,0,5),(0,0,0)),
(S2,(0,0,6.5),(0,0,0))
],material=material.schott["BK7"])
Plot3D(L1,size=(120,120),scale=3,rot=[(pi/3,0,0)])
In [ ]:
width=50
height=50
reflectivity=0.5
a_face= Plane(shape=Rectangular(size=(width,height)))
b_face= Plane(shape=Rectangular(size=(width,height)))
h=sqrt(2.)*width
h_face= Plane (shape=Rectangular(size=(h,height)),reflectivity=reflectivity)
w2=width/2.
e1=Plane (shape=Triangular(((-w2,w2),(-w2,-w2),(w2,-w2))))
e2=Plane (shape=Triangular(((-w2,w2),(-w2,-w2),(w2,-w2))))
In [ ]:
P=Component(surflist=[(a_face,(0,0,-width/2),(0,0,0)),
(b_face,(width/2,0,0),(0,pi/2,0)),
(h_face,(0,0,0),(0,-pi/4,0)),
(e1,(0,height/2,0),(pi/2,-pi/2,0)),
(e2,(0,height/2,0),(pi/2,-pi/2,0))
],material=material.schott["BK7"])
Plot3D(P,size=(120,120),scale=3,rot=[(pi/6,pi/8,0)])
The next code shows an example to create a beam splitting cube by using 2 components (prisms defined by a function) to create a system (in this case it is really a subsystem that can be used as a component). An extra feature added to this example, is a reflective characteristic added to one of the surfaces in the prism P2
, so the subsystem behaves as a beam splitting cube.
In [ ]:
def prism(reflectivity=0):
width=50
height=50
a_face= Plane(shape=Rectangular(size=(width,height)))
b_face= Plane(shape=Rectangular(size=(width,height)))
h=sqrt(2.)*width
h_face= Plane (shape=Rectangular(size=(h,height)),reflectivity=reflectivity)
w2=width/2.
e1=Plane (shape=Triangular(((-w2,w2),(-w2,-w2),(w2,-w2))))
e2=Plane (shape=Triangular(((-w2,w2),(-w2,-w2),(w2,-w2))))
P=Component(surflist=[(a_face,(0,0,-width/2),(0,0,0)),
(b_face,(width/2,0,0),(0,pi/2,0)),
(h_face,(0,0,0),(0,-pi/4,0)),
(e1,(0,height/2,0),(pi/2,-pi/2,0)),
(e2,(0,height/2,0),(pi/2,-pi/2,0))
],material=material.schott["BK7"])
return P
P1=prism()
P2=prism(reflectivity=.5)
cube=System(complist=[(P1,(0,0,0),(0,0,0)),(P2,(0,0,0),(0,pi,0))],n=1.)
Plot3D(cube,size=(120,120),scale=3,rot=[(pi/6,pi/8,0)])
In [ ]: