| 1 |
greg |
1.1 |
{ SCCSid "$SunId$ LBL" }
|
| 2 |
|
|
|
| 3 |
|
|
{
|
| 4 |
|
|
Coordinate computations for mkillum output.
|
| 5 |
|
|
|
| 6 |
greg |
2.2 |
For the spherical case, A1-A3 is the value at the positive pole,
|
| 7 |
|
|
A4-A6 is the value at the negative pole, and A7 is the pole influence:
|
| 8 |
greg |
1.1 |
|
| 9 |
|
|
il_alt - Altitude (1 to -1) for spherical coordinates
|
| 10 |
|
|
il_azi - Azimuth (0 to 2*PI) for sphere
|
| 11 |
|
|
|
| 12 |
greg |
2.2 |
For the hemispherical case, A1-A3 and A4 are the pole value and
|
| 13 |
|
|
influence, respectively, and A5-A13 are the unit vectors for the
|
| 14 |
greg |
1.1 |
hemisphere's coordinate system:
|
| 15 |
|
|
|
| 16 |
|
|
il_alth - Altitude (1 to 0) for hemispherical coordinates
|
| 17 |
|
|
il_azih - Azimuth (0 to 2*PI) for hemisphere
|
| 18 |
|
|
}
|
| 19 |
|
|
|
| 20 |
greg |
2.2 |
norm_rad(r) : if( r, r, r+2*PI );
|
| 21 |
|
|
{ sphere coordinates }
|
| 22 |
greg |
1.1 |
il_alt = Dz;
|
| 23 |
|
|
il_azi = norm_rad(atan2(Dy, Dx));
|
| 24 |
|
|
|
| 25 |
greg |
2.3 |
s_val(v, vN, vS) = if( il_alt-A7,
|
| 26 |
greg |
2.2 |
linterp((il_alt-A7)/(1-A7), v, vN),
|
| 27 |
|
|
if ( -il_alt-A7,
|
| 28 |
|
|
linterp((-il_alt-A7)/(1-A7), v, vS),
|
| 29 |
|
|
v ),
|
| 30 |
greg |
2.3 |
v );
|
| 31 |
greg |
2.2 |
{ sphere values }
|
| 32 |
|
|
s_red(r,g,b) = s_val(r, A1, A4);
|
| 33 |
|
|
s_grn(r,g,b) = s_val(g, A2, A5);
|
| 34 |
|
|
s_blu(r,g,b) = s_val(b, A3, A6);
|
| 35 |
|
|
s_gry(r,g,b) = s_val(grey(r,g,b), grey(A1,A2,A3), grey(A4,A5,A6));
|
| 36 |
greg |
1.1 |
|
| 37 |
greg |
2.2 |
{ hemisphere coordinates }
|
| 38 |
|
|
il_alth = sq(-Dx*arg(11)-Dy*arg(12)-Dz*arg(13));
|
| 39 |
|
|
il_azih = norm_rad(atan2(-Dx*arg(8)-Dy*arg(9)-Dz*arg(10),
|
| 40 |
|
|
-Dx*arg(5)-Dy*arg(6)-Dz*arg(7)));
|
| 41 |
|
|
|
| 42 |
greg |
2.3 |
h_val(v, vN) = if( il_alth-A4, linterp((il_alth-A4)/(1-A4), v, vN), v );
|
| 43 |
greg |
2.2 |
{ hemisphere values }
|
| 44 |
|
|
h_red(r,g,b) = h_val(r, A1);
|
| 45 |
|
|
h_grn(r,g,b) = h_val(g, A2);
|
| 46 |
|
|
h_blu(r,g,b) = h_val(b, A3);
|
| 47 |
|
|
h_gry(r,g,b) = h_val(grey(r,g,b), grey(A1,A2,A3));
|