NSC ray tracing in mixed mode (with entry and exit ports)
Ray tracing through a group of non-sequential objects using ports is accomplished with the following basic steps:
1) A Non-sequential Component surface is inserted in the Lens Data Editor. This surface becomes the entry port for the non-sequential group.
2) The Non-sequential Component surface parameters are used to define the location of the exit port for the non-sequential group.
3) Objects in the non-sequential group are defined in a Non-sequential Component Editor that is associated with the Non-sequential Component surface.
4) OpticStudio traces a ray sequentially to the entry port, then non-sequentially within the non-sequential group, until the ray strikes the exit port.
5) Rays entering the non-sequential group through the entry port cannot split. Note that ray splitting is required to trace the ordinary and extraordinary rays for birefringence in non-sequential mode. If a birefringent material is defined in non-sequential group, rays will always follow the ordinary path, regardless of the mode setting on the birefringent object.
The Non-sequential Component surface has parameters which determine where the rays will exit the NSC group as described below.
The Entry Port
The Non-sequential Component surface acts like a plane, sphere, or conic aspheric surface whose location is determined by the previous surfaces in the Lens Data Editor, in the usual way. The surface shape may be hyperhemispheric to allow acceptance of rays over a full 4π steradians. The Non-sequential Component surface is the entry port into a group of objects which will be traced non-sequentially. The entry port is how rays get into the NSC group. No objects should be placed as to touch or surround the entrance port. If objects touch or surround the entrance port, consider using the Back Propagation Distance.
The Exit Port
There are 9 parameters used in the definition of the Non-sequential Component surface:
Draw Ports? If 0, no ports are drawn, if 1, draw entry, 2, draw exit, 3 draw both.
Exit Location X The x position of the exit port relative to the entry port.
Exit Location Y The y position of the exit port relative to the entry port.
Exit Location Z The z position of the exit port relative to the entry port.
Exit Tilt About X The rotation about the local X axis of the exit port.
Exit Tilt About Y The rotation about the local Y axis of the exit port.
Exit Tilt About Z The rotation about the local Z axis of the exit port.
Order If the order flag is zero, then the above locations and tilts are done in the following order: decenter x, decenter y, decenter z, rotate around global z, rotate around global y, rotate around global x. If the flag is any value other than zero, then the order is reversed. This follows the same convention as the sequential coordinate break surface when using order flag = 0.
Reverse Rays If this flag is 0, then OpticStudio assumes the non-sequential group acts like a refractive lens. If this flag is 1, then OpticStudio assumes the non-sequential group acts like a mirror. For example, if rays entering the non-sequential group travel in a positive direction with respect to the local z axis, and leave the exit port still traveling in the positive local z direction, the flag should be zero. If the rays reverse direction relative to the incoming direction, then the reverse rays flag should be 1.
Back Propagation Distance If that distance is greater than zero, then the rays back-propagate before entering the Non-sequential Component. A positive value for the Back Propagation Distance propagates in the reverse direction of the actual ray path. Only positive inputs are permitted.
That distance can be useful when working in mixed mode with a Boolean Native Object. See Boolean Native .
Exit Port Diameter This is in lens units. The diameter of the circular exit port is defined by the clear semi-diameter or semi-diameter of the surface following the Non-sequential Component surface. Note any additional aperture may be placed on the exit surface if another aperture shape is required.
These parameters define the location and size of the exit port relative to the entry port. If the exit port is located exactly at the entry port, then rays will immediately exit the non-sequential group without striking any objects. This generally means the exit location z parameter must not be zero.
The glass column of the Non-sequential Component surface is also used to define the "background" material and index of refraction of the media in which NSC objects are placed. The surface after the Non-sequential Component surface acts like a Standard plane surface oriented in the coordinate system after the decenters and tilts have been applied.
Note the exit port position is the same as the surface following the Non-sequential Component surface, and its location in 3D space is determined by the parameters of the Non-sequential Component surface. The thickness of the Non-sequential Component surface is not used; only the location and tilt parameter values. The exit port should not be placed at the same location as, or within the glue distance (see "Glue Distance In Lens Units") of the entrance port; otherwise rays entering the NSC group will immediately strike the exit port and not intersect any of the objects within. No objects should be placed as to touch or surround the exit port.
Ray Tracing
Getting Rays In
A ray leaves the object surface, and traces through the lens in the usual sequential fashion until it reaches the Non-sequential Component surface. The ray is then sent into the group of components associated with that surface, and the non-sequential tracing begins.
Once inside the NSC group, 3 things can happen to a ray:
1) It can hit the exit port.
2) It can hit nothing at all.
3) It can hit one of the objects within the group.
If the ray hits the exit port, the ray coordinates and the direction cosines are computed on the exit port, and the ray then traces sequentially again through the remaining surfaces of the lens.
If the ray hits nothing at all, then the ray tracing is terminated, and the ray trace function returns a "ray missed" error on the following surface (since the ray never struck the exit port, which is always the next surface in the sequential portion of the ray trace).
If the ray strikes an object in the NSC group, then the ray will either reflect, refract, total internal reflect (TIR), or be absorbed, depending upon the properties of the object struck. Rays entering the NSC group through the entry port cannot split. If the ray is absorbed, the ray trace is terminated and a ray miss error is returned, otherwise the new ray coordinates and direction cosines are computed, and the process repeats until one of the following conditions is met:
1) The ray hits the exit port.
2) The ray hits no object.
3) The ray is absorbed.
4) The ray has intercepted more than the maximum allowed number of objects (see "Maximum Intersections Per Ray").
Cases 1, 2, and 3 are handled exactly as described above. In case 4, even though the ray technically still can be traced, it is terminated to prevent infinite loops from occurring. In this case, the ray trace returns a ray miss error.
Getting Rays Out
When a ray strikes the exit port, the coordinates and direction cosines of the ray in the coordinate system of the exit port are computed, and then the ray traces sequentially through any remaining surfaces. If one of the following surfaces is another Non-sequential Component surface, then the process begins again for the components defined for that group. Note rays within one NSC group cannot "see" objects defined in another group, even if they physically share the same location in space; nor can the rays "see" surfaces outside the present NSC group.
Next: