1+ from raysect_mayavi import visualise_scenegraph
2+
3+ from raysect .core import translate
4+ from raysect .optical import World
5+ from raysect .primitive import Cylinder
6+ from raysect .primitive .lens .spherical import BiConvex , BiConcave , PlanoConvex , PlanoConcave , Meniscus
7+
8+ from mayavi import mlab
9+ # Display lens and cylinder primitives
10+
11+ world = World ()
12+ diameter = 1
13+ center_thickness = 0.5
14+ front_curvature = 2
15+ back_curvature = 2
16+
17+ biconvex_lens = BiConvex (diameter , center_thickness , front_curvature , back_curvature , parent = world )
18+ biconcave_lens = BiConcave (diameter , center_thickness , front_curvature , back_curvature , parent = world , transform = translate (0 , 0 , 1 ))
19+ planoconvex_lens = PlanoConvex (diameter , center_thickness , front_curvature , parent = world , transform = translate (0 , 0 , 2 ))
20+ planoconcave_lens = PlanoConcave (diameter , center_thickness , front_curvature , parent = world , transform = translate (0 , 0 , 3 ))
21+ meniscus_lens = Meniscus (diameter , center_thickness , front_curvature , back_curvature , parent = world , transform = translate (0 , 0 , 4 ))
22+ cylinder_primitive = Cylinder (radius = 0.5 * diameter , height = center_thickness , parent = world , transform = translate (0 , 0 , 5 ))
23+
24+
25+ visualise_scenegraph (world )
26+ mlab .show ()
0 commit comments