ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/tmesh.cal
Revision: 2.2
Committed: Wed Jun 15 12:36:10 1994 UTC (30 years, 11 months ago) by greg
Branch: MAIN
Changes since 2.1: +12 -9 lines
Log Message:
simplified barycentric calculation

File Contents

# User Rev Content
1 greg 2.1 { SCCSid "$SunId$ LBL" }
2    
3     {
4     Interpolate triangle-mesh values using barycentric coordinates.
5    
6 greg 2.2 A1 = Major axis (0==X, 1==Y, 2==Z)
7     A2 through A7 = Transformation for barycentric system
8 greg 2.1 and:
9 greg 2.2 A8 through A16 = Surface normal perturbation matrix
10 greg 2.1 or:
11 greg 2.2 A8 through A13 = Lookup in 2-dimensional pattern or texture
12 greg 2.1 }
13     { Compute barycentric coordinates }
14 greg 2.2 bu = select(arg(1)+1, Py, Pz, Px);
15     bv = select(arg(1)+1, Pz, Px, Py);
16     a = bu*arg( 2) + bv*arg( 3) + arg( 4);
17     b = bu*arg( 5) + bv*arg( 6) + arg( 7);
18     c = 1 - a - b;
19 greg 2.1 { Compute variables }
20 greg 2.2 v1 = a*arg( 8) + b*arg( 9) + c*arg(10);
21     v2 = a*arg(11) + b*arg(12) + c*arg(13);
22     v3 = a*arg(14) + b*arg(15) + c*arg(16);
23 greg 2.1 { Surface normal perturbation }
24     nf = 1/sqrt(v1*v1 + v2*v2 + v3*v3);
25     dx = v1*nf - Nx;
26     dy = v2*nf - Ny;
27     dz = v3*nf - Nz;
28     { Lookup table index }
29     u = v1;
30     v = v2;