64 |
|
{ |
65 |
|
The following forumulas compute Shirley-Chiu bin "scbin" based on: |
66 |
|
|
67 |
+ |
RHS - right-handed system (-1 for left-handed coords) |
68 |
|
Dx,Dy,Dz - Incident direction (normalized, towards surface front) |
69 |
|
rNx,rNy,rNz - Surface normal (normalized, away from surface) |
70 |
|
Ux,Uy,Uz - Up direction vector (does not need to be normalized) |
72 |
|
The SCdim variable assigns the square side dimension for bins, which are |
73 |
|
ordered with the "up" direction changing fastest. |
74 |
|
} |
75 |
< |
|
75 |
> |
RHS = 1; |
76 |
|
{ Compute oriented axis values } |
77 |
|
inc_dz = -Dx*rNx-Dy*rNy-Dz*rNz; |
78 |
< |
inc_rx = -Dx*(Uy*rNz-Uz*rNy) - Dy*(Uz*rNx-Ux*rNz) - Dz*(Ux*rNy-Uy*rNx); |
78 |
> |
inc_rx = -RHS*(Dx*(Uy*rNz-Uz*rNy) + Dy*(Uz*rNx-Ux*rNz) + Dz*(Ux*rNy-Uy*rNx)); |
79 |
|
inc_ry = -Dx*Ux-Dy*Uy-Dz*Uz - inc_dz*(rNx*Ux+rNy*Uy+rNz*Uz); |
80 |
|
inc_den2 = inc_rx*inc_rx + inc_ry*inc_ry; |
81 |
|
inc_radf = if(inc_den2-1e-7, sqrt((1 - inc_dz*inc_dz)/inc_den2), 0); |