Raytracing not accounting for reflections during ZPL macro execution

  • 21 December 2020
  • 2 replies


I'm writing a macro to calculate ghost foci from focussing optics, and I need a little more flexibility than the built-in function.

The way I'm doing this is by adding a mirror surface to the output of a lens system, and then duplicating the optics preceding the lens in reverse order.

I'm having trouble with the output of a raytrace after a reflecton off a surface in ZPL, specifically, the direction of the ray does not change (and rays which should converge, diverge), and the ray acts as though the optics are arranged linearly. 

Calling a single raytrace yields the expected results and accounts for the reflection as it should, but the output from the raytrace command in ZPL does not do this. 

Do I need to configure the raytrace command in ZPL in a certain way to allow reflections?

Any help is greatly appreciated! I've attached the output of a single raytrace and the output of my script which (at this stage) ought to match the raytrace output. The mirror surface in this system is surface 4, and the rest of the surfaces comprise a lens doublet/air gaps.

Thanks, Michael


2 replies

Ah! I've sorted my own problem (should have held off a few minutes before posting!). Turned out to be a missing UPDATE command after adding the mirror surface in my script. 

Userlevel 3
Badge +2

Good news. Let us know if you run into any other issues.