Skip to main content
. 2023 Jan 14;23(2):973. doi: 10.3390/s23020973
Algorithm 1 G Mode
1: RnRay, index:n={0,1,2, N1} , N = maximum number of guide ray
2: TBTree build data
3: LListener
4: CHT Combinations of hit-triangles
5: CB Combinations buffer
6: procedure Guide mode (L, TB, CB)
7: Step 01: Finds combination of hit-triangles
8: for R{R0,Rn1} do 
9:  R Set origin position (position of L) and random direction
10:  CHT Ray tracing processing (R, TB)
11:  if CHT is valid then
12:   CB Add CHT
13:  end if  
14: end for
15: Step 02: Sorts and removes duplicate combination of hit-triangles
16: for d = 0 to 3 do // depth loop
17:  Merge-sort CHT that have depth d in CB
18: end for
19: for i = 0 to N − 1, j = 0 to N − 1 do // N is number of combinations
20:  if CHTi is equal to CHTj then
21:   jj+1
22:  else
23:   Remove from CHTi+1 to CHTj1
24:   ij
25:   jj+1
26:  end if
27: end for
28: end procedure