Skip to main content

Hi, 

I tried to trace some ray in C++ through a simple test lens file with two surfaces after the lens and the IMAGE surface (see file).

I create a batch with CreateDirectunpol() function but I noticed two behaviors that seemed strange to me : 

  • when I set  toSurface  parameter to a negative number (CreateDirectUnpol(1000, RaysType_Paraxial, 0, -1)  for example), no error are thrown, and the function does not return nullptr. Even more strange, I could add rays, trace them and read output result. Obviously, rays were unchanged.
  • when I set toSurface parameter to TheSystem->LDE->NumberOfSurfaces, I have the exact same output as TheSystem->LDE->NumberOfSurfaces - 1.

Do you have any explanation for these behaviors ?

Thanks

 

Hi Adub,

 

From what I know there isn’t systematic error handling in the ZOS-API, and developers have been focused on incorporating all the analysis features as opposed to fixing and polishing a subset of those. I’m not particularly surprised by your discovery. If you search for those behaviours, you’ll find plenty of them, I guess the important bit is whether it stops you from doing your work.

As for your second issue, I think the surfaces start at zero, so if you have five surfaces, their indices will be 0, 1, 2, 3, and 4. However, the NumberOfSurfaces will be 5, and 5 is not a valid index, therefore its showing you the same behaviour as -1 which isn’t a valid index either.

Let me know if this makes sense.

Take care,

 

David


Reply