137 double r, d, ur, ud, px, rv;
138 double sr, cr, sd, cd, x, y, z,
w;
139 double v1[ 6 ], v2[ 6 ];
141 double rxyz, wd, rxysq, rxy;
145 static const double tiny = 1.0E-30;
148 double a[ 6 ] = { -1.62557E-6, -0.31919E-6, -0.13843E-6,
149 +1.245E-3, -1.580E-3, -0.659E-3 };
150 double emi[ 6 ][ 6 ] = {
151 { 0.9999256795, 0.0111814828, 0.0048590039,
152 -0.00000242389840, -0.00000002710544, -0.00000001177742},
153 {-0.0111814828, 0.9999374849, -0.0000271771,
154 0.00000002710544, -0.00000242392702, 0.00000000006585 },
155 {-0.0048590040, -0.0000271557, 0.9999881946,
156 0.00000001177742, 0.00000000006585, -0.00000242404995 },
157 {-0.000551, 0.238509, -0.435614,
158 0.99990432, 0.01118145, 0.00485852 },
159 {-0.238560, -0.002667, 0.012254,
160 -0.01118145, 0.99991613, -0.00002717},
161 { 0.435730, -0.008541, 0.002117,
162 -0.00485852, -0.00002716, 0.99996684 } };
188 v1[ 3 ] = -ur*y - cr*sd*ud + w*x;
189 v1[ 4 ] = ur*x - sr*sd*ud + w*y;
190 v1[ 5 ] = cd*ud + w*z;
193 for( i = 0; i < 6; i++ ) {
195 for( j = 0; j < 6; j++ ) {
196 w += emi[
i ][ j ]*v1[ j ];
205 rxyz = sqrt( x*x + y*y + z*z );
208 w = x*a[ 0 ] + y*a[ 1 ] + z*a[ 2 ];
209 x += a[ 0 ]*rxyz - w*x;
210 y += a[ 1 ]*rxyz - w*y;
211 z += a[ 2 ]*rxyz - w*z;
214 rxyz = sqrt( x*x + y*y + z*z );
220 w = x*a[ 0 ] + y*a[ 1 ] + z*a[ 2 ];
221 wd = x*a[ 3 ] + y*a[ 4 ] + z*a[ 5 ];
222 x += a[ 0 ]*rxyz - w*x;
223 y += a[ 1 ]*rxyz - w*y;
224 z += a[ 2 ]*rxyz - w*z;
225 xd = v2[ 3 ] + a[ 3 ]*rxyz - wd*x;
226 yd = v2[ 4 ] + a[ 4 ]*rxyz - wd*y;
227 zd = v2[ 5 ] + a[ 5 ]*rxyz - wd*z;
233 if( x == 0.0 && y == 0.0 ) {
242 ur = ( x*yd - y*xd )/rxysq;
243 ud = ( zd*rxysq - z*( x*xd + y*yd ) )/( ( rxysq + z*z )*rxy );
248 rv = ( x*xd + y*yd + z*zd )/( px*
PAL__VF*rxyz );
static const double PAL__VF
static const double PAL__D2PI