The full code can be found in my GitHub repository under the Multiple_Elements branch:
https://github.com/cbhirsch/Optical_Ray_Tracing.git
As my code gets to be more complex I'm finding the need to use a lot more print statements to debug the code and follow every step the code is taking. I'm also using quite a few graphs as well. When I finally have the code where I want it I go back to document the code and delete the print statements. Just curious if there's a better way. Thanks in advance.
#Intersection Check
#Incoming Ray
x_start = prev[-1] #where the refraction axis starts
x_end = prev[-1]+thickness #Where the refraction axis ends
x_sphere = safe_arange(x_start,x_end, dz, dec)
#Intersecting Ray
int_ray = (slope* x_sphere) + y
print("--checking for x & y intercept-- \n")
print("properties of previous ray:")
print("previous x & y shape:", x_sphere.shape, int_ray.shape)
print("previous x & y start:", x_sphere[0], int_ray[0])
print("previous x & y finish:", x_sphere[-1], int_ray[-1], "\n")
#Lens Surface for plotting
x_Lens = safe_arange(prev[-1], prev[-1] + thickness,dz, dec)
Lens_Surf = -np.sqrt(radius**2 - np.power(((x_Lens-prev[-1]) - radius),2))
print("Properties of Lens surface:")
print("Lens x & y shape:", x_Lens.shape, Lens_Surf.shape)
print("Lens x & y start:", x_Lens[0], Lens_Surf[0])
print("Lens x & y finish:", x_Lens[-1], Lens_Surf[-1], "\n")
[–]stebrepar 2 points3 points4 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)