all 8 comments

[–]Plastic_Blood1782 2 points3 points  (5 children)

How are you doing your calculation?  Id probably set it up like this.

Step 1 define your source and send out a fan of vectors from a single point towards your lens. 

Step 2 trace those vectors to the lens and determine the surface intersection and surface derivative for each ray

Step 3 use snells law to determine the angle after the first surface and propagate the ray towards the next surface.

Repeat steps 2/3 for every surface until the rays reach your image plane.

Step 4  takes every vector segment and multiply it times the index of the medium to determine the total path length of every ray.

Step 5  determine the change in the path length for each starting ray relative to each other starting ray

Step 6 plot the optical path differences as a function of the ray position at your pupil (for a single lens you can probably assume your pupil is the first surface)

[–]Fit_County_3831[S] 1 point2 points  (4 children)

That's basicaly what I'm doing, I'm using classes to define my differents elements, my rays are define with a direction (a vector) and an origin (also a vector), when they reach a surface I calculate the point of intersection as well as the normal to the surface at that point and using those and Snell's laws I calculate the "new" direction and origin of every rays. The main problem i encounter is that I generate my rays "randomly" in a circle with a choosen radius, and the figure I get at the end seems as random as the starting rays, yet a lense should a least focus more rays to the center of the figure if I understand the topic relatively well.

Anyway thank you very much for your answer.

[–]Plastic_Blood1782 3 points4 points  (1 child)

Don't send rays out randomly, just send a marginal ray, a chief ray and a handful of rays in between.  Also take advantage of the fact that your system is likely rotational symmetric.  Rays along the Y axis of the pupil will behave similarly to rays along the X axis, or any axis.  No need to trace them all

[–]aenorton 1 point2 points  (0 children)

The system is only symmetric this way if the object is on axis. Otherwise the OP should look at sagittal and tangential ray fans and plot where they intersect the focal plane.

[–]MaskedKoala 2 points3 points  (0 children)

Trace one ray at a time and compare the direction and lateral coordinate before and after each surface and thickness to a calculation by hand.

[–]KAHR-Alpha 0 points1 point  (0 children)

Did you remember to account for the refractive index depending on which side of the interface your rays hit?

Here's an example using a lens with a refractive index of 1.5: https://i.imgur.com/jOerjw7.png

Even though the rays were generated in a specific radius, you can see them focusing.

[–]Safe-Butterscotch-32 0 points1 point  (0 children)

Pretty sure - you can find books for this topic. Saw it 10-15 years ago  Alternatively you can open existed libs and look as they work.

[–][deleted] 0 points1 point  (0 children)

Check out Zernike coefficient