ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/ambpos.cal
Revision: 2.3
Committed: Thu May 1 03:00:59 2014 UTC (9 years, 11 months ago) by greg
Branch: MAIN
CVS Tags: rad4R2
Changes since 2.2: +1 -6 lines
Log Message:
Removed redundant statements added inadvertantly in last change

File Contents

# User Rev Content
1 greg 2.3 { RCSid $Id: ambpos.cal,v 2.2 2014/05/01 02:52:03 greg Exp $ }
2 greg 2.1 {
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 greg 2.2 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 greg 2.1 { Calculation of positional gradient pattern }
20     pgx = arg(4); pgy = arg(5); pgz = arg(6);
21     posfunc = bound(0, 1 + (pgx*rpx + pgy*rpy + pgz*rpz), 2);
22    
23     { Calculation of ellipse stencil for base }
24     usx = arg(4); usy = arg(5); usz = arg(6);
25     vsx = arg(7); vsy = arg(8); vsz = arg(9);
26     ellipstencil = if(1 - sq(usx*rpx + usy*rpy + usz*rpz) - sq(vsx*rpx + vsy*rpy + vsz*rpz),
27     1, 0);