| 1 | 
greg | 
2.9 | 
{ RCSid: $Id$ } | 
| 2 | 
greg | 
1.1 | 
{ | 
| 3 | 
  | 
  | 
        Source distribution coordinates (degrees). | 
| 4 | 
  | 
  | 
 | 
| 5 | 
greg | 
2.6 | 
        Theta is measured from the negative z-axis. | 
| 6 | 
  | 
  | 
        Phi is measured from the positive x-axis (0 degrees) | 
| 7 | 
  | 
  | 
                towards the negative y-axis (90 degrees). | 
| 8 | 
greg | 
1.1 | 
 | 
| 9 | 
  | 
  | 
        srcB_vert and srcB_horiz are angles | 
| 10 | 
  | 
  | 
        used in type B photometry. | 
| 11 | 
  | 
  | 
 | 
| 12 | 
greg | 
2.2 | 
        boxcorr function corrects for distribution modeled | 
| 13 | 
  | 
  | 
        with a rectangular box.  lboxcorr provides a more | 
| 14 | 
  | 
  | 
        accurate calculation for nearby surfaces, but requires | 
| 15 | 
  | 
  | 
        that the source box be centered at the origin. | 
| 16 | 
greg | 
2.5 | 
        The dimensions of the box, which must be aligned with | 
| 17 | 
  | 
  | 
        the x,y,z axes, are given in meters regardless of the | 
| 18 | 
  | 
  | 
        units being used in the scene file. | 
| 19 | 
greg | 
2.2 | 
 | 
| 20 | 
gregl | 
2.8 | 
        cylcorr function provides the same correction for a | 
| 21 | 
  | 
  | 
        cylinder whose central axis is aligned with the Z-axis. | 
| 22 | 
  | 
  | 
 | 
| 23 | 
greg | 
1.2 | 
        A1              - optional multipier | 
| 24 | 
greg | 
2.5 | 
        A2,A3,A4        - X,Y,Z dimensions of axis-aligned box (in meters!) | 
| 25 | 
gregl | 
2.8 | 
or | 
| 26 | 
  | 
  | 
        A2,A3           - diameter and height of Z-aligned cylinder (meters) | 
| 27 | 
greg | 
1.1 | 
} | 
| 28 | 
greg | 
1.2 | 
                                        { local definitions } | 
| 29 | 
  | 
  | 
boxprojection = abs(Dx)*A3*A4 + abs(Dy)*A2*A4 + abs(Dz)*A2*A3; | 
| 30 | 
greg | 
2.2 | 
lboxprojection = (      noneg(abs(Px-Dx*Ts)-A2/2)*A3*A4 + | 
| 31 | 
  | 
  | 
                        noneg(abs(Py-Dy*Ts)-A3/2)*A2*A4 + | 
| 32 | 
  | 
  | 
                        noneg(abs(Pz-Dz*Ts)-A4/2)*A2*A3 ) / Ts; | 
| 33 | 
gregl | 
2.8 | 
cylprojection = A2*A3*sqrt(1-Dz*Dz) + PI/4*A2*A2*abs(Dz); | 
| 34 | 
greg | 
1.1 | 
 | 
| 35 | 
  | 
  | 
flatcorr(v) = corr(v) / Rdot;           { correction for flat sources } | 
| 36 | 
  | 
  | 
corr(v) = if(AC-.5, A1*v, v);           { multiplier correction } | 
| 37 | 
greg | 
1.2 | 
boxcorr(v) = A1 * v / boxprojection;    { correction for emitting box } | 
| 38 | 
greg | 
2.2 | 
lboxcorr(v) = A1 * v / lboxprojection;  { local box correction } | 
| 39 | 
gregl | 
2.8 | 
cylcorr(v) = A1 * v / cylprojection;    { cylinder correction } | 
| 40 | 
greg | 
1.1 | 
 | 
| 41 | 
  | 
  | 
src_theta = Acos(Dz) / DEGREE;                  { 0-180 } | 
| 42 | 
greg | 
2.7 | 
src_phi = mod( Atan2(Dy, -Dx) / DEGREE, 360 );  { 0-360 } | 
| 43 | 
greg | 
1.1 | 
                                { bilateral symmetry } | 
| 44 | 
  | 
  | 
src_phi2 = tri( src_phi, 180 );         { 0-180 } | 
| 45 | 
  | 
  | 
                                { quadrilateral symmetry } | 
| 46 | 
  | 
  | 
src_phi4 = tri( src_phi, 90 );          { 0-90 } | 
| 47 | 
  | 
  | 
 | 
| 48 | 
  | 
  | 
                                { Type B photometry coordinates } | 
| 49 | 
greg | 
2.9 | 
srcB_vert = atan2( -Dx, Dz ) / DEGREE; | 
| 50 | 
  | 
  | 
srcB_horiz = atan2( Dy, Dz ) / DEGREE; | 
| 51 | 
greg | 
2.4 | 
                                { w/ symmetry } | 
| 52 | 
  | 
  | 
srcB_vert2 = abs( srcB_vert ); | 
| 53 | 
greg | 
1.1 | 
srcB_horiz2 = abs( srcB_horiz ); |