forked from brandon-rhodes/pyephem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstel.c
1803 lines (1726 loc) · 50.4 KB
/
constel.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* code to handle constellation boundaries and figures */
/*
Constellation boundaries:
Primary reference:
METHOD TO DETERMINE THE CONSTELLATION IN WHICH A POSITION IS LOCATED
Recently, Mr. Barry N. Rappaport of New Mexico State University
transcribed the constellation boundaries as fixed by the IAU into
machine-readable form. These have been transcribed by Dr. Nancy G.
Roman to make it possible to determine by computer the constellation
in which a position is located.
NSSDC catalog description:
6042 AN Catalog of Constellation Boundary Data (Delporte, E. 1930,
Cambridge Univ. Press)
Comment(s): includes constellation identification software
(ADC 1987; see Roman, N.G. 1987, Publ. Astron. Soc. Pacific
99, 695); 23 description, 118 software, 358 data records.
3 files: 23x80, 118x80, 358x29
Further adapted for xephem by:
Craig Counterman: conversion from original F77 to C
Elwood Downey: incorporation into xephem
Ernie Wright: additional speed and time improvments
Constellation figures:
Chris Marriott: original figures
Elwood Downey: incorporated into xephem
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include "astro.h"
/*
======================================================================
Ernie Wright 2 Mar 94
Find the constellation for a given position.
First C version by Craig Counterman and Elwood Downey. Based on a
FORTRAN program by Nancy G. Roman (Roman, N.G. 1987, Publ. Astron.
Soc. Pacific 99, 695). IAU constellation boundaries transcribed into
machine-readable form by Barry N. Rappaport, New Mexico State Univ.
======================================================================
*/
#define NBOUNDS 357
/* constellation ids */
#define And 0
#define Ant 1
#define Aps 2
#define Aql 3
#define Aqr 4
#define Ara 5
#define Ari 6
#define Aur 7
#define Boo 8
#define CMa 9
#define CMi 10
#define CVn 11
#define Cae 12
#define Cam 13
#define Cap 14
#define Car 15
#define Cas 16
#define Cen 17
#define Cep 18
#define Cet 19
#define Cha 20
#define Cir 21
#define Cnc 22
#define Col 23
#define Com 24
#define CrA 25
#define CrB 26
#define Crt 27
#define Cru 28
#define Crv 29
#define Cyg 30
#define Del 31
#define Dor 32
#define Dra 33
#define Equ 34
#define Eri 35
#define For 36
#define Gem 37
#define Gru 38
#define Her 39
#define Hor 40
#define Hya 41
#define Hyi 42
#define Ind 43
#define LMi 44
#define Lac 45
#define Leo 46
#define Lep 47
#define Lib 48
#define Lup 49
#define Lyn 50
#define Lyr 51
#define Men 52
#define Mic 53
#define Mon 54
#define Mus 55
#define Nor 56
#define Oct 57
#define Oph 58
#define Ori 59
#define Pav 60
#define Peg 61
#define Per 62
#define Phe 63
#define Pic 64
#define PsA 65
#define Psc 66
#define Pup 67
#define Pyx 68
#define Ret 69
#define Scl 70
#define Sco 71
#define Sct 72
#define Se1 73
#define Sex 74
#define Sge 75
#define Sgr 76
#define Tau 77
#define Tel 78
#define TrA 79
#define Tri 80
#define Tuc 81
#define UMa 82
#define UMi 83
#define Vel 84
#define Vir 85
#define Vol 86
#define Vul 87
#define Se2 88
static char *cns_namemap[ NCNS ] = {
/* 0 */ "And: Andromeda",
/* 1 */ "Ant: Antlia",
/* 2 */ "Aps: Apus",
/* 3 */ "Aql: Aquila",
/* 4 */ "Aqr: Aquarius",
/* 5 */ "Ara: Ara",
/* 6 */ "Ari: Aries",
/* 7 */ "Aur: Auriga",
/* 8 */ "Boo: Bootes",
/* 9 */ "CMa: Canis Major",
/* 10 */ "CMi: Canis Minor",
/* 11 */ "CVn: Canes Venatici",
/* 12 */ "Cae: Caelum",
/* 13 */ "Cam: Camelopardalis",
/* 14 */ "Cap: Capricornus",
/* 15 */ "Car: Carina",
/* 16 */ "Cas: Cassiopeia",
/* 17 */ "Cen: Centaurus",
/* 18 */ "Cep: Cepheus",
/* 19 */ "Cet: Cetus",
/* 20 */ "Cha: Chamaeleon",
/* 21 */ "Cir: Circinus",
/* 22 */ "Cnc: Cancer",
/* 23 */ "Col: Columba",
/* 24 */ "Com: Coma Berenices",
/* 25 */ "CrA: Corona Australis",
/* 26 */ "CrB: Corona Borealis",
/* 27 */ "Crt: Crater",
/* 28 */ "Cru: Crux",
/* 29 */ "Crv: Corvus",
/* 30 */ "Cyg: Cygnus",
/* 31 */ "Del: Delphinus",
/* 32 */ "Dor: Dorado",
/* 33 */ "Dra: Draco",
/* 34 */ "Equ: Equuleus",
/* 35 */ "Eri: Eridanus",
/* 36 */ "For: Fornax",
/* 37 */ "Gem: Gemini",
/* 38 */ "Gru: Grus",
/* 39 */ "Her: Hercules",
/* 40 */ "Hor: Horologium",
/* 41 */ "Hya: Hydra",
/* 42 */ "Hyi: Hydrus",
/* 43 */ "Ind: Indus",
/* 44 */ "LMi: Leo Minor",
/* 45 */ "Lac: Lacerta",
/* 46 */ "Leo: Leo",
/* 47 */ "Lep: Lepus",
/* 48 */ "Lib: Libra",
/* 49 */ "Lup: Lupus",
/* 50 */ "Lyn: Lynx",
/* 51 */ "Lyr: Lyra",
/* 52 */ "Men: Mensa",
/* 53 */ "Mic: Microscopium",
/* 54 */ "Mon: Monoceros",
/* 55 */ "Mus: Musca",
/* 56 */ "Nor: Norma",
/* 57 */ "Oct: Octans",
/* 58 */ "Oph: Ophiuchus",
/* 59 */ "Ori: Orion",
/* 60 */ "Pav: Pavo",
/* 61 */ "Peg: Pegasus",
/* 62 */ "Per: Perseus",
/* 63 */ "Phe: Phoenix",
/* 64 */ "Pic: Pictor",
/* 65 */ "PsA: Piscis Austrinus",
/* 66 */ "Psc: Pisces",
/* 67 */ "Pup: Puppis",
/* 68 */ "Pyx: Pyxis",
/* 69 */ "Ret: Reticulum",
/* 70 */ "Scl: Sculptor",
/* 71 */ "Sco: Scorpius",
/* 72 */ "Sct: Scutum",
/* 73 */ "Se1: Serpens Caput",
/* 74 */ "Sex: Sextans",
/* 75 */ "Sge: Sagitta",
/* 76 */ "Sgr: Sagittarius",
/* 77 */ "Tau: Taurus",
/* 78 */ "Tel: Telescopium",
/* 79 */ "TrA: Triangulum Australe",
/* 80 */ "Tri: Triangulum",
/* 81 */ "Tuc: Tucana",
/* 82 */ "UMa: Ursa Major",
/* 83 */ "UMi: Ursa Minor",
/* 84 */ "Vel: Vela",
/* 85 */ "Vir: Virgo",
/* 86 */ "Vol: Volans",
/* 87 */ "Vul: Vulpecula",
/* 88 */ "Se2: Serpens Cauda",
};
static struct {
unsigned short lower_ra; /* hours * 1800 */
unsigned short upper_ra; /* hours * 1800 */
short lower_dec; /* degrees * 60 */
short index;
} cbound[ NBOUNDS ] = {
{ 0, 43200, 5280, UMi },
{ 14400, 26100, 5190, UMi },
{ 37800, 41400, 5170, UMi },
{ 32400, 37800, 5160, UMi },
{ 0, 14400, 5100, Cep },
{ 16500, 19200, 4920, Cam },
{ 0, 9000, 4800, Cep },
{ 19200, 26100, 4800, Cam },
{ 31500, 32400, 4800, UMi },
{ 36300, 37800, 4800, Dra },
{ 0, 6315, 4620, Cep },
{ 20700, 24450, 4620, Cam },
{ 29760, 31500, 4500, UMi },
{ 36300, 37200, 4500, Cep },
{ 14340, 16500, 4410, Cam },
{ 16500, 20400, 4410, Dra },
{ 23400, 29760, 4200, UMi },
{ 5580, 6150, 4080, Cas },
{ 36750, 37200, 4020, Dra },
{ 20400, 21600, 3990, Dra },
{ 0, 600, 3960, Cep },
{ 25200, 28200, 3960, UMi },
{ 42450, 43200, 3960, Cep },
{ 21600, 24300, 3840, Dra },
{ 24300, 25950, 3780, Dra },
{ 41700, 42450, 3780, Cep },
{ 10980, 12600, 3720, Cam },
{ 36000, 36750, 3690, Dra },
{ 36966, 37080, 3655, Cep },
{ 12600, 14340, 3600, Cam },
{ 14340, 15150, 3600, UMa },
{ 35580, 36000, 3570, Dra },
{ 36000, 36966, 3570, Cep },
{ 41160, 41700, 3545, Cep },
{ 0, 4380, 3510, Cas },
{ 34950, 35580, 3480, Dra },
{ 3060, 3435, 3450, Cas },
{ 4380, 5580, 3420, Cas },
{ 5580, 5700, 3420, Cam },
{ 40170, 41160, 3375, Cep },
{ 9000, 10980, 3360, Cam },
{ 25260, 25950, 3330, UMa },
{ 25950, 34950, 3330, Dra },
{ 5700, 6000, 3300, Cam },
{ 39840, 40170, 3300, Cep },
{ 37080, 39540, 3290, Cep },
{ 0, 3060, 3240, Cas },
{ 10980, 11700, 3240, Lyn },
{ 21750, 24300, 3180, UMa },
{ 27450, 28350, 3180, Dra },
{ 39540, 39840, 3165, Cep },
{ 6000, 9000, 3150, Cam },
{ 41160, 42000, 3150, Cas },
{ 28350, 30600, 3090, Dra },
{ 3675, 4530, 3030, Per },
{ 30600, 32820, 3030, Dra },
{ 0, 2460, 3000, Cas },
{ 2460, 3000, 3000, Per },
{ 11700, 12240, 3000, Lyn },
{ 42000, 43200, 3000, Cas },
{ 24300, 25260, 2910, UMa },
{ 0, 2010, 2880, Cas },
{ 42450, 43200, 2880, Cas },
{ 32715, 32820, 2850, Her },
{ 32820, 34350, 2850, Dra },
{ 34350, 34500, 2850, Cyg },
{ 3000, 3675, 2820, Per },
{ 15150, 16500, 2820, UMa },
{ 300, 1560, 2760, Cas },
{ 21600, 21750, 2700, UMa },
{ 12240, 13260, 2670, Lyn },
{ 39435, 39540, 2640, Cyg },
{ 39375, 39435, 2625, Cyg },
{ 34500, 34920, 2610, Cyg },
{ 16500, 18300, 2520, UMa },
{ 18300, 19410, 2400, UMa },
{ 27780, 28350, 2400, Boo },
{ 28350, 29400, 2400, Her },
{ 16650, 17250, 2385, Lyn },
{ 0, 4530, 2205, And },
{ 4530, 4620, 2205, Per },
{ 34845, 34920, 2190, Lyr },
{ 8100, 8445, 2160, Per },
{ 39120, 39375, 2160, Cyg },
{ 39375, 39600, 2160, Lac },
{ 11760, 13260, 2130, Aur },
{ 13260, 13950, 2130, Lyn },
{ 0, 3600, 2100, And },
{ 39600, 41070, 2100, Lac },
{ 41070, 41160, 2070, Lac },
{ 41160, 42300, 2070, And },
{ 4620, 4890, 2040, Per },
{ 19410, 19800, 2040, UMa },
{ 21600, 22200, 2040, CVn },
{ 13950, 16650, 2010, Lyn },
{ 16650, 17790, 2010, LMi },
{ 1290, 2535, 1980, And },
{ 27330, 27780, 1980, Boo },
{ 42300, 42750, 1925, And },
{ 22200, 23850, 1920, CVn },
{ 42750, 43200, 1880, And },
{ 25125, 25260, 1845, CVn },
{ 4350, 4890, 1840, Tri },
{ 4890, 8100, 1840, Per },
{ 8100, 8550, 1800, Aur },
{ 32715, 34845, 1800, Lyr },
{ 19800, 21600, 1740, UMa },
{ 35400, 37650, 1740, Cyg },
{ 8550, 10590, 1710, Aur },
{ 17790, 18900, 1710, LMi },
{ 23850, 25125, 1710, CVn },
{ 0, 120, 1680, And },
{ 2535, 3000, 1680, Tri },
{ 10590, 11760, 1680, Aur },
{ 14190, 14400, 1680, Gem },
{ 37650, 39120, 1680, Cyg },
{ 34665, 35400, 1650, Cyg },
{ 3450, 4350, 1635, Tri },
{ 29100, 29400, 1620, CrB },
{ 27150, 27330, 1560, Boo },
{ 27330, 29100, 1560, CrB },
{ 33060, 33960, 1560, Lyr },
{ 19350, 19800, 1530, LMi },
{ 33960, 34665, 1530, Lyr },
{ 3000, 3450, 1500, Tri },
{ 1290, 1530, 1425, Psc },
{ 18900, 19350, 1410, LMi },
{ 38250, 38550, 1410, Vul },
{ 10260, 10590, 1370, Tau },
{ 120, 255, 1320, And },
{ 28650, 28860, 1320, Se1 },
{ 10590, 11190, 1290, Gem },
{ 35700, 36450, 1275, Vul },
{ 33960, 34650, 1265, Vul },
{ 255, 1530, 1260, And },
{ 36450, 37020, 1230, Vul },
{ 14055, 14190, 1200, Gem },
{ 37020, 38250, 1170, Vul },
{ 34650, 35700, 1150, Vul },
{ 5910, 6060, 1140, Ari },
{ 33960, 34200, 1110, Sge },
{ 10260, 10380, 1080, Ori },
{ 11190, 11355, 1050, Gem },
{ 34200, 35700, 970, Sge },
{ 8940, 9600, 960, Tau },
{ 28650, 28950, 960, Her },
{ 35700, 36450, 945, Sge },
{ 8310, 8940, 930, Tau },
{ 9600, 10080, 930, Tau },
{ 23100, 24300, 900, Com },
{ 31050, 32850, 860, Her },
{ 21360, 23100, 840, Com },
{ 13500, 14055, 810, Gem },
{ 30150, 31050, 770, Her },
{ 0, 255, 750, Peg },
{ 10080, 10380, 750, Tau },
{ 12600, 13500, 750, Gem },
{ 38010, 38400, 750, Peg },
{ 11355, 12480, 720, Gem },
{ 32850, 33960, 720, Her },
{ 37575, 37890, 710, Del },
{ 37890, 38010, 710, Peg },
{ 20730, 21360, 660, Leo },
{ 11235, 11355, 600, Ori },
{ 12480, 12600, 600, Gem },
{ 14055, 14265, 600, Cnc },
{ 42900, 43200, 600, Peg },
{ 3000, 5910, 595, Ari },
{ 36255, 36540, 510, Del },
{ 24300, 27150, 480, Boo },
{ 40950, 42900, 450, Peg },
{ 14265, 16650, 420, Cnc },
{ 16650, 19350, 420, Leo },
{ 32850, 33592, 375, Oph },
{ 33592, 33960, 375, Aql },
{ 37500, 37575, 360, Del },
{ 12600, 12630, 330, CMi },
{ 32850, 33165, 270, Se2 },
{ 28950, 30150, 240, Her },
{ 32850, 33165, 180, Oph },
{ 38640, 39000, 165, Peg },
{ 0, 3600, 120, Psc },
{ 33450, 33960, 120, Se2 },
{ 36540, 37500, 120, Del },
{ 37500, 38400, 120, Equ },
{ 38400, 38640, 120, Peg },
{ 39600, 40950, 120, Peg },
{ 39000, 39600, 105, Peg },
{ 12630, 12960, 90, CMi },
{ 6450, 8310, 0, Tau },
{ 8310, 8400, 0, Ori },
{ 12960, 14550, 0, CMi },
{ 26400, 27150, 0, Vir },
{ 32100, 32850, 0, Oph },
{ 4770, 5910, -105, Cet },
{ 5910, 6450, -105, Tau },
{ 27150, 29280, -195, Se1 },
{ 8400, 9150, -240, Ori },
{ 10500, 11235, -240, Ori },
{ 32100, 32340, -240, Se2 },
{ 32850, 33450, -240, Se2 },
{ 33450, 33960, -240, Aql },
{ 40950, 42900, -240, Psc },
{ 19350, 20730, -360, Leo },
{ 20730, 21300, -360, Vir },
{ 0, 600, -420, Psc },
{ 42900, 43200, -420, Psc },
{ 25650, 26400, -480, Vir },
{ 28650, 29280, -480, Oph },
{ 36000, 36960, -540, Aql },
{ 38400, 39360, -540, Aqr },
{ 30900, 32340, -600, Oph },
{ 10500, 14550, -660, Mon },
{ 8850, 9150, -660, Eri },
{ 9150, 10500, -660, Ori },
{ 14550, 15060, -660, Hya },
{ 17250, 19350, -660, Sex },
{ 21300, 23100, -660, Vir },
{ 31650, 31800, -700, Oph },
{ 33960, 36000, -722, Aql },
{ 8700, 8850, -870, Eri },
{ 36960, 38400, -900, Aqr },
{ 30900, 32850, -960, Se2 },
{ 32850, 33960, -960, Sct },
{ 15060, 15450, -1020, Hya },
{ 29280, 29475, -1095, Oph },
{ 15450, 16350, -1140, Hya },
{ 19350, 19500, -1140, Crt },
{ 29280, 29475, -1155, Sco },
{ 28200, 28650, -1200, Lib },
{ 22650, 23100, -1320, Crv },
{ 23100, 25650, -1320, Vir },
{ 16350, 17550, -1440, Hya },
{ 3000, 4770, -1463, Cet },
{ 4770, 6750, -1463, Eri },
{ 19500, 21300, -1470, Crt },
{ 21300, 22650, -1470, Crv },
{ 25650, 26850, -1470, Lib },
{ 29280, 30150, -1475, Oph },
{ 0, 3000, -1530, Cet },
{ 38400, 39360, -1530, Cap },
{ 39360, 42900, -1530, Aqr },
{ 42900, 43200, -1530, Cet },
{ 17550, 18450, -1590, Hya },
{ 8460, 8700, -1635, Eri },
{ 8700, 11010, -1635, Lep },
{ 36000, 38400, -1680, Cap },
{ 18450, 19050, -1750, Hya },
{ 22650, 26850, -1770, Hya },
{ 26850, 28200, -1770, Lib },
{ 28200, 28800, -1770, Sco },
{ 8250, 8460, -1800, Eri },
{ 30150, 31680, -1800, Oph },
{ 31680, 32100, -1800, Sgr },
{ 19050, 19500, -1870, Hya },
{ 11010, 13260, -1980, CMa },
{ 22050, 22650, -1980, Hya },
{ 19500, 22050, -2100, Hya },
{ 6300, 6750, -2160, For },
{ 15060, 16860, -2205, Pyx },
{ 7680, 8250, -2220, Eri },
{ 32100, 34500, -2220, Sgr },
{ 38400, 41400, -2220, PsA },
{ 41400, 42000, -2220, Scl },
{ 5400, 6300, -2375, For },
{ 16860, 19800, -2385, Ant },
{ 0, 3000, -2400, Scl },
{ 3000, 5400, -2400, For },
{ 6960, 7680, -2400, Eri },
{ 42000, 43200, -2400, Scl },
{ 25500, 26850, -2520, Cen },
{ 28200, 28800, -2520, Lup },
{ 28800, 29557, -2520, Sco },
{ 8700, 9000, -2580, Cae },
{ 9000, 11850, -2580, Col },
{ 14400, 15060, -2580, Pup },
{ 6150, 6960, -2640, Eri },
{ 29557, 32100, -2730, Sco },
{ 32100, 34500, -2730, CrA },
{ 34500, 36600, -2730, Sgr },
{ 36600, 38400, -2730, Mic },
{ 5400, 6150, -2760, Eri },
{ 8100, 8700, -2790, Cae },
{ 27600, 28200, -2880, Lup },
{ 0, 4200, -2890, Phe },
{ 4800, 5400, -2940, Eri },
{ 7350, 7680, -2940, Hor },
{ 7680, 8100, -2940, Cae },
{ 38400, 39600, -3000, Gru },
{ 10800, 14400, -3045, Pup },
{ 14400, 14700, -3045, Vel },
{ 4350, 4800, -3060, Eri },
{ 6900, 7350, -3060, Hor },
{ 0, 3300, -3090, Phe },
{ 10800, 11100, -3150, Car },
{ 14700, 15210, -3180, Vel },
{ 6300, 6900, -3190, Hor },
{ 6900, 7200, -3190, Dor },
{ 0, 2850, -3210, Phe },
{ 3900, 4350, -3240, Eri },
{ 8100, 9000, -3240, Pic },
{ 27090, 27600, -3240, Lup },
{ 15210, 15900, -3270, Vel },
{ 11100, 11700, -3300, Car },
{ 21300, 23100, -3300, Cen },
{ 25500, 27090, -3300, Lup },
{ 27090, 27600, -3300, Nor },
{ 7200, 7800, -3390, Dor },
{ 15900, 19800, -3390, Vel },
{ 19800, 20250, -3390, Cen },
{ 31500, 32400, -3420, Ara },
{ 32400, 36600, -3420, Tel },
{ 39600, 42000, -3420, Gru },
{ 5760, 6300, -3450, Hor },
{ 9000, 9900, -3450, Pic },
{ 11700, 12300, -3480, Car },
{ 0, 2400, -3510, Phe },
{ 2400, 3900, -3510, Eri },
{ 42000, 43200, -3510, Phe },
{ 7800, 8250, -3540, Dor },
{ 27600, 29557, -3600, Nor },
{ 36600, 38400, -3600, Ind },
{ 9900, 10800, -3660, Pic },
{ 27300, 27600, -3660, Cir },
{ 29557, 29850, -3660, Ara },
{ 26850, 27300, -3815, Cir },
{ 29850, 30150, -3815, Ara },
{ 10800, 12300, -3840, Pic },
{ 12300, 16260, -3840, Car },
{ 20250, 21300, -3840, Cen },
{ 21300, 23100, -3840, Cru },
{ 23100, 26160, -3840, Cen },
{ 24300, 24600, -3900, Cir },
{ 30150, 30300, -3900, Ara },
{ 3900, 5760, -4050, Hor },
{ 5760, 8250, -4050, Ret },
{ 26550, 26850, -4050, Cir },
{ 30300, 31500, -4050, Ara },
{ 31500, 32400, -4050, Pav },
{ 39600, 42000, -4050, Tuc },
{ 8250, 11850, -4200, Dor },
{ 24600, 26550, -4200, Cir },
{ 26550, 30600, -4200, TrA },
{ 0, 2400, -4500, Tuc },
{ 6300, 8250, -4500, Hyi },
{ 11850, 16260, -4500, Vol },
{ 16260, 20250, -4500, Car },
{ 20250, 24600, -4500, Mus },
{ 32400, 38400, -4500, Pav },
{ 38400, 42000, -4500, Ind },
{ 42000, 43200, -4500, Tuc },
{ 1350, 2400, -4560, Tuc },
{ 0, 6300, -4950, Hyi },
{ 13800, 24600, -4950, Cha },
{ 24600, 32400, -4950, Aps },
{ 6300, 13800, -5100, Men },
{ 0, 43200, -5400, Oct }
};
static short start[] = {
355, 352, 343, 340, 332, 320,
303, 288, 277, 266, 257, 251,
239, 229, 221, 211, 203, 189,
177, 163, 149, 136, 124, 104,
87, 75, 69, 54, 43, 29,
23, 16, 12, 6, 4, 0, 0
};
/*
======================================================================
constellation_pick()
Do a constellation pick from RA and Dec.
INPUTS
r right ascension, radians
d declination, radians
e epoch to which r and d precessed, as an mjd
RESULTS
Returns an index for the constellation region that the coordinates
belong to, or -1 if no constellation pick can be found.
The constellation is identified by linear search. We look for a
member of cbound[] whose lower_dec is less than the declination of the
pick point and whose lower_ra and upper_ra bracket the pick point's
right ascension. The data for that cbound[] member describes a sub-
region belonging to the picked constellation.
In geometric terms, the search amounts to starting at the north pole
and traveling south on a line of constant right ascension through the
pick point. At every declination where a cbound[] member lives, we
wake up, and if (1) the pick point is now behind us, and (2) the
cbound[] segment is crossing our path, we know we've hit the edge of
a constellation subregion that the pick point belongs to.
The cbound[] right ascension and declination values are scaled into
integers; this conserves storage and makes comparisons faster. The
start[] array, which gives starting points in cbound[] for different
declinations in 5-degree increments, further speeds the search by
skipping early parts of the list for which we know the search can't
succeed--geometrically, we start no more than 5 degrees north of the
pick point, rather than at the north pole.
The data in cbound[] are for epoch 1875.
======================================================================
*/
int
cns_pick(double r, double d, double e)
{
double Mjd;
unsigned short ra;
short de, i;
cal_mjd( 1, 1.0, 1875, &Mjd );
precess( e, Mjd, &r, &d );
ra = ( unsigned short )( radhr( r ) * 1800 );
de = ( short )( raddeg( d ) * 60 );
if (d < 0.0) --de;
i = ( de + 5400 ) / 300;
if ( i < 0 || i > 36 ) return -1;
i = start[ i ];
for ( ; i < NBOUNDS; i++ )
if ( cbound[ i ].lower_dec <= de &&
cbound[ i ].upper_ra > ra &&
cbound[ i ].lower_ra <= ra ) break;
return ( i == NBOUNDS ) ? -1 : ( int ) cbound[ i ].index;
}
/* given a constellation id (as from cns_pick()), return pointer to static
* storage containg its name in the form "AAA: Name".
* return "???: ???" if id is invalid.
*/
char *
cns_name (int id)
{
if (id < 0 || id >= NCNS)
return ("???: ???");
return (cns_namemap[id]);
}
/* return cns_namemap index matching first three chars in abbrev[], else -1.
*/
int
cns_id (char *abbrev)
{
int i;
for (i = 0; i < NCNS; i++)
if (strncmp (abbrev, cns_namemap[i], 3) == 0)
return (i);
return (-1);
}
/* edges of constant ra */
static struct {
unsigned short ra; /* hours * 1800 */
short dec0, dec1; /* degrees * 60 */
} ra_edges[] = {
{ 0, -4950, -4500 },
{ 0, 600, 750 },
{ 0, 1680, 1879 },
{ 120, 1320, 1680 },
{ 255, 750, 1260 },
{ 255, 1260, 1320 },
{ 300, 2760, 2880 },
{ 599, -420, 0 },
{ 599, 0, 120 },
{ 599, 3960, 4620 },
{ 1290, 1425, 1980 },
{ 1350, -4500, -4560 },
{ 1530, 1260, 1425 },
{ 1560, 2760, 2880 },
{ 2010, 2880, 3000 },
{ 2399, -4560, -3510 },
{ 2399, -3510, -3210 },
{ 2460, 3000, 3240 },
{ 2534, 1680, 1980 },
{ 2534, 1980, 2100 },
{ 2849, -3210, -3090 },
{ 3000, -2400, -1530 },
{ 3000, -1530, -1462 },
{ 3000, 595, 1500 },
{ 3000, 1500, 1680 },
{ 3000, 2820, 3000 },
{ 3060, 3240, 3450 },
{ 3299, -3090, -2890 },
{ 3434, 3450, 3510 },
{ 3450, 1500, 1635 },
{ 3600, 120, 595 },
{ 3600, 2100, 2205 },
{ 3675, 2820, 3030 },
{ 3900, -4050, -3510 },
{ 3900, -3510, -3240 },
{ 4199, -2890, -2400 },
{ 4350, -3240, -3060 },
{ 4350, 1635, 1840 },
{ 4379, 3420, 3510 },
{ 4530, 2205, 3030 },
{ 4620, 2040, 2205 },
{ 4770, -1462, -105 },
{ 4800, -3060, -2940 },
{ 4890, 1840, 2040 },
{ 5400, -2940, -2760 },
{ 5400, -2400, -2374 },
{ 5580, 3420, 4080 },
{ 5700, 3300, 3420 },
{ 5760, -3450, -4050 },
{ 5909, -105, 0 },
{ 5909, 0, 595 },
{ 5909, 595, 1140 },
{ 5999, 3150, 3300 },
{ 6060, 1140, 1840 },
{ 6150, -2760, -2640 },
{ 6150, 4080, 4620 },
{ 6300, -5100, -4950 },
{ 6300, -4950, -4500 },
{ 6300, -3190, -3450 },
{ 6300, -2374, -2160 },
{ 6314, 4620, 4800 },
{ 6449, -105, 0 },
{ 6750, -2160, -1462 },
{ 6899, -3060, -3190 },
{ 6960, -2640, -2400 },
{ 7200, -3390, -3190 },
{ 7349, -2940, -3060 },
{ 7680, -2400, -2940 },
{ 7680, -2220, -2400 },
{ 7799, -3540, -3390 },
{ 8100, -3240, -2940 },
{ 8100, -2940, -2790 },
{ 8100, 1800, 1840 },
{ 8100, 1840, 2160 },
{ 8249, -4500, -4200 },
{ 8249, -4050, -4200 },
{ 8249, -4050, -3540 },
{ 8249, -1800, -2220 },
{ 8310, 0, 930 },
{ 8400, -240, 0 },
{ 8445, 2160, 3150 },
{ 8460, -1635, -1800 },
{ 8550, 1710, 1800 },
{ 8699, -2790, -2580 },
{ 8699, -870, -1635 },
{ 8850, -660, -870 },
{ 8940, 930, 960 },
{ 9000, -3450, -3240 },
{ 9000, -2580, -1635 },
{ 9000, 3150, 3360 },
{ 9000, 4800, 5100 },
{ 9149, -660, -240 },
{ 9599, 930, 960 },
{ 9900, -3660, -3450 },
{ 10080, 750, 930 },
{ 10260, 1080, 1369 },
{ 10380, 750, 1080 },
{ 10499, -660, -240 },
{ 10589, 1290, 1369 },
{ 10589, 1369, 1680 },
{ 10589, 1680, 1710 },
{ 10800, -3840, -3660 },
{ 10800, -3150, -3045 },
{ 10800, -3045, -2580 },
{ 10980, 3240, 3360 },
{ 10980, 3360, 3720 },
{ 11010, -1980, -1635 },
{ 11010, -1635, -660 },
{ 11100, -3300, -3150 },
{ 11190, 1050, 1290 },
{ 11235, -240, 0 },
{ 11235, 0, 600 },
{ 11354, 600, 720 },
{ 11354, 720, 1050 },
{ 11700, -3480, -3300 },
{ 11700, 3000, 3240 },
{ 11759, 1680, 2130 },
{ 11849, -4200, -4500 },
{ 11849, -4200, -3840 },
{ 11849, -1980, -2580 },
{ 12240, 2670, 3000 },
{ 12299, -3840, -3480 },
{ 12479, 600, 720 },
{ 12600, 330, 600 },
{ 12600, 600, 750 },
{ 12600, 3600, 3720 },
{ 12630, 90, 330 },
{ 12960, 0, 90 },
{ 13260, -660, -1980 },
{ 13260, 2130, 2670 },
{ 13500, 750, 810 },
{ 13800, -5100, -4950 },
{ 13800, -4500, -4950 },
{ 13950, 2010, 2130 },
{ 14054, 600, 810 },
{ 14054, 810, 1200 },
{ 14189, 1200, 1680 },
{ 14265, 420, 600 },
{ 14340, 3600, 4410 },
{ 14400, -3045, -2580 },
{ 14400, 1680, 2010 },
{ 14400, 5100, 5190 },
{ 14400, 5280, 5190 },
{ 14549, -660, 0 },
{ 14549, 0, 420 },
{ 14700, -3180, -3045 },
{ 15060, -2580, -2205 },
{ 15060, -2205, -1020 },
{ 15060, -1020, -660 },
{ 15150, 2820, 3600 },
{ 15209, -3270, -3180 },
{ 15449, -1140, -1020 },
{ 15899, -3390, -3270 },
{ 16259, -4500, -3840 },
{ 16349, -1440, -1140 },
{ 16500, 2520, 2820 },
{ 16500, 4410, 4920 },
{ 16650, 420, 2010 },
{ 16650, 2010, 2385 },
{ 16860, -2385, -2205 },
{ 16860, -1440, -2205 },
{ 17249, -660, 0 },
{ 17249, 0, 420 },
{ 17249, 2385, 2520 },
{ 17550, -1590, -1440 },
{ 17789, 1710, 2010 },
{ 18300, 2400, 2520 },
{ 18450, -1750, -1590 },
{ 18900, 1410, 1710 },
{ 19049, -1870, -1750 },
{ 19200, 4800, 4920 },
{ 19350, -660, -1140 },
{ 19350, -360, -660 },
{ 19350, -360, 0 },
{ 19350, 0, 420 },
{ 19350, 1410, 1530 },
{ 19409, 2040, 2400 },
{ 19499, -2100, -1870 },
{ 19499, -1140, -1470 },
{ 19800, -3390, -2385 },
{ 19800, -2385, -2100 },
{ 19800, 1530, 1740 },
{ 19800, 1740, 2040 },
{ 20250, -4500, -3840 },
{ 20250, -3840, -3390 },
{ 20399, 3990, 4410 },
{ 20700, 4620, 4800 },
{ 20730, -360, 0 },
{ 20730, 0, 660 },
{ 21299, -3840, -3300 },
{ 21299, -1470, -660 },
{ 21299, -660, -360 },
{ 21360, 660, 840 },
{ 21360, 840, 1740 },
{ 21600, 1740, 2040 },
{ 21600, 2040, 2700 },
{ 21600, 3840, 3990 },
{ 21749, 2700, 3180 },
{ 22050, -1980, -2100 },
{ 22199, 1920, 2040 },
{ 22649, -1770, -1980 },
{ 22649, -1470, -1320 },
{ 23099, -3840, -3300 },
{ 23099, -1320, -660 },
{ 23099, 840, 900 },
{ 23400, 4620, 4200 },
{ 23850, 1710, 1920 },
{ 24300, -3900, -3840 },
{ 24300, 480, 900 },
{ 24300, 900, 1710 },
{ 24300, 2910, 3180 },
{ 24300, 3780, 3840 },
{ 24449, 4800, 4620 },
{ 24600, -4950, -4500 },
{ 24600, -4500, -4200 },
{ 24600, -4200, -3900 },
{ 25124, 1710, 1845 },
{ 25200, 4200, 3960 },
{ 25259, 1845, 2910 },
{ 25259, 2910, 3330 },
{ 25500, -3300, -2520 },
{ 25650, -1320, -1470 },
{ 25650, -480, -1320 },
{ 25950, 3330, 3780 },
{ 26100, 5190, 4800 },
{ 26159, -3840, -3300 },
{ 26400, 0, -480 },
{ 26550, -4200, -4050 },
{ 26850, -4050, -3814 },
{ 26850, -2520, -1770 },
{ 26850, -1470, -1770 },
{ 27090, -3300, -3240 },
{ 27149, -195, 0 },
{ 27149, 0, 480 },
{ 27149, 480, 1560 },
{ 27300, -3814, -3660 },
{ 27329, 1560, 1980 },
{ 27450, 3180, 3330 },
{ 27599, -3660, -3600 },
{ 27599, -3600, -3300 },
{ 27599, -3240, -2880 },
{ 27779, 1980, 2400 },
{ 28200, -2880, -2520 },
{ 28200, -1770, -1200 },
{ 28200, 3960, 4200 },
{ 28350, 2400, 3090 },
{ 28350, 3090, 3180 },
{ 28650, -1200, -480 },
{ 28650, -480, -195 },
{ 28650, 960, 1320 },
{ 28800, -2520, -1770 },
{ 28859, 1320, 1560 },
{ 28949, 240, 960 },
{ 29100, 1560, 1620 },
{ 29280, -1474, -1155 },
{ 29280, -1095, -480 },
{ 29280, -195, 0 },
{ 29280, 0, 240 },
{ 29399, 1620, 2400 },
{ 29475, -1155, -1095 },
{ 29557, -3660, -3600 },
{ 29557, -3600, -2730 },
{ 29557, -2730, -2520 },
{ 29759, 4200, 4500 },
{ 29849, -3814, -3660 },
{ 30150, -3900, -3814 },
{ 30150, -1800, -1474 },
{ 30150, 240, 769 },
{ 30299, -4050, -3900 },
{ 30600, -4050, -4200 },
{ 30600, 3030, 3090 },
{ 30900, -960, -600 },
{ 31050, 769, 859 },
{ 31500, -3420, -4050 },
{ 31500, 4500, 4800 },
{ 31649, -700, -600 },
{ 31680, -960, -1800 },
{ 31800, -700, -600 },
{ 32099, -2730, -2220 },
{ 32099, -1800, -2220 },
{ 32099, -240, 0 },
{ 32340, -600, -240 },
{ 32400, -4950, -4500 },
{ 32400, -4500, -4050 },
{ 32400, -2730, -3420 },
{ 32400, 4800, 5160 },
{ 32715, 1800, 2850 },
{ 32819, 2850, 3030 },
{ 32850, -240, -960 },