ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/ambpos.cal
Revision: 2.2
Committed: Thu May 1 02:52:03 2014 UTC (9 years, 11 months ago) by greg
Branch: MAIN
Changes since 2.1: +11 -7 lines
Log Message:
Fixed a number of issues with zero values and corrected direction gradient

File Contents

# Content
1 { RCSid $Id: ambpos.cal,v 2.1 2014/04/24 23:15:42 greg Exp $ }
2 {
3 Compute patterns for ambient position markers
4 }
5 { Relative hit point }
6 rpx = Px - arg(1);
7 rpy = Py - arg(2);
8 rpz = Pz - arg(3);
9
10 { Calculation of directional gradient pattern }
11 ndx = arg(4); ndy = arg(5); ndz = arg(6);
12 dgx = arg(7); dgy = arg(8); dgz = arg(9);
13 rdx = ndy*rpz - ndz*rpy;
14 rdy = ndz*rpx - ndx*rpz;
15 rdz = ndx*rpy - ndy*rpx;
16 dgrad = (rdx*dgx + rdy*dgy + rdz*dgz)/sqrt(rpx*rpx + rpy*rpy + rpz*rpz);
17 dirfunc = bound(0, 1 + dgrad, 2);
18
19 { Relative hit point }
20 rpx = Px - arg(1);
21 rpy = Py - arg(2);
22 rpz = Pz - arg(3);
23
24 { Calculation of positional gradient pattern }
25 pgx = arg(4); pgy = arg(5); pgz = arg(6);
26 posfunc = bound(0, 1 + (pgx*rpx + pgy*rpy + pgz*rpz), 2);
27
28 { Calculation of ellipse stencil for base }
29 usx = arg(4); usy = arg(5); usz = arg(6);
30 vsx = arg(7); vsy = arg(8); vsz = arg(9);
31 ellipstencil = if(1 - sq(usx*rpx + usy*rpy + usz*rpz) - sq(vsx*rpx + vsy*rpy + vsz*rpz),
32 1, 0);