Solved

RAYTRACE with image height

  • 22 August 2022
  • 4 replies
  • 249 views

Userlevel 1

I plotted the graph on the right side of Figure 1 with RAYTRACE command as shown in Figure 1 below. However, I want to increase the y-coordinate of the input ray by image height as shown in Figure 2, but it is not working well.
Is there a way?

 

 

icon

Best answer by MichaelH 24 August 2022, 17:25

View original

4 replies

Userlevel 6
Badge +2

The RAYTRACE command in the ZPL will always trace the Hx/Hy normalized field coordinates.  The actual Field Type is controlled in the Field Data Editor and if you want Hx/Hy to reflect image heights, then you can change the Field Type to either Paraxial Image Height or Real Image Height.  Manually changing this before you run your ZPL code will now change the image height as you cycle through your normalized field coordinates.  

Userlevel 1

@MichaelH 

Thank you for your sincere answer. In fact, before running the RAYTRACE macro below, I had already modified the Fields Type to Real Image Height in the optic studio.
If so, can I regard the result of the figure 1 below as meaning that the RAYTRACE function moved to image height and generated Ray?

Userlevel 6
Badge +2

Yes, if you had already switched to Real Image Height, then the original plot is already ranging from 0 to max in the image height.  For example, if you have your Field Data Editor ranging from 0mm to 5mm in the y-direction, then tracing Hy=0.0 will be 0mm image height, Hy=0.5 will be 2.5mm image height and Hy=1.0 will be 5.0m image height.

Userlevel 1

@MichaelH


Thank you for your continuous reply.
If I reverse the lens system in the optic studio and run the RAYTRACE macro below, I could get the figure 2 above. The following macro is not written by me, but shows part of the macro written for the experiment at Stanford University.
When the lens is reversed, I do not understand why figure 2 is possible when executing the macro below. 
Could you explain it to me? Below, the ImgHeight variable means Real Image Height. 

 

ImgHeight = 5
NumOfHeightStep = 50
NumOfRadiusStep = 30
NumOfAnglesStep = 18

ImgHgtDelta = 1/NumOfHeightStep
RadiusDelta = 1/NumOfRadiusStep
AnglesDelta = 2*PI/NumOfAnglesStep

FOR hIndex, 0, NumOfHeightStep, 1
hx = 0
hy = hIndex * ImgHgtDelta
FOR rIndex, 0, NumOfRadiusStep, 1
FOR aIndex, 0, rIndex*NumOfAnglesStep-1, 1
px = rIndex * RadiusDelta * COSI( aIndex * AnglesDelta / rIndex)
py = rIndex * RadiusDelta * SINE( aIndex * AnglesDelta / rIndex)
RAYTRACE hx, hy, px, py, 1
PRINT RAGX(0), hy*ImgHeight, RAGZ(0), RAGL(0), RAGM(0), RAGN(0), RAGX(ns), RAGY(ns), RAGZ(ns), RAGL(ns), RAGM(ns), RAGN(ns)

 

Reply