ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/tmesh.cal
Revision: 2.1
Committed: Tue Feb 15 15:58:02 1994 UTC (31 years, 3 months ago) by greg
Branch: MAIN
Log Message:
Initial revision

File Contents

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