<<

applied sciences

Article Tracing Method of Gradient Medium Based on Refractive Index Step

Qingpeng Zhang 1,2,3 , Yi Tan 1,2,3,*, Ge Ren 1,2,3 and Tao Tang 1,2,3

1 Institute of and Electronics, Chinese Academy of Sciences, No. 1 Guangdian Road, Chengdu 610209, China; [email protected] (Q.Z.); [email protected] (G.R.); [email protected] (T.T.) 2 Key Laboratory of Optical Engineering, Chinese Academy of Sciences, Chengdu 610209, China 3 University of the Chinese Academy of Sciences, Beijing 100049, China * Correspondence: [email protected]; Tel.: +86-13153917751

Featured Application: This method is mainly applied to gradient index media with a sudden change in refractive index or a large range of refractive index gradient changes, such as around the shock layer of an aircraft.

Abstract: For gradient refractive index media with large refractive index gradients, traditional methods based on refined elements or spatial geometric steps have problems such as low tracing accuracy and efficiency. The ray tracing method based on refractive index steps proposed in this paper can effectively solve this problem. This method uses the refractive index step to replace the spatial geometric step. The starting point and the end point of each ray tracing step are on the constant refractive-index surfaces. It avoids the problem that the traditional tracing method cannot adapt to the area of sudden change in the refractive index and the area where the refractive index changes sharply. Therefore, a suitable distance can be performed in the iterative process. It can

 achieve high-efficiency and precise ray tracing in areas whether the refractive index changes slowly  or sharply. According to the comparison of calculation examples, this method can achieve a tracing −5 Citation: Zhang, Q.; Tan, Y.; Ren, G.; accuracy of 10 mm. The speed and precision of ray tracing are better than traditional methods. Tang, T. Ray Tracing Method of Gradient Refractive Index Medium Keywords: gradient index media 1; ray tracing 2; refractive index step 3; constant-index surface 4; Based on Refractive Index Step. Appl. law of 5 Sci. 2021, 11, 912. https://doi.org/ 10.3390/app11030912

