]> git.mxchange.org Git - flightgear.git/blob - Time/sunpos.cxx
Added initial support for native SGI compilers.
[flightgear.git] / Time / sunpos.cxx
1 // sunpos.cxx (adapted from XEarth)
2 // kirk johnson
3 // july 1993
4 //
5 // code for calculating the position on the earth's surface for which
6 // the sun is directly overhead (adapted from _practical astronomy
7 // with your calculator, third edition_, peter duffett-smith,
8 // cambridge university press, 1988.)
9 //
10 // Copyright (C) 1989, 1990, 1993, 1994, 1995 Kirk Lauritz Johnson
11 //
12 // Parts of the source code (as marked) are:
13 //   Copyright (C) 1989, 1990, 1991 by Jim Frost
14 //   Copyright (C) 1992 by Jamie Zawinski <jwz@lucid.com>
15 //
16 // Permission to use, copy, modify and freely distribute xearth for
17 // non-commercial and not-for-profit purposes is hereby granted
18 // without fee, provided that both the above copyright notice and this
19 // permission notice appear in all copies and in supporting
20 // documentation.
21 //
22 // The author makes no representations about the suitability of this
23 // software for any purpose. It is provided "as is" without express or
24 // implied warranty.
25 //
26 // THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
27 // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS,
28 // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT
29 // OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
30 // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
31 // NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
32 // CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
33 //
34 // $Id$
35 // (Log is kept at end of this file)
36
37
38 #ifdef HAVE_CONFIG_H
39 #  include <config.h>
40 #endif
41
42 #include <Include/compiler.h>
43
44 #ifdef FG_HAVE_STD_INCLUDES
45 #  include <cmath>
46 #  include <cstdio>
47 #  include <ctime>
48 #else
49 #  include <math.h>
50 #  include <stdio.h>
51 #  include <time.h>
52 #endif
53
54 #include <Debug/logstream.hxx>
55 #include <Astro/solarsystem.hxx>
56 #include <Include/fg_constants.h>
57 #include <Main/views.hxx>
58 #include <Math/fg_geodesy.hxx>
59 #include <Math/mat3.h>
60 #include <Math/point3d.hxx>
61 #include <Math/polar3d.hxx>
62 #include <Math/vector.hxx>
63 #include <Scenery/scenery.hxx>
64
65 #include "fg_time.hxx"
66 #include "sunpos.hxx"
67
68 extern SolarSystem *solarSystem;
69
70 #undef E
71
72
73 /*
74  * the epoch upon which these astronomical calculations are based is
75  * 1990 january 0.0, 631065600 seconds since the beginning of the
76  * "unix epoch" (00:00:00 GMT, Jan. 1, 1970)
77  *
78  * given a number of seconds since the start of the unix epoch,
79  * DaysSinceEpoch() computes the number of days since the start of the
80  * astronomical epoch (1990 january 0.0)
81  */
82
83 #define EpochStart           (631065600)
84 #define DaysSinceEpoch(secs) (((secs)-EpochStart)*(1.0/(24*3600)))
85
86 /*
87  * assuming the apparent orbit of the sun about the earth is circular,
88  * the rate at which the orbit progresses is given by RadsPerDay --
89  * FG_2PI radians per orbit divided by 365.242191 days per year:
90  */
91
92 #define RadsPerDay (FG_2PI/365.242191)
93
94 /*
95  * details of sun's apparent orbit at epoch 1990.0 (after
96  * duffett-smith, table 6, section 46)
97  *
98  * Epsilon_g    (ecliptic longitude at epoch 1990.0) 279.403303 degrees
99  * OmegaBar_g   (ecliptic longitude of perigee)      282.768422 degrees
100  * Eccentricity (eccentricity of orbit)                0.016713
101  */
102
103 #define Epsilon_g    (279.403303*(FG_2PI/360))
104 #define OmegaBar_g   (282.768422*(FG_2PI/360))
105 #define Eccentricity (0.016713)
106
107 /*
108  * MeanObliquity gives the mean obliquity of the earth's axis at epoch
109  * 1990.0 (computed as 23.440592 degrees according to the method given
110  * in duffett-smith, section 27)
111  */
112 #define MeanObliquity (23.440592*(FG_2PI/360))
113
114 /* static double solve_keplers_equation(double); */
115 /* static double sun_ecliptic_longitude(time_t); */
116 static void   ecliptic_to_equatorial(double, double, double *, double *);
117 static double julian_date(int, int, int);
118 static double GST(time_t);
119
120 /*
121  * solve Kepler's equation via Newton's method
122  * (after duffett-smith, section 47)
123  */
124 /*
125 static double solve_keplers_equation(double M) {
126     double E;
127     double delta;
128
129     E = M;
130     while (1) {
131         delta = E - Eccentricity*sin(E) - M;
132         if (fabs(delta) <= 1e-10) break;
133         E -= delta / (1 - Eccentricity*cos(E));
134     }
135
136     return E;
137 }
138 */
139
140
141 /* compute ecliptic longitude of sun (in radians) (after
142  * duffett-smith, section 47) */
143 /*
144 static double sun_ecliptic_longitude(time_t ssue) {
145     // time_t ssue;              //  seconds since unix epoch
146     double D, N;
147     double M_sun, E;
148     double v;
149
150     D = DaysSinceEpoch(ssue);
151
152     N = RadsPerDay * D;
153     N = fmod(N, FG_2PI);
154     if (N < 0) N += FG_2PI;
155
156     M_sun = N + Epsilon_g - OmegaBar_g;
157     if (M_sun < 0) M_sun += FG_2PI;
158
159     E = solve_keplers_equation(M_sun);
160     v = 2 * atan(sqrt((1+Eccentricity)/(1-Eccentricity)) * tan(E/2));
161
162     return (v + OmegaBar_g);
163 }
164 */
165
166
167 /* convert from ecliptic to equatorial coordinates (after
168  * duffett-smith, section 27) */
169
170 static void ecliptic_to_equatorial(double lambda, double beta, 
171                                    double *alpha, double *delta) {
172     /* double  lambda;            ecliptic longitude       */
173     /* double  beta;              ecliptic latitude        */
174     /* double *alpha;             (return) right ascension */
175     /* double *delta;             (return) declination     */
176
177     double sin_e, cos_e;
178     double sin_l, cos_l;
179
180     sin_e = sin(MeanObliquity);
181     cos_e = cos(MeanObliquity);
182     sin_l = sin(lambda);
183     cos_l = cos(lambda);
184
185     *alpha = atan2(sin_l*cos_e - tan(beta)*sin_e, cos_l);
186     *delta = asin(sin(beta)*cos_e + cos(beta)*sin_e*sin_l);
187 }
188
189
190 /* computing julian dates (assuming gregorian calendar, thus this is
191  * only valid for dates of 1582 oct 15 or later) (after duffett-smith,
192  * section 4) */
193
194 static double julian_date(int y, int m, int d) {
195     /* int y;                    year (e.g. 19xx)          */
196     /* int m;                    month (jan=1, feb=2, ...) */
197     /* int d;                    day of month              */
198
199     int    A, B, C, D;
200     double JD;
201
202     /* lazy test to ensure gregorian calendar */
203     if (y < 1583) {
204         FG_LOG( FG_EVENT, FG_ALERT, 
205                 "WHOOPS! Julian dates only valid for 1582 oct 15 or later" );
206     }
207
208     if ((m == 1) || (m == 2)) {
209         y -= 1;
210         m += 12;
211     }
212
213     A = y / 100;
214     B = 2 - A + (A / 4);
215     C = (int)(365.25 * y);
216     D = (int)(30.6001 * (m + 1));
217
218     JD = B + C + D + d + 1720994.5;
219
220     return JD;
221 }
222
223
224 /* compute greenwich mean sidereal time (GST) corresponding to a given
225  * number of seconds since the unix epoch (after duffett-smith,
226  * section 12) */
227 static double GST(time_t ssue) {
228     /* time_t ssue;           seconds since unix epoch */
229
230     double     JD;
231     double     T, T0;
232     double     UT;
233     struct tm *tm;
234
235     tm = gmtime(&ssue);
236
237     JD = julian_date(tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday);
238     T  = (JD - 2451545) / 36525;
239
240     T0 = ((T + 2.5862e-5) * T + 2400.051336) * T + 6.697374558;
241
242     T0 = fmod(T0, 24.0);
243     if (T0 < 0) T0 += 24;
244
245     UT = tm->tm_hour + (tm->tm_min + tm->tm_sec / 60.0) / 60.0;
246
247     T0 += UT * 1.002737909;
248     T0 = fmod(T0, 24.0);
249     if (T0 < 0) T0 += 24;
250
251     return T0;
252 }
253
254
255 /* given a particular time (expressed in seconds since the unix
256  * epoch), compute position on the earth (lat, lon) such that sun is
257  * directly overhead.  (lat, lon are reported in radians */
258
259 void fgSunPosition(time_t ssue, double *lon, double *lat) {
260     /* time_t  ssue;           seconds since unix epoch */
261     /* double *lat;            (return) latitude        */
262     /* double *lon;            (return) longitude       */
263
264     /* double lambda; */
265     double alpha, delta;
266     double tmp;
267
268     /* lambda = sun_ecliptic_longitude(ssue); */
269     /* ecliptic_to_equatorial(lambda, 0.0, &alpha, &delta); */
270     //ecliptic_to_equatorial (solarPosition.lonSun, 0.0, &alpha, &delta);
271     
272     /* ********************************************************************** 
273      * NOTE: in the next function, each time the sun's position is updated, the
274      * the sun's longitude is returned from solarSystem->sun. Note that the 
275      * sun's position is updated at a much higher frequency than the rate at 
276      * which the solar system's rebuilds occur. This is not a problem, however,
277      * because the fgSunPosition we're talking about here concerns the changing
278      * position of the sun due to the daily rotation of the earth.
279      * The ecliptic longitude, however, represents the position of the sun with
280      * respect to the stars, and completes just one cycle over the course of a 
281      * year. Its therefore pretty safe to update the sun's longitude only once
282      * every ten minutes. (Comment added by Durk Talsma).
283      ************************************************************************/
284
285     ecliptic_to_equatorial( SolarSystem::theSolarSystem->getSun()->getLon(),
286                             0.0, &alpha, &delta );
287     tmp = alpha - (FG_2PI/24)*GST(ssue);
288     if (tmp < -FG_PI) {
289         do tmp += FG_2PI;
290         while (tmp < -FG_PI);
291     } else if (tmp > FG_PI) {
292         do tmp -= FG_2PI;
293         while (tmp < -FG_PI);
294     }
295
296     *lon = tmp;
297     *lat = delta;
298 }
299
300
301 /* given a particular time expressed in side real time at prime
302  * meridian (GST), compute position on the earth (lat, lon) such that
303  * sun is directly overhead.  (lat, lon are reported in radians */
304
305 static void fgSunPositionGST(double gst, double *lon, double *lat) {
306     /* time_t  ssue;           seconds since unix epoch */
307     /* double *lat;            (return) latitude        */
308     /* double *lon;            (return) longitude       */
309
310     /* double lambda; */
311     double alpha, delta;
312     double tmp;
313
314     /* lambda = sun_ecliptic_longitude(ssue); */
315     /* ecliptic_to_equatorial(lambda, 0.0, &alpha, &delta); */
316     //ecliptic_to_equatorial (solarPosition.lonSun, 0.0, &alpha, &delta);
317     ecliptic_to_equatorial( SolarSystem::theSolarSystem->getSun()->getLon(),
318                             0.0, &alpha,  &delta );
319
320 //    tmp = alpha - (FG_2PI/24)*GST(ssue);
321     tmp = alpha - (FG_2PI/24)*gst;      
322     if (tmp < -FG_PI) {
323         do tmp += FG_2PI;
324         while (tmp < -FG_PI);
325     } else if (tmp > FG_PI) {
326         do tmp -= FG_2PI;
327         while (tmp < -FG_PI);
328     }
329
330     *lon = tmp;
331     *lat = delta;
332 }
333
334
335 // update the cur_time_params structure with the current sun position
336 void fgUpdateSunPos( void ) {
337     fgLIGHT *l;
338     fgTIME *t;
339     FGView *v;
340     MAT3vec nup, nsun, v0, surface_to_sun;
341     Point3D p, rel_sunpos;
342     double dot, east_dot;
343     double sun_gd_lat, sl_radius;
344     double ntmp;
345
346     l = &cur_light_params;
347     t = &cur_time_params;
348     v = &current_view;
349
350     FG_LOG( FG_EVENT, FG_INFO, "  Updating Sun position" );
351
352     // (not sure why there was two)
353     // fgSunPosition(t->cur_time, &l->sun_lon, &sun_gd_lat);
354     fgSunPositionGST(t->gst, &l->sun_lon, &sun_gd_lat);
355
356     fgGeodToGeoc(sun_gd_lat, 0.0, &sl_radius, &l->sun_gc_lat);
357
358     p = Point3D( l->sun_lon, l->sun_gc_lat, sl_radius );
359     l->fg_sunpos = fgPolarToCart3d(p);
360
361     FG_LOG( FG_EVENT, FG_INFO, "    t->cur_time = " << t->cur_time );
362     FG_LOG( FG_EVENT, FG_INFO, 
363             "    Sun Geodetic lat = " << sun_gd_lat
364             << " Geocentric lat = " << l->sun_gc_lat );
365
366     // I think this will work better for generating the sun light vector
367     l->sun_vec[0] = l->fg_sunpos.x();
368     l->sun_vec[1] = l->fg_sunpos.y();
369     l->sun_vec[2] = l->fg_sunpos.z();
370     MAT3_NORMALIZE_VEC(l->sun_vec, ntmp);
371     MAT3_SCALE_VEC(l->sun_vec_inv, l->sun_vec, -1.0);
372
373     // make sure these are directional light sources only
374     l->sun_vec[3] = 0.0;
375     l->sun_vec_inv[3] = 0.0;
376
377     // printf("  l->sun_vec = %.2f %.2f %.2f\n", l->sun_vec[0], l->sun_vec[1],
378     //        l->sun_vec[2]);
379
380     // calculate the sun's relative angle to local up
381     MAT3_COPY_VEC(nup, v->get_local_up());
382     nsun[0] = l->fg_sunpos.x(); 
383     nsun[1] = l->fg_sunpos.y();
384     nsun[2] = l->fg_sunpos.z();
385     MAT3_NORMALIZE_VEC(nup, ntmp);
386     MAT3_NORMALIZE_VEC(nsun, ntmp);
387
388     l->sun_angle = acos(MAT3_DOT_PRODUCT(nup, nsun));
389     // printf("  SUN ANGLE relative to current location = %.3f rads.\n", 
390     //        l->sun_angle);
391     
392     // calculate vector to sun's position on the earth's surface
393     rel_sunpos = l->fg_sunpos - (v->get_view_pos() + scenery.center);
394     v->set_to_sun( rel_sunpos.x(), rel_sunpos.y(), rel_sunpos.z() );
395     // printf( "Vector to sun = %.2f %.2f %.2f\n",
396     //         v->to_sun[0], v->to_sun[1], v->to_sun[2]);
397
398     // make a vector to the current view position
399     Point3D view_pos = v->get_view_pos();
400     MAT3_SET_VEC(v0, view_pos.x(), view_pos.y(), view_pos.z());
401
402     // Given a vector from the view position to the point on the
403     // earth's surface the sun is directly over, map into onto the
404     // local plane representing "horizontal".
405     map_vec_onto_cur_surface_plane( v->get_local_up(), v0, v->get_to_sun(), 
406                                     surface_to_sun );
407     MAT3_NORMALIZE_VEC(surface_to_sun, ntmp);
408     v->set_surface_to_sun( surface_to_sun[0], surface_to_sun[1], 
409                            surface_to_sun[2] );
410     // printf("Surface direction to sun is %.2f %.2f %.2f\n",
411     //        v->surface_to_sun[0], v->surface_to_sun[1], v->surface_to_sun[2]);
412     // printf("Should be close to zero = %.2f\n", 
413     //        MAT3_DOT_PRODUCT(v->local_up, v->surface_to_sun));
414
415     // calculate the angle between v->surface_to_sun and
416     // v->surface_east.  We do this so we can sort out the acos()
417     // ambiguity.  I wish I could think of a more efficient way ... :-(
418     east_dot = MAT3_DOT_PRODUCT( surface_to_sun, v->get_surface_east() );
419     // printf("  East dot product = %.2f\n", east_dot);
420
421     // calculate the angle between v->surface_to_sun and
422     // v->surface_south.  this is how much we have to rotate the sky
423     // for it to align with the sun
424     dot = MAT3_DOT_PRODUCT( surface_to_sun, v->get_surface_south() );
425     // printf("  Dot product = %.2f\n", dot);
426     if ( east_dot >= 0 ) {
427         l->sun_rotation = acos(dot);
428     } else {
429         l->sun_rotation = -acos(dot);
430     }
431     // printf("  Sky needs to rotate = %.3f rads = %.1f degrees.\n", 
432     //        angle, angle * RAD_TO_DEG); */
433 }
434
435
436 // $Log$
437 // Revision 1.20  1999/02/26 22:10:11  curt
438 // Added initial support for native SGI compilers.
439 //
440 // Revision 1.19  1999/01/07 20:25:37  curt
441 // Portability changes and updates from Bernie Bright.
442 //
443 // Revision 1.18  1998/12/09 18:50:36  curt
444 // Converted "class fgVIEW" to "class FGView" and updated to make data
445 // members private and make required accessor functions.
446 //
447 // Revision 1.17  1998/11/09 23:41:53  curt
448 // Log message clean ups.
449 //
450 // Revision 1.16  1998/11/07 19:07:14  curt
451 // Enable release builds using the --without-logging option to the configure
452 // script.  Also a couple log message cleanups, plus some C to C++ comment
453 // conversion.
454 //
455 // Revision 1.15  1998/10/18 01:17:24  curt
456 // Point3D tweaks.
457 //
458 // Revision 1.14  1998/10/17 01:34:32  curt
459 // C++ ifying ...
460 //
461 // Revision 1.13  1998/10/16 00:56:12  curt
462 // Converted to Point3D class.
463 //
464 // Revision 1.12  1998/09/15 04:27:50  curt
465 // Changes for new astro code.
466 //
467 // Revision 1.11  1998/08/12 21:13:22  curt
468 // Optimizations by Norman Vine.
469 //
470 // Revision 1.10  1998/07/22 21:45:39  curt
471 // fg_time.cxx: Removed call to ctime() in a printf() which should be harmless
472 //   but seems to be triggering a bug.
473 // light.cxx: Added code to adjust fog color based on sunrise/sunset effects
474 //   and view orientation.  This is an attempt to match the fog color to the
475 //   sky color in the center of the screen.  You see discrepancies at the
476 //   edges, but what else can be done?
477 // sunpos.cxx: Caculate local direction to sun here.  (what compass direction
478 //   do we need to face to point directly at sun)
479 //
480 // Revision 1.9  1998/07/08 14:48:39  curt
481 // polar3d.h renamed to polar3d.hxx
482 //
483 // Revision 1.8  1998/05/02 01:53:18  curt
484 // Fine tuning mktime() support because of varying behavior on different
485 // platforms.
486 //
487 // Revision 1.7  1998/04/30 12:36:05  curt
488 // C++-ifying a couple source files.
489 //
490 // Revision 1.6  1998/04/28 01:22:18  curt
491 // Type-ified fgTIME and fgVIEW.
492 //
493 // Revision 1.5  1998/04/26 05:10:05  curt
494 // "struct fgLIGHT" -> "fgLIGHT" because fgLIGHT is typedef'd.
495 //
496 // Revision 1.4  1998/04/25 22:06:34  curt
497 // Edited cvs log messages in source files ... bad bad bad!
498 //
499 // Revision 1.3  1998/04/25 20:24:03  curt
500 // Cleaned up initialization sequence to eliminate interdependencies
501 // between sun position, lighting, and view position.  This creates a
502 // valid single pass initialization path.
503 //
504 // Revision 1.2  1998/04/24 00:52:31  curt
505 // Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
506 // Fog color fixes.
507 // Separated out lighting calcs into their own file.
508 //
509 // Revision 1.1  1998/04/22 13:24:07  curt
510 // C++ - ifiing the code a bit.
511 // Starting to reorginize some of the lighting calcs to use a table lookup.
512 //
513 // Revision 1.27  1998/04/03 22:12:57  curt
514 // Converting to Gnu autoconf system.
515 // Centralized time handling differences.
516 //
517 // Revision 1.26  1998/02/23 19:08:00  curt
518 // Incorporated Durk's Astro/ tweaks.  Includes unifying the sun position
519 // calculation code between sun display, and other FG sections that use this
520 // for things like lighting.
521 //
522 // Revision 1.25  1998/02/09 15:07:53  curt
523 // Minor tweaks.
524 //
525 // Revision 1.24  1998/01/27 00:48:07  curt
526 // Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
527 // system and commandline/config file processing code.
528 //
529 // Revision 1.23  1998/01/19 19:27:21  curt
530 // Merged in make system changes from Bob Kuehne <rpk@sgi.com>
531 // This should simplify things tremendously.
532 //
533 // Revision 1.22  1998/01/19 18:40:40  curt
534 // Tons of little changes to clean up the code and to remove fatal errors
535 // when building with the c++ compiler.
536 //
537 // Revision 1.21  1997/12/30 23:10:19  curt
538 // Calculate lighting parameters here.
539 //
540 // Revision 1.20  1997/12/30 22:22:43  curt
541 // Further integration of event manager.
542 //
543 // Revision 1.19  1997/12/30 20:47:59  curt
544 // Integrated new event manager with subsystem initializations.
545 //
546 // Revision 1.18  1997/12/23 04:58:40  curt
547 // Tweaked the sky coloring a bit to build in structures to allow finer rgb
548 // control.
549 //
550 // Revision 1.17  1997/12/15 23:55:08  curt
551 // Add xgl wrappers for debugging.
552 // Generate terrain normals on the fly.
553 //
554 // Revision 1.16  1997/12/11 04:43:57  curt
555 // Fixed sun vector and lighting problems.  I thing the moon is now lit
556 // correctly.
557 //
558 // Revision 1.15  1997/12/10 22:37:55  curt
559 // Prepended "fg" on the name of all global structures that didn't have it yet.
560 // i.e. "struct WEATHER {}" became "struct fgWEATHER {}"
561 //
562 // Revision 1.14  1997/12/09 04:25:39  curt
563 // Working on adding a global lighting params structure.
564 //
565 // Revision 1.13  1997/11/25 19:25:42  curt
566 // Changes to integrate Durk's moon/sun code updates + clean up.
567 //
568 // Revision 1.12  1997/11/15 18:15:39  curt
569 // Reverse direction of sun vector, so object normals can be more normal.
570 //
571 // Revision 1.11  1997/10/28 21:07:21  curt
572 // Changed GLUT/ -> Main/
573 //
574 // Revision 1.10  1997/09/13 02:00:09  curt
575 // Mostly working on stars and generating sidereal time for accurate star
576 // placement.
577 //
578 // Revision 1.9  1997/09/05 14:17:31  curt
579 // More tweaking with stars.
580 //
581 // Revision 1.8  1997/09/05 01:36:04  curt
582 // Working on getting stars right.
583 //
584 // Revision 1.7  1997/09/04 02:17:40  curt
585 // Shufflin' stuff.
586 //
587 // Revision 1.6  1997/08/27 03:30:37  curt
588 // Changed naming scheme of basic shared structures.
589 //
590 // Revision 1.5  1997/08/22 21:34:41  curt
591 // Doing a bit of reorganizing and house cleaning.
592 //
593 // Revision 1.4  1997/08/19 23:55:09  curt
594 // Worked on better simulating real lighting.
595 //
596 // Revision 1.3  1997/08/13 20:23:49  curt
597 // The interface to sunpos now updates a global structure rather than returning
598 // current sun position.
599 //
600 // Revision 1.2  1997/08/06 00:24:32  curt
601 // Working on correct real time sun lighting.
602 //
603 // Revision 1.1  1997/08/01 15:27:56  curt
604 // Initial revision.
605 //