--- ray/src/util/disk2square.cal 2014/07/21 15:59:47 2.1 +++ ray/src/util/disk2square.cal 2014/07/22 23:21:56 2.2 @@ -1,4 +1,4 @@ -{ RCSid $Id: disk2square.cal,v 2.1 2014/07/21 15:59:47 greg Exp $ } +{ RCSid $Id: disk2square.cal,v 2.2 2014/07/22 23:21:56 greg Exp $ } { Convert between unit square and disk, using Shirley-Chiu mapping @@ -73,15 +73,15 @@ out_square_y = (out_square_b + 1)/2; } { Compute oriented axis values } -inc_dot = -Dx*Nx-Dy*Ny-Dz*Nz; +inc_dz = -Dx*Nx-Dy*Ny-Dz*Nz; inc_rx = -Dx*(Uy*Nz-Uz*Ny) - Dy*(Uz*Nx-Ux*Nz) - Dz*(Ux*Ny-Uy*Nx); -inc_ry = -Dx*Ux-Dy*Uy-Dz*Uz - inc_dot*(Nx*Ux+Ny*Uy+Nz*Uz); +inc_ry = -Dx*Ux-Dy*Uy-Dz*Uz - inc_dz*(Nx*Ux+Ny*Uy+Nz*Uz); inc_den2 = inc_rx*inc_rx + inc_ry*inc_ry; -inc_radf = if(inc_den2-1e-7, sqrt((1 - inc_dot*inc_dot)/inc_den2), 0); +inc_radf = if(inc_den2-1e-7, sqrt((1 - inc_dz* inc_dz)/inc_den2), 0); { Pass to formulas in first section } in_disk_x = inc_rx*inc_radf; in_disk_y = inc_ry*inc_radf; { Compute final bin (-1 if behind surface) } -scbin = if(inc_dot, +scbin = if(inc_dz, floor(out_square_x*SCdim)*SCdim + floor(out_square_y*SCdim), -1);