Solved

Zemax RAYTRACE

  • 9 August 2022
  • 2 replies
  • 711 views

Userlevel 1

 

After the RAYTRACE command in Zemax, the coordinates of the ray, which arrived at the n-th surface of the RAGX(n), RAGY(n), and RAGZ(n) functions, are vertically straight as shown in Figure 1 below. Here, I would like to have ray arrive in the entire area of the n-th surface as shown in No. 2 in the picture below.
Is there a way?

 

icon

Best answer by MichaelH 10 August 2022, 00:54

View original

2 replies

Userlevel 6
Badge +2

Hi Kivahan,

The RAYTRACE keyword will trace a single ray defined by [Hx, Hy, Px, Py].  The Hx/Hy terms define the normalized field coordinate while the Px/Py terms define the normalized pupil (Stop) coordinates. 

To “fill” the entire n-th surface, you will need to loop through all Hx/Hy field coordinates and the Px/Py pupil coordinates.  For specific planes, such as the image plane you show above, you will only need to change the Hx/Hy field coordinates.  If you just want a ring of rays at the n-th surface, then you can keep the Px/Py=0 (tracing just the chief ray for all the field points). 

The reason why the rays are “vertically straight” is because Hx is always 0 and Hy is only defined at 3 different values of [0.0, 0.707, 1.0].

Below is some pseudo-code that might be useful:

! use settings
px = 0
py = 0
wave = PWAV()
n = NSUR()

! loop through all the rays
FOR i = -10, 10, 1
hx = i / 10
FOR j = -10, 10, 1
hy = j / 10

RAYTRACE hx, hy, px, py, wave

PRINT RAGX(n), ", ", RAGY(n), ", ", RAGZ(n)
NEXT
NEXT

 

Userlevel 1

@MichaelH 

Great! Thank you for your help!!

 

Reply