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.3 by greg, Fri Jul 25 16:58:20 2014 UTC vs.
Revision 2.5 by greg, Tue Aug 13 18:29:23 2019 UTC

# Line 51 | Line 51 | out_square_a = select(in_disk_rgn,
51                          in_disk_r,
52                          (PI/2 - in_disk_phi)*in_disk_r/(PI/4),
53                          -in_disk_r,
54 <                        (in_disk_phi - 3*PI/2)*in_disk_r/(PI/4));
54 >                        (in_disk_phi - 3*PI/2)*in_disk_r/(PI/4),
55 >                        in_disk_r);
56  
57   out_square_b = select(in_disk_rgn,
58                          in_disk_phi*in_disk_r/(PI/4),
59                          in_disk_r,
60                          (PI - in_disk_phi)*in_disk_r/(PI/4),
61 <                        -in_disk_r);
61 >                        -in_disk_r, -in_disk_r);
62  
63   out_square_x = (out_square_a + 1)/2;
64   out_square_y = (out_square_b + 1)/2;
65   {
66          The following forumulas compute Shirley-Chiu bin "scbin" based on:
67  
68 +        RHS             - right-handed system (-1 for left-handed coords)
69          Dx,Dy,Dz        - Incident direction (normalized, towards surface front)
70          rNx,rNy,rNz     - Surface normal (normalized, away from surface)
71          Ux,Uy,Uz        - Up direction vector (does not need to be normalized)
# Line 71 | Line 73 | out_square_y = (out_square_b + 1)/2;
73          The SCdim variable assigns the square side dimension for bins, which are
74          ordered with the "up" direction changing fastest.
75   }
76 <
76 > RHS = 1;
77                                  { Compute oriented axis values }
78   inc_dz = -Dx*rNx-Dy*rNy-Dz*rNz;
79 < inc_rx = -Dx*(Uy*rNz-Uz*rNy) - Dy*(Uz*rNx-Ux*rNz) - Dz*(Ux*rNy-Uy*rNx);
79 > inc_rx = -RHS*(Dx*(Uy*rNz-Uz*rNy) + Dy*(Uz*rNx-Ux*rNz) + Dz*(Ux*rNy-Uy*rNx));
80   inc_ry = -Dx*Ux-Dy*Uy-Dz*Uz - inc_dz*(rNx*Ux+rNy*Uy+rNz*Uz);
81   inc_den2 = inc_rx*inc_rx + inc_ry*inc_ry;
82   inc_radf = if(inc_den2-1e-7, sqrt((1 - inc_dz*inc_dz)/inc_den2), 0);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines