Files
astronomy/generate/constellation/constel.c
Don Cross 4f8977067b Snapped constellation border to nearest quarter arcminute.
Instead of using decimal hours/degrees rounded to 4 decimal places,
I went back to the original constel.c and modified it to represent
both RA and DEC in degrees, and to round all values to the nearest
quarter arcminute. This seems closer to the original intent of the
constellation boundaries.
2020-05-02 21:21:32 -04:00

423 lines
15 KiB
C

/*++++++++++++++
.IDENTIFICATION constel.c
.LANGUAGE C
.AUTHOR Francois Ochsenbein [CDS] francois@astro.u-strasbg.fr
.ENVIRONMENT Astronomical Catalogues (#6042), see
http://vizier.u-strasbg.fr/viz-bin/VizieR?-source=6042
.KEYWORDS Constellations
.VERSION 1.0 17-Jul-2001
.COMMENTS Find out all boundaries of a Constellation.
Argument to main may be a position (dec.deg. Eq=1875), or
a constellation name.
With argument as a constellation name, the 'graph' GNU plotting program
can be used to generate the area covered by the constellation, e.g.
constel -p Cyg | graph -T ps -q 1.0 -L Cyg -x 360 0 -y -90 90
---------------*/
// [Don Cross / 2020-05-02]: downloaded from http://cdsarc.u-strasbg.fr/viz-bin/ftp-index?VI/42
// I modified to generate constellation.borders file for Astronomy Engine.
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#define ITEMS(a) (sizeof(a)/sizeof(a[0]))
typedef struct row { double ral, rau, del; char cst[4]; } ROW ;
/* The Constellation Boundaries as extracted from Cat.#6042,
paper by N.G. Roman, 1987PASP...99..695R
*/
static ROW data[] = {
{ 0.0000,360.0000, 88.0000,"UMi"},
{120.0000,217.5000, 86.5000,"UMi"},
{315.0000,345.0000, 86.1667,"UMi"},
{270.0000,315.0000, 86.0000,"UMi"},
{ 0.0000,120.0000, 85.0000,"Cep"},
{137.5000,160.0000, 82.0000,"Cam"},
{ 0.0000, 75.0000, 80.0000,"Cep"},
{160.0000,217.5000, 80.0000,"Cam"},
{262.5000,270.0000, 80.0000,"UMi"},
{302.5000,315.0000, 80.0000,"Dra"},
{ 0.0000, 52.6250, 77.0000,"Cep"},
{172.5000,203.7500, 77.0000,"Cam"},
{248.0000,262.5000, 75.0000,"UMi"},
{302.5000,310.0000, 75.0000,"Cep"},
{119.5000,137.5000, 73.5000,"Cam"},
{137.5000,170.0000, 73.5000,"Dra"},
{195.0000,248.0000, 70.0000,"UMi"},
{ 46.5000, 51.2500, 68.0000,"Cas"},
{306.2500,310.0000, 67.0000,"Dra"},
{170.0000,180.0000, 66.5000,"Dra"},
{ 0.0000, 5.0000, 66.0000,"Cep"},
{210.0000,235.0000, 66.0000,"UMi"},
{353.7500,360.0000, 66.0000,"Cep"},
{180.0000,202.5000, 64.0000,"Dra"},
{202.5000,216.2500, 63.0000,"Dra"},
{347.5000,353.7500, 63.0000,"Cep"},
{ 91.5000,105.0000, 62.0000,"Cam"},
{300.0000,306.2500, 61.5000,"Dra"},
{308.0500,309.0000, 60.9167,"Cep"},
{105.0000,119.5000, 60.0000,"Cam"},
{119.5000,126.2500, 60.0000,"UMa"},
{296.5000,300.0000, 59.5000,"Dra"},
{300.0000,308.0500, 59.5000,"Cep"},
{343.0000,347.5000, 59.0833,"Cep"},
{ 0.0000, 36.5000, 58.5000,"Cas"},
{291.2500,296.5000, 58.0000,"Dra"},
{ 25.5000, 28.6250, 57.5000,"Cas"},
{ 36.5000, 46.5000, 57.0000,"Cas"},
{ 46.5000, 47.5000, 57.0000,"Cam"},
{334.7500,343.0000, 56.2500,"Cep"},
{ 75.0000, 91.5000, 56.0000,"Cam"},
{210.5000,216.2500, 55.5000,"UMa"},
{216.2500,291.2500, 55.5000,"Dra"},
{ 47.5000, 50.0000, 55.0000,"Cam"},
{332.0000,334.7500, 55.0000,"Cep"},
{309.0000,329.5000, 54.8333,"Cep"},
{ 0.0000, 25.5000, 54.0000,"Cas"},
{ 91.5000, 97.5000, 54.0000,"Lyn"},
{181.2500,202.5000, 53.0000,"UMa"},
{228.7500,236.2500, 53.0000,"Dra"},
{329.5000,332.0000, 52.7500,"Cep"},
{ 50.0000, 75.0000, 52.5000,"Cam"},
{343.0000,350.0000, 52.5000,"Cas"},
{236.2500,255.0000, 51.5000,"Dra"},
{ 30.6250, 37.7500, 50.5000,"Per"},
{255.0000,273.5000, 50.5000,"Dra"},
{ 0.0000, 20.5000, 50.0000,"Cas"},
{ 20.5000, 25.0000, 50.0000,"Per"},
{ 97.5000,102.0000, 50.0000,"Lyn"},
{350.0000,360.0000, 50.0000,"Cas"},
{202.5000,210.5000, 48.5000,"UMa"},
{ 0.0000, 16.7500, 48.0000,"Cas"},
{353.7500,360.0000, 48.0000,"Cas"},
{272.6250,273.5000, 47.5000,"Her"},
{273.5000,286.2500, 47.5000,"Dra"},
{286.2500,287.5000, 47.5000,"Cyg"},
{ 25.0000, 30.6250, 47.0000,"Per"},
{126.2500,137.5000, 47.0000,"UMa"},
{ 2.5000, 13.0000, 46.0000,"Cas"},
{180.0000,181.2500, 45.0000,"UMa"},
{102.0000,110.5000, 44.5000,"Lyn"},
{328.6250,329.5000, 44.0000,"Cyg"},
{328.1250,328.6250, 43.7500,"Cyg"},
{287.5000,291.0000, 43.5000,"Cyg"},
{137.5000,152.5000, 42.0000,"UMa"},
{152.5000,161.7500, 40.0000,"UMa"},
{231.5000,236.2500, 40.0000,"Boo"},
{236.2500,245.0000, 40.0000,"Her"},
{138.7500,143.7500, 39.7500,"Lyn"},
{ 0.0000, 37.7500, 36.7500,"And"},
{ 37.7500, 38.5000, 36.7500,"Per"},
{290.3750,291.0000, 36.5000,"Lyr"},
{ 67.5000, 70.3750, 36.0000,"Per"},
{326.0000,328.1250, 36.0000,"Cyg"},
{328.1250,330.0000, 36.0000,"Lac"},
{ 98.0000,110.5000, 35.5000,"Aur"},
{110.5000,116.2500, 35.5000,"Lyn"},
{ 0.0000, 30.0000, 35.0000,"And"},
{330.0000,342.2500, 35.0000,"Lac"},
{342.2500,343.0000, 34.5000,"Lac"},
{343.0000,352.5000, 34.5000,"And"},
{ 38.5000, 40.7500, 34.0000,"Per"},
{161.7500,165.0000, 34.0000,"UMa"},
{180.0000,185.0000, 34.0000,"CVn"},
{116.2500,138.7500, 33.5000,"Lyn"},
{138.7500,148.2500, 33.5000,"LMi"},
{ 10.7500, 21.1250, 33.0000,"And"},
{227.7500,231.5000, 33.0000,"Boo"},
{352.5000,356.2500, 32.0833,"And"},
{185.0000,198.7500, 32.0000,"CVn"},
{356.2500,360.0000, 31.3333,"And"},
{209.3750,210.5000, 30.7500,"CVn"},
{ 36.2500, 40.7500, 30.6667,"Tri"},
{ 40.7500, 67.5000, 30.6667,"Per"},
{ 67.5000, 71.2500, 30.0000,"Aur"},
{272.6250,290.3750, 30.0000,"Lyr"},
{165.0000,180.0000, 29.0000,"UMa"},
{295.0000,313.7500, 29.0000,"Cyg"},
{ 71.2500, 88.2500, 28.5000,"Aur"},
{148.2500,157.5000, 28.5000,"LMi"},
{198.7500,209.3750, 28.5000,"CVn"},
{ 0.0000, 1.0000, 28.0000,"And"},
{ 21.1250, 25.0000, 28.0000,"Tri"},
{ 88.2500, 98.0000, 28.0000,"Aur"},
{118.2500,120.0000, 28.0000,"Gem"},
{313.7500,326.0000, 28.0000,"Cyg"},
{288.8750,295.0000, 27.5000,"Cyg"},
{ 28.7500, 36.2500, 27.2500,"Tri"},
{242.5000,245.0000, 27.0000,"CrB"},
{226.2500,227.7500, 26.0000,"Boo"},
{227.7500,242.5000, 26.0000,"CrB"},
{275.5000,283.0000, 26.0000,"Lyr"},
{161.2500,165.0000, 25.5000,"LMi"},
{283.0000,288.8750, 25.5000,"Lyr"},
{ 25.0000, 28.7500, 25.0000,"Tri"},
{ 10.7500, 12.7500, 23.7500,"Psc"},
{157.5000,161.2500, 23.5000,"LMi"},
{318.7500,321.2500, 23.5000,"Vul"},
{ 85.5000, 88.2500, 22.8333,"Tau"},
{ 1.0000, 2.1250, 22.0000,"And"},
{238.7500,240.5000, 22.0000,"Ser"},
{ 88.2500, 93.2500, 21.5000,"Gem"},
{297.5000,303.7500, 21.2500,"Vul"},
{283.0000,288.7500, 21.0833,"Vul"},
{ 2.1250, 12.7500, 21.0000,"And"},
{303.7500,308.5000, 20.5000,"Vul"},
{117.1250,118.2500, 20.0000,"Gem"},
{308.5000,318.7500, 19.5000,"Vul"},
{288.7500,297.5000, 19.1667,"Vul"},
{ 49.2500, 50.5000, 19.0000,"Ari"},
{283.0000,285.0000, 18.5000,"Sge"},
{ 85.5000, 86.5000, 18.0000,"Ori"},
{ 93.2500, 94.6250, 17.5000,"Gem"},
{285.0000,297.5000, 16.1667,"Sge"},
{ 74.5000, 80.0000, 16.0000,"Tau"},
{238.7500,241.2500, 16.0000,"Her"},
{297.5000,303.7500, 15.7500,"Sge"},
{ 69.2500, 74.5000, 15.5000,"Tau"},
{ 80.0000, 84.0000, 15.5000,"Tau"},
{192.5000,202.5000, 15.0000,"Com"},
{258.7500,273.7500, 14.3333,"Her"},
{178.0000,192.5000, 14.0000,"Com"},
{112.5000,117.1250, 13.5000,"Gem"},
{251.2500,258.7500, 12.8333,"Her"},
{ 0.0000, 2.1250, 12.5000,"Peg"},
{ 84.0000, 86.5000, 12.5000,"Tau"},
{105.0000,112.5000, 12.5000,"Gem"},
{316.7500,320.0000, 12.5000,"Peg"},
{ 94.6250,104.0000, 12.0000,"Gem"},
{273.7500,283.0000, 12.0000,"Her"},
{313.1250,315.7500, 11.8333,"Del"},
{315.7500,316.7500, 11.8333,"Peg"},
{172.7500,178.0000, 11.0000,"Leo"},
{ 93.6250, 94.6250, 10.0000,"Ori"},
{104.0000,105.0000, 10.0000,"Gem"},
{117.1250,118.8750, 10.0000,"Cnc"},
{357.5000,360.0000, 10.0000,"Peg"},
{ 25.0000, 49.2500, 9.9167,"Ari"},
{302.1250,304.5000, 8.5000,"Del"},
{202.5000,226.2500, 8.0000,"Boo"},
{341.2500,357.5000, 7.5000,"Peg"},
{118.8750,138.7500, 7.0000,"Cnc"},
{138.7500,161.2500, 7.0000,"Leo"},
{273.7500,279.9333, 6.2500,"Oph"},
{279.9333,283.0000, 6.2500,"Aql"},
{312.5000,313.1250, 6.0000,"Del"},
{105.0000,105.2500, 5.5000,"CMi"},
{273.7500,276.3750, 4.5000,"Ser"},
{241.2500,251.2500, 4.0000,"Her"},
{273.7500,276.3750, 3.0000,"Oph"},
{322.0000,325.0000, 2.7500,"Peg"},
{ 0.0000, 30.0000, 2.0000,"Psc"},
{278.7500,283.0000, 2.0000,"Ser"},
{304.5000,312.5000, 2.0000,"Del"},
{312.5000,320.0000, 2.0000,"Equ"},
{320.0000,322.0000, 2.0000,"Peg"},
{330.0000,341.2500, 2.0000,"Peg"},
{325.0000,330.0000, 1.7500,"Peg"},
{105.2500,108.0000, 1.5000,"CMi"},
{ 53.7500, 69.2500, 0.0000,"Tau"},
{ 69.2500, 70.0000, 0.0000,"Ori"},
{108.0000,121.2500, 0.0000,"CMi"},
{220.0000,226.2500, 0.0000,"Vir"},
{267.5000,273.7500, 0.0000,"Oph"},
{ 39.7500, 49.2500, -1.7500,"Cet"},
{ 49.2500, 53.7500, -1.7500,"Tau"},
{226.2500,244.0000, -3.2500,"Ser"},
{ 70.0000, 76.2500, -4.0000,"Ori"},
{ 87.5000, 93.6250, -4.0000,"Ori"},
{267.5000,269.5000, -4.0000,"Ser"},
{273.7500,278.7500, -4.0000,"Ser"},
{278.7500,283.0000, -4.0000,"Aql"},
{341.2500,357.5000, -4.0000,"Psc"},
{161.2500,172.7500, -6.0000,"Leo"},
{172.7500,177.5000, -6.0000,"Vir"},
{ 0.0000, 5.0000, -7.0000,"Psc"},
{357.5000,360.0000, -7.0000,"Psc"},
{213.7500,220.0000, -8.0000,"Vir"},
{238.7500,244.0000, -8.0000,"Oph"},
{300.0000,308.0000, -9.0000,"Aql"},
{320.0000,328.0000, -9.0000,"Aqr"},
{257.5000,269.5000,-10.0000,"Oph"},
{ 87.5000,121.2500,-11.0000,"Mon"},
{ 73.7500, 76.2500,-11.0000,"Eri"},
{ 76.2500, 87.5000,-11.0000,"Ori"},
{121.2500,125.5000,-11.0000,"Hya"},
{143.7500,161.2500,-11.0000,"Sex"},
{177.5000,192.5000,-11.0000,"Vir"},
{263.7500,265.0000,-11.6667,"Oph"},
{283.0000,300.0000,-12.0333,"Aql"},
{ 72.5000, 73.7500,-14.5000,"Eri"},
{308.0000,320.0000,-15.0000,"Aqr"},
{257.5000,273.7500,-16.0000,"Ser"},
{273.7500,283.0000,-16.0000,"Sct"},
{125.5000,128.7500,-17.0000,"Hya"},
{244.0000,245.6250,-18.2500,"Oph"},
{128.7500,136.2500,-19.0000,"Hya"},
{161.2500,162.5000,-19.0000,"Crt"},
{244.0000,245.6250,-19.2500,"Sco"},
{235.0000,238.7500,-20.0000,"Lib"},
{188.7500,192.5000,-22.0000,"Crv"},
{192.5000,213.7500,-22.0000,"Vir"},
{136.2500,146.2500,-24.0000,"Hya"},
{ 25.0000, 39.7500,-24.3833,"Cet"},
{ 39.7500, 56.2500,-24.3833,"Eri"},
{162.5000,177.5000,-24.5000,"Crt"},
{177.5000,188.7500,-24.5000,"Crv"},
{213.7500,223.7500,-24.5000,"Lib"},
{244.0000,251.2500,-24.5833,"Oph"},
{ 0.0000, 25.0000,-25.5000,"Cet"},
{320.0000,328.0000,-25.5000,"Cap"},
{328.0000,357.5000,-25.5000,"Aqr"},
{357.5000,360.0000,-25.5000,"Cet"},
{146.2500,153.7500,-26.5000,"Hya"},
{ 70.5000, 72.5000,-27.2500,"Eri"},
{ 72.5000, 91.7500,-27.2500,"Lep"},
{300.0000,320.0000,-28.0000,"Cap"},
{153.7500,158.7500,-29.1667,"Hya"},
{188.7500,223.7500,-29.5000,"Hya"},
{223.7500,235.0000,-29.5000,"Lib"},
{235.0000,240.0000,-29.5000,"Sco"},
{ 68.7500, 70.5000,-30.0000,"Eri"},
{251.2500,264.0000,-30.0000,"Oph"},
{264.0000,267.5000,-30.0000,"Sgr"},
{158.7500,162.5000,-31.1667,"Hya"},
{ 91.7500,110.5000,-33.0000,"CMa"},
{183.7500,188.7500,-33.0000,"Hya"},
{162.5000,183.7500,-35.0000,"Hya"},
{ 52.5000, 56.2500,-36.0000,"For"},
{125.5000,140.5000,-36.7500,"Pyx"},
{ 64.0000, 68.7500,-37.0000,"Eri"},
{267.5000,287.5000,-37.0000,"Sgr"},
{320.0000,345.0000,-37.0000,"PsA"},
{345.0000,350.0000,-37.0000,"Scl"},
{ 45.0000, 52.5000,-39.5833,"For"},
{140.5000,165.0000,-39.7500,"Ant"},
{ 0.0000, 25.0000,-40.0000,"Scl"},
{ 25.0000, 45.0000,-40.0000,"For"},
{ 58.0000, 64.0000,-40.0000,"Eri"},
{350.0000,360.0000,-40.0000,"Scl"},
{212.5000,223.7500,-42.0000,"Cen"},
{235.0000,240.0000,-42.0000,"Lup"},
{240.0000,246.3125,-42.0000,"Sco"},
{ 72.5000, 75.0000,-43.0000,"Cae"},
{ 75.0000, 98.7500,-43.0000,"Col"},
{120.0000,125.5000,-43.0000,"Pup"},
{ 51.2500, 58.0000,-44.0000,"Eri"},
{246.3125,267.5000,-45.5000,"Sco"},
{267.5000,287.5000,-45.5000,"CrA"},
{287.5000,305.0000,-45.5000,"Sgr"},
{305.0000,320.0000,-45.5000,"Mic"},
{ 45.0000, 51.2500,-46.0000,"Eri"},
{ 67.5000, 72.5000,-46.5000,"Cae"},
{230.0000,235.0000,-48.0000,"Lup"},
{ 0.0000, 35.0000,-48.1667,"Phe"},
{ 40.0000, 45.0000,-49.0000,"Eri"},
{ 61.2500, 64.0000,-49.0000,"Hor"},
{ 64.0000, 67.5000,-49.0000,"Cae"},
{320.0000,330.0000,-50.0000,"Gru"},
{ 90.0000,120.0000,-50.7500,"Pup"},
{120.0000,122.5000,-50.7500,"Vel"},
{ 36.2500, 40.0000,-51.0000,"Eri"},
{ 57.5000, 61.2500,-51.0000,"Hor"},
{ 0.0000, 27.5000,-51.5000,"Phe"},
{ 90.0000, 92.5000,-52.5000,"Car"},
{122.5000,126.7500,-53.0000,"Vel"},
{ 52.5000, 57.5000,-53.1667,"Hor"},
{ 57.5000, 60.0000,-53.1667,"Dor"},
{ 0.0000, 23.7500,-53.5000,"Phe"},
{ 32.5000, 36.2500,-54.0000,"Eri"},
{ 67.5000, 75.0000,-54.0000,"Pic"},
{225.7500,230.0000,-54.0000,"Lup"},
{126.7500,132.5000,-54.5000,"Vel"},
{ 92.5000, 97.5000,-55.0000,"Car"},
{177.5000,192.5000,-55.0000,"Cen"},
{212.5000,225.7500,-55.0000,"Lup"},
{225.7500,230.0000,-55.0000,"Nor"},
{ 60.0000, 65.0000,-56.5000,"Dor"},
{132.5000,165.0000,-56.5000,"Vel"},
{165.0000,168.7500,-56.5000,"Cen"},
{262.5000,270.0000,-57.0000,"Ara"},
{270.0000,305.0000,-57.0000,"Tel"},
{330.0000,350.0000,-57.0000,"Gru"},
{ 48.0000, 52.5000,-57.5000,"Hor"},
{ 75.0000, 82.5000,-57.5000,"Pic"},
{ 97.5000,102.5000,-58.0000,"Car"},
{ 0.0000, 20.0000,-58.5000,"Phe"},
{ 20.0000, 32.5000,-58.5000,"Eri"},
{350.0000,360.0000,-58.5000,"Phe"},
{ 65.0000, 68.7500,-59.0000,"Dor"},
{230.0000,246.3125,-60.0000,"Nor"},
{305.0000,320.0000,-60.0000,"Ind"},
{ 82.5000, 90.0000,-61.0000,"Pic"},
{227.5000,230.0000,-61.0000,"Cir"},
{246.3125,248.7500,-61.0000,"Ara"},
{223.7500,227.5000,-63.5833,"Cir"},
{248.7500,251.2500,-63.5833,"Ara"},
{ 90.0000,102.5000,-64.0000,"Pic"},
{102.5000,135.5000,-64.0000,"Car"},
{168.7500,177.5000,-64.0000,"Cen"},
{177.5000,192.5000,-64.0000,"Cru"},
{192.5000,218.0000,-64.0000,"Cen"},
{202.5000,205.0000,-65.0000,"Cir"},
{251.2500,252.5000,-65.0000,"Ara"},
{ 32.5000, 48.0000,-67.5000,"Hor"},
{ 48.0000, 68.7500,-67.5000,"Ret"},
{221.2500,223.7500,-67.5000,"Cir"},
{252.5000,262.5000,-67.5000,"Ara"},
{262.5000,270.0000,-67.5000,"Pav"},
{330.0000,350.0000,-67.5000,"Tuc"},
{ 68.7500, 98.7500,-70.0000,"Dor"},
{205.0000,221.2500,-70.0000,"Cir"},
{221.2500,255.0000,-70.0000,"TrA"},
{ 0.0000, 20.0000,-75.0000,"Tuc"},
{ 52.5000, 68.7500,-75.0000,"Hyi"},
{ 98.7500,135.5000,-75.0000,"Vol"},
{135.5000,168.7500,-75.0000,"Car"},
{168.7500,205.0000,-75.0000,"Mus"},
{270.0000,320.0000,-75.0000,"Pav"},
{320.0000,350.0000,-75.0000,"Ind"},
{350.0000,360.0000,-75.0000,"Tuc"},
{ 11.2500, 20.0000,-76.0000,"Tuc"},
{ 0.0000, 52.5000,-82.5000,"Hyi"},
{115.0000,205.0000,-82.5000,"Cha"},
{205.0000,270.0000,-82.5000,"Aps"},
{ 52.5000,115.0000,-85.0000,"Men"},
{ 0.0000,360.0000,-90.0000,"Oct"}
} ;
static double SnapQuarterArcmin(double deg)
{
const double SNAP = 4.0 * 60.0;
double x = round(SNAP * deg) / SNAP;
int before, after;
/* Make sure the snapped value still rounds to the same 4 decimal digits. */
before = (int) round(deg * 10000.0);
after = (int) round(x * 10000.0);
if (before != after)
{
fprintf(stderr, "FATAL(SnapQuarterArcmin): deg=%0.16lf, x=%0.16lf, before=%d, after=%d\n", deg, x, before, after);
exit(1);
}
return x;
}
int main()
{
int n = ITEMS(data);
int i;
for (i=0; i<n; ++i)
{
double ralo = SnapQuarterArcmin(data[i].ral);
double rahi = SnapQuarterArcmin(data[i].rau);
double dec = SnapQuarterArcmin(data[i].del);
printf("%18.14lf %18.14lf %18.14lf %s\n", ralo, rahi, dec, data[i].cst);
}
return 0;
}