# Ray Tracing Method of Gradient Refractive Index Medium Based on Refractive Index Step
## 2 The Method of Ray Tracing Based on Refractive Index Step
### Ray Tracing in the Gradient Refractive Index Medium  
The ray tracing method in the gradient refractive index medium proposed in this paper is based on the refractive index step. The tracing process is shown in Figure 2. In this figure, \(n_{0},n_{1},n_{2},n_{3}\) are the equal refractive index surfaces, and \(n_{3}\ =\ n_{2}\ +\ t\ =\ n_{1}\ +\ 2\ \times\ t\ =\ n_{0}\ +\ 3\ \times\ t\ (t\) is the refractive index step). The medium between \(n_{0}\) and \(n_{1}\) is regarded as an equal refractive index medium, and the value of refractive index is \(\frac{n_{0}+n_{1}}{2}\). Similarly, the refractive index of the medium between \(n_{1}\) and \(n_{2}\) is \(\frac{n_{1}+n_{2}}{2}\). The refractive index of the medium between \(n_{2}\) and \(n_{3}\) is \(\frac{n_{2}+n_{3}}{2}\). \(P_{0}\), \(P_{1}\), \(P_{2}\), \(P_{3}\) are the intersection points of ray \(L\) and constant refractive-index surfaces \(n_{0}\), \(n_{1}\), \(n_{2}\), \(n_{3}\). When the ray \(L\) enters the medium from point \(P_{0}\) along direction \(\mathbf{e}_{\mathbf{p}_{0}\mathbf{p}_{1}}\), its actual propagation path is \(L_{1}^{\prime}\). Since the medium  
Figure 1: Schematic diagram of [PERSON]’s law in vector form: (**a**) [PERSON]’s law in vector form; (**b**) \(\mathbf{A}^{\prime}\)-\(\mathbf{A}\) and \(\mathbf{N}\) are forward parallel; (**c**) \(\mathbf{A}^{\prime}\)-\(\mathbf{A}\) and \(\mathbf{N}\) are antiparallel.  
between \(n_{0}\) and \(n_{1}\) is regarded as an equal refractive index medium, the Line segment \(L_{1}\) is approximately regarded as the equivalent propagation path of ray between \(n_{0}\) and \(n_{1}\) In the same way, the actual ray propagation path \(L_{2}^{\prime}\), \(L_{3}^{\prime}\), is approximately replaced with \(L_{2}\), \(L_{3}\), respectively.  
The constant-index surface \(n_{i}\) is regarded as refractive surface. According to Formula (8), the direction vector of the refracted ray can be expressed as:  
\[\mathbf{e_{p_{1}p_{2}}}\ =\ \mathbf{e_{p_{0}p_{1}}}\ +\ P_{12}\mathbf{N_{12}}, \tag{9}\]  
where \(\mathbf{e_{p_{1}p_{2}}}\) and \(\mathbf{e_{p_{2}p_{3}}}\) are the direction vectors of the incident ray and refractive ray, and the \(\mathbf{N_{12}}\) is the normal of constant refractive-index surface. At this point, we can get the direction vector of the refracted ray. Since the refractive index step is used instead of the geometric step in this solution, the coordinate of the next refraction point \(P_{2}\) cannot be determined directly according to \(\mathbf{e_{p_{1}p_{2}}}\). Therefore, we propose to solve the coordinate of point \(P_{2}\) by solving the combined formula of straight line \(P_{1}P_{2}\) and the constant refractive-index surface \(n_{2}\):  
\[\left\{\begin{array}{rcl}F1&=&f(x,y,z)\\ F2&=&f^{\prime}(x,y,z)\end{array}\right. \tag{10}\]  
In the same way:  
\[\mathbf{e_{p_{2}p_{3}}}\ =\ \mathbf{e_{p_{1}p_{2}}}\ +\ P_{23}\mathbf{N_{23}} \tag{11}\]  
So far, the iterative formula, which is based on the refractive index step for ray tracing in gradient index media, can be obtained. According to the iterative formula, we can calculate the OPL (optical path length):  
\[OPL=\sum n_{i}\ \times\ S_{P_{i}P_{i}\ +\ 1}, \tag{12}\]  
where \(S_{P_{i}P_{i}\ +\ 1}\) is the distance of \(P_{i}\) and \(P_{i}\ +\ 1\).