Academic Editor: Igor Ptashnik 1. Introduction Received: 16 November 2020 The optical phenomenon in the gradient refractive index medium, as a ubiquitous Accepted: 18 January 2021 objective physical phenomenon in nature, has been noticed for a long time. The Maxwell Published: 20 January 2021 fisheye , the Wood lens, the Luneburg lens, the Gradient index rod lens, etc., can all be regarded as historical signs of the research on gradient index optics [1]. Due to the change Publisher’s Note: MDPI stays neutral in the refractive index of the medium, the original path of the propagating in it is with regard to jurisdictional claims in changed, which results in the deflection or phase change of the light and it also results in published maps and institutional affil- the image offset, blur, and jitter. Therefore, ray tracing in gradient refractive index media iations. has become a research hotspot. The ray tracing through graded refractive index media is based on the solution of the ray formula: d  dr  n = ∇n (1) Copyright: © 2021 by the authors. ds ds Licensee MDPI, Basel, Switzerland. This article is an open access article where s is the distance along the ray path, r is the position of the ray, and n is the index distributed under the terms and of refraction. Regarding Formula (1), Lucian proposed a universal numerical solution in conditions of the Creative Commons 1968 [2]. Since then, the Runge–Kutta method, Euler method, and Taylor series expansion Attribution (CC BY) license (https:// method have been applied to solve Formula (1), which have laid the foundation of gradient creativecommons.org/licenses/by/ refractive index media ray tracing for a long time [3,4]. Most ray tracing methods are based 4.0/). on the three methods which have been listed on references [5–7]. In the ray tracing process,

Appl. Sci. 2021, 11, 912. https://doi.org/10.3390/app11030912 https://www.mdpi.com/journal/applsci Appl. Sci. 2021, 11, 912 2 of 9

these methods are all iteratively based on the refined elements [8–10] or spatial geometric steps [4,11,12]. When ray tracing is performed in a gradient refractive index medium with a gentle refractive index gradient, the accuracy of the ray tracing can be controlled by changing the geometric step. However, when encountering a gradient refractive index field with a sharp change (such as the shock of a high-speed aircraft [13–15]), it is necessary to adjust the geometric step according to the refractive index gradient aimed to be self-adaptive to the local refraction index gradient and grid geometry scale [7,16]. Even so, it is still possible to cross the region where the refractive index changes sharply in one iterative step. This situation often causes the refraction effect of the refractive index layer whose refractive index changes sharply to be ignored. In order to ensure the accuracy of the entire ray tracing path, the geometrical step-based ray tracing method (RTSGS) generally needs to set a smaller geometric tracing step. It will decrease efficiency in the tracing area where the refractive index changes slowly. Therefore, it will increase useless calculations [17]. This paper proposes a ray tracing method based on refractive index steps (RTRIS). In this method, the refractive index step ∆n is used to replace the geometric step ∆s of the traditional ray tracing method. The advantage of this method is that each iterative process takes equal refractive index step ∆n as the iterative step. In areas where the refractive index changes slowly, a relatively large distance will be performed in the iterative process to achieve high-efficiency ray tracing. In areas where the refractive index changes sharply or suddenly, the iterative step will reduce automatically to capture the sudden changes in the refractive index effectively. It can achieve refined tracing and improve ray tracing accuracy. The application of this method avoids the problem of being unable to capture regions of sudden changes in the refractive index after applying the step size regulation function. It can also effectively avoid the problem of insufficient tracing accuracy or low efficiency caused by unreasonable geometric step setting. By using the proposed method, the efficiency of ray tracing can be achieved while the accuracy of ray tracing can be improved. Thus, the method realizes the adaptive process of the gradient index medium in the ray tracing process.

2. The Method of Ray Tracing Based on Refractive Index Step According to the differential geometry thought, the gradient index medium is divided into many small areas by the constant index surface. The medium between two constant- index surfaces is regarded as an equal refractive index medium. The value of the refractive index for this medium is replaced as the average of the two constant-index surfaces. Those constant-index surfaces are regarded as refractive surfaces. Snell’s law is used to calculate the direction vector of the refracted ray after the ray passes through the constant index surface. So, Snell’s law is the foundation of RTSGS [15].

2.1. Space Snell’s Law Snell’s law in vector form is much more useful in the process of ray tracing in three- dimensional space [18]. According to the reference [6], we can calculate Snell’s law in vector form. The plane Snell’s law can usually be expressed as:

n0 sin I0 = n sin I (2)

In this formula, n and n0 are the refractive index of the medium on the incident side and refracted side, respectively. I and I0 are the incident angle and refraction angle of the ray, respectively. Combined with Figure1, Formula (2) can be modified as:

0 0  n A0 × N = n(A0 × N), (3) Appl. Sci. 2021, 11, x FOR PEER REVIEW 3 of 10

In this formula, n and n are the refractive index of the medium on the incident side and refracted side, respectively. I and I are the incident angle and refraction angle of the ray, respectively. Appl. Sci. 2021, 11, 912 Combined with Figure 1, Formula (2) can be modified as: 3 of 9

nnANAN00    , (3)

0 ' wwherehere AA0 0is is the the unit unit vector vector along along the the incident incident ray, ray,A0 isA the0 is unit the vector unit vector along along the refracted the re- fractedlight, and lightN,is and the unitN is vector the unit along vector the along . the normal.

L

A0 A0' A A' A' A I'

I N N N

n n' n n'>n n n'

(a) (b) (c)

Figure 1. Schematic diagram of Snell’s law in vector form: (a) Snell’s law in vector form; (b) A0-A and N are forward Figure 1. Schematic diagram of Snell’s law in vector form: (a) Snell’s law in vector form; (b) A' - A and N are forward c A0-A N parallel; (c)) A' - Aand andare N antiparallel. are antiparallel. The refracted ray vector with length n0 and the incident ray vector with length n are The refracted0 ray vector with length n and the incident ray vector with length n written as A and A, respectively: are written as A and A , respectively: 0 0 A ×ANANAANN= A × N ⇒ (A(− A) ) × N = 0 0 (4)(4)

0 Formula ( (4)4) shows shows that that vector vector A-AA -A andand vectorvector NNare are collinear collinear vectors. vectors. Rewrite Formula (4) as: 0 − = A AANAPPN,, (5)(5) where PPis vectoris vector deflection deflection constant. constant. Product Product both both sides sides of of Formula Formula (4) ( with4) withN [6N]: [6]: 0 0 0 P = PN•AN− A'N • NA A= n n'coscos I ' − nn coscos I I, , (6)(6)

wwhenhen nnn0 '> n,, the vectors AA'0-A - Aand andN areN parallelare parallel as shown as shown in Figure in Figure1b. When 1b. Whenn0 < nnn, the ,two the vectorstwo vectors are antiparallel are antiparallel as shown as shown in Figure in Figure1c. 1c. When the refractive index of the two media and the incident angle of the light are known, nnI0coscosI0 can can be be replaced replaced with: with: q 22 0 ncos0 I  ( n  )2 ( n  sin I ') 2 n cos I = (n0) − (n0 sin I0) (7) q (n )2  n 2  ( n cos I ) 2 (7) = (n0)2 − n2 + (n cos I)2 Therefore, the refraction law of vector form is [6]: Therefore, the refraction law of vector form is [6]: AANAN  P = + (( n )2  n 2  ( n cos I ) 2  n cos I ) (8) 0 q A = A + PN = A + ( (n0)2 − n2 + (n cos I)2 − n cos I)N (8)

2.2. 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 The tracing tracing process process is is shown shown in in Figure 22.. InIn thisthis figure,figure, n, n,, n n are the equal refractive index surfaces, and n0, n 11, n 22, n 33 are the equal refractive index surfaces, and n3 = n2 + t = n1 + 2 × t = n0 + 3 × t (t is the refractive index step). The medium between n0 and n1 is regarded as n0 + n1 an equal refractive index medium, and the value of refractive index is 2 . Similarly, n1 + n2 the refractive index of the medium between n1 and n2 is 2 . The refractive index of n2 + n3 the medium between n2 and n3 is 2 . P0, P1, P2, P3 are the intersection points of ray L and constant refractive-index surfaces n0, n1, n2, n3. When the ray L enters the medium 0 from point P0 along direction ep0p1 , its actual propagation path is L1. Since the medium Appl. Sci. 2021, 11, x FOR PEER REVIEW 4 of 10

n3  n 2  t  n 1  23  t  n 0   t (t is the refractive index step). The medium be-

tween n0 and n1 is regarded as an equal refractive index medium, and the value of refrac- nn  tive index is 01. Similarly, the refractive index of the medium between n and n is 2 1 2 nn  nn  12. The refractive index of the medium between n and n is 23. P , P , P , 2 2 3 2 0 1 2 P L n n n Appl. Sci. 2021, 11, 912 3 are the intersection points of ray and constant refractive-index surfaces 0 , 1 , 2 4, of 9 n . When the ray L enters the medium from point P along direction e , its actual prop- 3 0 pp01 ' agation path is L1 . Since the medium between n0 and n1 is regarded as an equal refrac- tive index medium, the Line segment L is approximately regarded as the equivalent between n0 and n1 is regarded as an equal1 refractive index medium, the Line segment L1 is

propagationapproximately path of regarded ray between as the n equivalent0 and n1 . propagationIn the same way, path ofthe ray actual between ray propaga-n0 and n1 In 0 0 the same' way,' the actual ray propagation path L , L , is approximately replaced with L2, tion path L2 , L3 is approximately replaced with L22 , L33 , respectively. L3, respectively.

n0 n1 n2 n3

N12 L'2 L'1 P' 1 N23 3 P' 2 L' P1 2 3 1 P P' P0 (P' 0)L L2 L3 P3

n0 + n1 n1 + n2 n2 + n3 2 2 2

Figure 2. Schematic diagram of ray tracing in gradient index media. Figure 2. Schematic diagram of ray tracing in gradient index media. The constant-index surface ni is regarded as refractive surface. According to Formula (8), theThe direction constant vector-index of surface the refracted ni is regarded ray can be as expressed refractive as: surface. According to For- mula (8), the direction vector of the refracted ray can be expressed as: = + ep1p2 ep0p1 P12N12, (9) e  e P N , p1 p 2 p 0 p 1 12 12 (9)

where ep1p2 and ep2p3 are the direction vectors of the incident ray and refractive ray, and the where e and e are the direction vectors of the incident ray and refractive ray, and N12 ispp12 the normalpp23 of constant refractive-index surface. At this point, we can get the direction

the vectorN12 isof the the normal refracted of constant ray. Since refractive the refractive-index index surface step. At is usedthis point, instead we of can the get geometric the directionstep in vector this solution, of the refracted the coordinate ray. Since of the nextrefractive refraction index point step isP2 usedcannot instead be determined of the directly according to ep p . Therefore, we propose to solve the coordinate of point P2 geometric step in this solution,1 2 the coordinate of the next refraction point P2 cannot be by solving the combined formula of straight line P1P2 and the constant refractive-index determined directly according to epp . Therefore, we propose to solve the coordinate surface n2: 12 of point P by solving the combined formulaF1 = f (ofx, ystraight, z) line PP and the constant 2 12 (10) F2 = f 0(x, y, z) refractive-index surface n2 : In the same way: F1  f ( x , y , z ) epp = ep p + P 23N23 (10)(11) 2F32  f1 '( x2 , y , z ) So far, the iterative formula, which is based on the refractive index step for ray tracing inIn gradient the same index way: media, can be obtained. According to the iterative formula, we can calculate the OPL ( length):e  e P N p2 p 3 p 1 p 2 23 23 (11) OPL = n × S , (12) So far, the iterative formula, which is based∑ oni the Prefractivei Pi + 1 index step for ray tracing in gradient index media, can be obtained. According to the iterative formula, we can cal- where S is the distance of P and P . culate the OPLPi Pi +(optical1 path length): i i + 1 3. Algorithm Verification For most of the non-uniform refractive index medium, the analytical solution of the ray trajectory cannot be derived from the ray formula. However, the analytical solution can be acquired for some special refractive index distributions [1]. We compare the analytical solutions of two representative refractive index distributions with the numerical solutions obtained by the proposed algorithm. All the following ray tracing processes take the + z axis as the optical axis direction, and in order to compare the tracing accuracy of RTRIS and RTSGS, the iterative steps of the two tracing methods are the same in the tracing process. Appl. Sci. 2021, 11, 912 5 of 9

3.1. Example 1 The distribution function of the refractive index field is:

n = n0 + αz, (13)

where α is the medium distribution constant. The linear function distribution of the axial gradient refractive index is the simplest form of axial gradient refractive index distribution. Under the condition of paraxial, the analytical solution of the ray formula is:

 p h + i  x = x + 0 ln n0 αz 0 α n0 + αz0 q h n + z i (14)  y = y + 0 ln 0 α 0 α n0 + αz0

where p0, q0 are the optical direction cosine of the ray. When x = 0, the constant a = n0 is the refractive index of the incident surface. Since the refractive index of and optical fiber is generally around 1.5, so take n0 = 1.5 and α = − 0.0005. When the incident point coordinate is (0, 0, 0) and incident ray direction vector is (0, 0.0001, 1), Formula (14) can be simplified as: ( x = 0 0.0001 h 1.5 − 0.0005 × z i (15) y = − 0.0005 ln 1.5 When tracing length is 2000 mm, the optical path analytical solution is:

L1 = R nds l r R 2000 0.0001 h 1.5 − 0.0005 × z i = 0 n × 1 + ( −0.0005 × ln 1.5 )dz (16) = 2.000000025 × 103mm

Use the algorithm proposed in this paper to trace the gradient index medium with a linear function of refractive index distribution from 0 to 2000 mm, we can obtain the optical path L1 = 2.000000027 × 103. It can be found that the order of tracing accuracy can reach 10−6, and the accuracy can completely meet the demand of engineering accuracy. In Figure3, the RTRIS represents the error between the optical path obtained by the ray tracing method based on the refractive index step and the actual optical path from 0 to 2000 mm. In addition, the RTSGS represents the error between the optical path obtained by the ray tracing method based on the geometric step and the actual optical path. It is showing that when the tracing distance is in the range of 0 to 400 mm, the errors of the two tracing methods are almost the same, and the error value is small. When the tracing distance is longer than 400 mm, the error growth rate of RTRIS increases rapidly, and its error curve is similar to exponential curve. Finally, when the tracing distance is 2000 mm, the error value reaches 1.47 × 10−5 mm. For RTSGS, when the tracing distance continues to increase, the error value increases slightly, and the growth rate is small. The error curve is flat. When tracing distance reaches 2000 mm, the error value is only 2.2 × 10−6 mm, which is only 0.15 times as much as RTRIS. The primary source of error is the accumulation of computer errors and fitting errors of the constant refractive-index surfaces. It is showing that the ray tracing method based on the gradient refractive index step is more accurate and stable than that based on the space step for the gradient refractive index media distribution in accordance with Formula (11). Appl. Sci. 2021, 11, x FOR PEER REVIEW 7 of 10 Appl. Sci. 2021, 11, x FOR PEER REVIEW 7 of 10

to increase, the error value increases slightly, and the growth rate is small. The error curve to increase, the error value increases slightly, and the growth rate is small. The2.2 error 10 cur6 mmve is flat. When tracing distance reaches 2000 mm, the error value is only 6 , iswhich flat. Whenis only trac 0.15ing times distance as much reaches as RTRIS. 2000 mmThe ,primary the error source value of is error only is2.2 the  accumula- 10 mm , whichtion of is computer only 0.15 errorstimes asand much fitting as RTRIS.errors ofThe the primary constant source refracti of veerror-index is the surfac accumula-es. It is tionshowing of computer that the errorsray tracing and fittingmethod errors based of on the the constant gradient refracti refractiveve-index index surfac step esis . moreIt is showingaccurate thatand thestable ray thantracing that method based basedon the on space the gradientstep for refractivethe gradient index refractive step is moreindex Appl. Sci. 2021, 11, 912 6 of 9 accuratemedia distribution and stable inthan accordance that based with on Formula the space (11 step). for the gradient refractive index media distribution in accordance with Formula (11).

Figure 3. Ray tracing error example 1. FigureFigure 3. Ray 3. Ray tracing tracing error error example example 1. 1. 3.2.3.2. Example Example 2 2 3.2. Example 2 TheThe distribution distribution function function of ofrefractive refractive index index field field is: is: The distribution function of refractive index field is: q 2 2 2 n = n(12   z 2 ) 2 (17) n = n020 (1 − 2α 2 z ) (17) n = n0 (1   z ) (17) TheThe distribution distribution function function of the of therefractive refractive index index field field show shownn in Formula in Formula (17) is (17) on ise of one the typicalThe distribution distribution function forms of that the canrefractive be obtained index field by ion show diffusionn in Formula technology (17) is. onWhene of theof typical the typical distribution distribution forms forms that thatcan be can obtained be obtained by ion by ion diffusion diffusion technology technology.. When When n0  =1.5 and  ==  − 0.00049 , the refractive index distribution along the z axis is shown n n0 1.5 1.5andand  α=  0.000490.00049, the, the refractive refractive index index distribution distribution along along the the z axisz axis is shown is shown in0 inFigure Figure 4. 4It. Itcan can be be seen seen that that in in the the range range of of 0 0to to 1000 1000 mm, mm, the the refractive refractive index index changes changes in Figure 4. It can be seen that in the range of 0 to 1000 mm, the refractive index changes smoothly,smoothly, and and the the gradient gradient of of the refractiverefractive index index is is small. small. As As the the tracing tracing distance distance increases, in- smoothly, and the gradient of the refractive index is small. As the tracing distance in- creases,the refractive the refractive index index changes changes more more and moreand more rapidly, rapidly, and theand refractive the refractive index index decreases de- creases, the refractive index changes more and more rapidly, and the refractive index de- creasesrapidly. rapidly. The gradient The gradient of the refractiveof the refractive index rises index sharply. rises Thesharply. refractive The refractive index distribution index creasesdistributionis extremely rapidly. is extremely uneven.The gradient uneven of .th e refractive index rises sharply. The refractive index distribution is extremely uneven.

FigureFigure 4. Distribution 4. Distribution curve curve of the of the refractive refractive index index along along the the z axis.z axis. Figure 4. Distribution curve of the refractive index along the z axis. UnderUnder paraxial paraxial conditions, conditions, the the analytical analytical solution solution of ofthe the ray ray equation equation is: is: Under paraxial conditions, the analytical solution of the ray equation is: ( p0 x = x0 + [arcsin(αz) − arcsin(αz0)] n0 × α (18) y = y + q0 [arcsin(αz) − arcsin(αz )] 0 n0 × α 0

When the incident point coordinate is (0, 0, 0) and the incident ray direction vector is (0, 0.0001, 0), Formula (18) can be simplified as: ( x = 0 = 0.0001 [ (− ) − (− )] (19) y 1.5 × (−0.0001) arcsin 0.0001z arcsin 0.0001z0 Appl. Sci. 2021, 11, x FOR PEER REVIEW 8 of 10

 p0 x  x00  arcsin( z )  arcsin( z )  n0    (18) q y  y  0 arcsin( z )  arcsin( z )  00   n0   When the incident point coordinate is (0, 0, 0) and the incident ray direction vector is (0, 0.0001, 0), Formula (18) can be simplified as: x  0   0.0001 (19) Appl. Sci. 2021, 11, 912 y  arcsin( 0.0001 z )  arcsin( 0.0001 z0 ) 7 of 9  1.5  ( 0.0001) When the tracing length is 2000 mm, the optical path analytical solution is:

L1  nds When the tracing length is 2000 mm, the optical path analytical solution is: l

R 2000 L = nds 0.00049 2 1  l n  1  (   arcsin(  0.000 49 z )  arcsin(  0.000 49 z ) ) dz . (20) 0 r ( 0.000 ) 0 R 2000 1.5 0.00049 49 2 = n × 1 + ( × (− ) × [arcsin(− 0.00049z) − arcsin(− 0.00049z0)]) dz (20) 2.396141580 103 (mm)1.5 0.00049 = 2.39614158 × 103(mm) Using the algorithm proposed in this paper to trace the gradient refractive index me- Using the algorithm proposed in this paper to trace the gradient refractive index dium from 0 to 2000 mm, it is possible to obtain the medium from 0 to 2000 mm, it is possible to obtain the optical path length L1  2.3961413  103 . L1 = 2.3961413 × 103. The curve in Figure 5 shows the relationship between the geometric step length and The curve in Figure5 shows the relationship between the geometric step length and the tracing distance of the two methods. The number of iterations for both of these two the tracing distance of the two methods. The number of iterations for both of these two methods is 6821. For the traditional ray tracing method, the geometric step length is con- methods is 6821. For the traditional ray tracing method, the geometric step length is stantconstant.. For the For method the method proposed proposed in this in thispaper, paper, the thegeometric geometric step step length length can can be be adjusted adjusted adaptivelyadaptively according according to to the the refractive refractive index index distribution. distribution. In Inthe the first first half half of of the the tracing tracing trajectotrajectory,ry, the the refractive refractive index index of of the the medium medium changes changes slower slower.. Therefore, Therefore, the the geometric geometric stepstep size size is islarger. larger. As As the the trac tracinging trajectory trajectory gradually gradually approaches approaches 2000 2000 mm mm,, the the refractive refractive indexindex of of the the medium medium changes changes intensify intensify,, and and its its geometric geometric step step size size decreases decreases rapidly rapidly to to achieveachieve higher higher accuracy. accuracy.

FigureFigure 5. 5.ComparisonComparison of ofgeometric geometric steps steps (number (number of ofiterations: iterations: 6821). 6821).

InIn Figure Figure 66, ,the the RTRIS RTRIS represents represents the the error error between between the the optical optical path path obtained obtained by by the the rayray tracing tracing method method based based on on the the refractive refractive index index step step and and the the actual actual optical optical path path from from 0 0 toto 2000 2000 mm. mm. The The RTSGS RTSGS represents represents the theerror error between between the optical the optical path pathobtained obtained by the by ray the tracingray tracing method method based based on the on geometric the geometric step and step the and actual the actual optical optical path. path.Comparing Comparing the tracingthe tracing errors errors of the of two the trac twoing tracing methods methods in Figure in Figure 5, it can5, it b cane found be found that thatthe trac theing tracing ac- curacyaccuracy of the of theray raytracing tracing method method based based on onthe the refractive refractive index index step step is issignificantly significantly better better than that of the traditional ray tracing method based on the geometric step. When the tracing distance is 2000 mm, the cumulative error of the RTRIS is 2.5 × 10−4 mm, and the cumulative error of the RTSGS is up to 3.13 × 10−4 mm. Combine Figures3–5, in the initial stage of ray tracing, due to the slow change of the refractive index of the medium, the errors of the two methods are almost equal although the geometric step length of RTSGS is relatively large. As the tracing distance gradually increases, the advantages of the RTSGS gradually become apparent. Because the refractive index of the medium changes smoothly and the geometric step of RTSGS is larger, there are fewer iterations and smaller cumulative errors. When the tracing distance continues to increase, especially when it is close to 2000 mm, the refractive index of the medium decreases rapidly. The tracing step length for RTRIS cannot adaptively change, the error increases rapidly. RTSGS can adjust the geometric step length adaptively. Therefore, the geometric step is adjusted to be smaller in this section, which can better capture the refractive index change of the medium and improve the accuracy. It can be seen Appl. Sci. 2021, 11, x FOR PEER REVIEW 9 of 10

Appl. Sci. 2021, 11, 912 8 of 9

than that of the traditional ray tracing method based on the geometric step. When the 4 tracthating thedistance essence is 2000 of RTSGS mm, the is to cumulative reasonably error allocate of the the RTRIS geometric is 2.5 step 10 lengthmm , and in the the ray 4 cumulativetracing process. error of the RTSGS is up to 3.13 10 mm .

FigureFigure 6. Ray 6. Ray tracing tracing error error example example 2. 2. 4. Conclusions Combine Figures 3–5, in the initial stage of ray tracing, due to the slow change of the refractivThee index ray tracingof the medium, method basedthe errors on theof the refractive two methods index are step almost proposed equal in although this paper the has geometricextensive step adaptability length of toRTSGS the axial is relatively gradient refractivelarge. As index,the trac especiallying distance the inhomogeneousgradually in- creasesrefractive, the advantages index medium of the with RTSGS a large gradually refractive become index gradient.apparent. It Because can efficiently the refractiv solvee the indexproblem of the thatmedium thetraditional changes smoothly ray tracing and the method geometric based step on of geometric RTSGS is step larger, cannot there adaptare fewerto the iterations inhomogeneous and smaller refractive cumulative index errors. medium When with the largetracing refractive distance indexcontinues gradient to in- or creasesudden, especially change when and improve it is close ray to tracing2000 mm, accuracy. the refractive At the index same time,of the the medium proposed decreases method rapidly.can achieve The trac high-efficiencying step length rayfor RTRIS tracing can innot a non-uniform adaptively change, refractive the error index increases medium rap- with idlysmall. RTSGS refractive can adjust index the change geometric rate ste duep length to the refractiveadaptively. index Therefore step used, the geometric in the recursion step process. By using the proposed method, the efficiency of ray tracing can be achieved is adjusted to be smaller in this section, which can better capture the refractive index change while the accuracy of ray tracing can be improved. Thus, the method realizes the adaptive of the medium and improve the accuracy. It can be seen that the essence of RTSGS is to process of the gradient index medium in the ray tracing process. reasonably allocate the geometric step length in the ray tracing process. This method, however, has some problems which have to be solved. The most important one is that the constant refractive-index surfaces need to be fitted during the 4. Conclusions iterative process, so as to solve the iteration point through the fitting formula. The current methodThe ray is totracing use high-order method based polynomials on the ref toractive fit the constantindex step refractive-index proposed in this surfaces, paper whichhas extensivemight introduce adaptability a certain to the axial error. gradient If the polynomial refractive index, order especially is too high, the it inhomogeneous will cause Runge refractivephenomenon. index medium Therefore, with different a large fitting refractive models index need gradient to be considered. It can efficiently in order solve to improve the problemthe ray that tracing the accuracytraditional for ray different tracing non-uniform method based refractive on geometric index media.step can Althoughnot adapt there to theare inhomogeneous some shortcomings refractive in thisindex method, medium we with believe large that refractive this method index gradient will have or asud- good denapplication change and in rayimprove tracing ray in tracing gradient accuracy index media,. At the especially same time, in shock the proposed . method can achieve high-efficiency ray tracing in a non-uniform refractive index medium with smallAuthor refractive Contributions: index changeConceptualization, rate due to Q.Z.;the refractive and Y.T.; methodology, index step used Q.Z.; in software, the recursion Q.Z.; vali- process.dation, By Y.T., using G.R. the and proposed T.T.; formal method, analysis, the G.R.; efficiency investigation, of ray Q.Z.;tracing resources, can be achieved Y.T.; data curation,while theT.T.; accuracy writing—original of ray tracing draft can preparation, be improved. Q.Z.; writing—review Thus, the method and editing,realizes T.T.; the visualization, adaptive pro- Q.Z.; cesssupervision, of the gradient T.T.; All index authors medium have read in the and ray agreed tracing to the process. published version of the manuscript. Funding:This methodThis research, however, was funded has some by Open problems Research which Fund ofhave State to Key beLaboratory solved. The of Pulsedmost Powerim- portantLaser one Technology is that the (SKL2018KF05), constant refractive Excellent-index Youth surfaces Foundation need of to Sichuan be fitted Scientific during Committeethe iter- ative(2019JDJQ0012), process, so Youthas to Innovationsolve the Promotioniteration point Association, through CAS the (2018411), fitting CASformula “Light. The of West current China” methodProgram is and to use Young high Talents-order of Sichuan polynomials Thousand to fit People the Program.constant refractive-index surfaces, whichInstitutional might introduce Review Board a certain Statement: error.Not If the applicable. polynomial order is too high, it will cause Runge phenomenon. Therefore, different fitting models need to be considered in order to improveInformed the Consent ray tracing Statement: accuracyNot applicable.for different non-uniform refractive index media. Alt- houghData there Availability are some Statement: shortcomingsNot applicable. in this method, we believe that this method will have a good application in ray tracing in gradient index media, especially in shock waves. Conflicts of Interest: The authors declare no conflict of interest. Appl. Sci. 2021, 11, 912 9 of 9

References 1. Qiao, Y.F. Gradient Refractive Index Optics; Science Press: Beijing, China, 1991; pp. 1–61. 2. Lucian, M. Ray Tracing in Inhomogeneous Media. J. Opt. Soc. Am. 1968, 58, 1667–1668. 3. Daniel, W.H.; John, W.Y.L. Numerical ray-tracing methods for gradient index media. Can. J. Phys. 1985, 63, 234–239. 4. Feng, D.H.; Pan, S.; Wang, W.L.; Li, H. Simulation and Analysis of Ray Tracing in Discretionary Gradient Refraction Index Medium. Comput. Simul. 2010, 27, 135–139. 5. Lee, S.Y. Comparison of the Aero-Optical Effects Due to and Boundary Layer in High-Speed Flow. Ph.D. Thesis, Seoul National University, Seoul, Korea, 2020. 6. Sharma, A.; Kumar, D.V.; Ghatak, A.K. Tracing rays through graded-index media: A new method. Appl. Opt. 1982, 21, 984–987. [CrossRef] 7. Feng, D.H.; Pan, S.; Tian, Z.Y.; Li, H. Research on Ray tracing Method in 3D Discrete Space with Discretionary Refraction Index. Acta Opt. Sin. 2010, 30, 696–701. [CrossRef] 8. Wu, L.; Fang, J.C.; Yang, Z.H. Study on Aero-Optical Distortion Simulation of High Refraction Index Gradient Regions in Hypersonic Turbulent Flow. Acta Opt. Sin. 2009, 29, 2952–2957. 9. Bernold, R. Finite element ray tracing: A new method for ray tracing in gradient-index media. Appl. Opt. 1996, 35, 6186–6189. 10. Krzysztofs, S.K.; Thomas, W.S. Faster Ray Tracing Using Adaptive Grids. IEEE 1997, 17, 42–51. 11. Victor, G.; Gregory, M. Computational methods to compute error due to aero-optic effects. Proc. SPIE 2013, 8840, 1–9. 12. Seul, K.Y.; Sehyun, S.; Dongok, R.; Sug-Whan, K.; Hyeuknam, K.; Sang-Hun, J.; Ho, J.; Hyun, B.K.; Jae, W.L.; Jong, H.C. Ray tracing simulation of aero-optical effect using multiple gradient-index layer. Proc. SPIE 2016, 9987, 1–9. 13. Wang, K.; Wang, M. Aero-optics of subsonic turbulent boundary layers. J. Fluid. Mech. 2012, 696, 122–151. [CrossRef] 14. Gordeyev, S.; Jumper, E.; Ng, T.-M.; Cain, A. Aero-Optical Characteristics of Compressible, Subsonic Turbulent Boundary Layers. In Proceedings of the 34th AIAA Plasmadynamics and Conference, American Institute of Aeronautics and Astronautics (AIAA), Orlando, FL, USA, 23–26 June 2003. 15. Yanta, W.; Sprin, C.; Lafferty, J.; Collier, A.; Bell, R.; Neal, D.; Hamrick, D.; Copland, R.; Pezzaniti, L.; Banish, M.; et al. Near- and farfield measurements of aero-optical effects due to propagation through hypersonic flows. In Proceedings of the 31st Plasmadynamics and Lasers Conference, American Institute of Aeronautics and Astronautics (AIAA), Reston, VA, USA, 19–22 June 2000. 16. Feng, D.H.; Pan, S.; Tian, Z.Y.; Li, H. Method of Ray Tracing through Shock Wave Flow Field. J. Natl. Univ. Def. Technol. 2010, 32, 6–10. 17. Ren, X.L. Aero-Optical Effect and Suppression Techniques of Large Aperture Optical System. Ph.D. Thesis, University of Chinese Academy of Sciences, Beijing, China, 2019. 18. Yu, D.Y.; Tan, H.Y. Engineering Optics, 4th ed.; China Machine Press: Beijing, China, 2015; pp. 1–58.