ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/disk2square.cal
(Generate patch)

Comparing ray/src/util/disk2square.cal (file contents):
Revision 2.1 by greg, Mon Jul 21 15:59:47 2014 UTC vs.
Revision 2.4 by greg, Fri Mar 27 18:58:06 2015 UTC

# Line 64 | Line 64 | out_square_y = (out_square_b + 1)/2;
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 <        Nx,Ny,Nz        - Surface normal (normalized, away from surface)
69 >        rNx,rNy,rNz     - Surface normal (normalized, away from surface)
70          Ux,Uy,Uz        - Up direction vector (does not need to be normalized)
71  
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_dot = -Dx*Nx-Dy*Ny-Dz*Nz;
78 < inc_rx = -Dx*(Uy*Nz-Uz*Ny) - Dy*(Uz*Nx-Ux*Nz) - Dz*(Ux*Ny-Uy*Nx);
79 < inc_ry = -Dx*Ux-Dy*Uy-Dz*Uz - inc_dot*(Nx*Ux+Ny*Uy+Nz*Uz);
77 > inc_dz = -Dx*rNx-Dy*rNy-Dz*rNz;
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_dot*inc_dot)/inc_den2), 0);
81 > inc_radf = if(inc_den2-1e-7, sqrt((1 - inc_dz*inc_dz)/inc_den2), 0);
82                                  { Pass to formulas in first section }
83   in_disk_x = inc_rx*inc_radf;
84   in_disk_y = inc_ry*inc_radf;
85                                  { Compute final bin (-1 if behind surface) }
86 < scbin = if(inc_dot,
86 > scbin = if(inc_dz,
87                  floor(out_square_x*SCdim)*SCdim + floor(out_square_y*SCdim),
88                  -1);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines