xref: /plan9/sys/src/cmd/scat/plate.h (revision 59cc4ca53493a3c6d2349fe2b7f7c40f7dce7294)
1 #define	RAD(x)	((x)*PI_180)
2 #define	DEG(x)	((x)/PI_180)
3 #define ARCSECONDS_PER_RADIAN	(DEG(1)*3600)
4 #define input_nybble(infile)    input_nbits(infile,4)
5 
6 typedef float	Angle;	/* in radians */
7 
8 enum
9 {
10 	/*
11 	 * parameters for plate
12 	 */
13 	Pppo1	= 0,
14 	Pppo2,
15 	Pppo3,
16 	Pppo4,
17 	Pppo5,
18 	Pppo6,
19 	Pamdx1,
20 	Pamdx2,
21 	Pamdx3,
22 	Pamdx4,
23 	Pamdx5,
24 	Pamdx6,
25 	Pamdx7,
26 	Pamdx8,
27 	Pamdx9,
28 	Pamdx10,
29 	Pamdx11,
30 	Pamdx12,
31 	Pamdx13,
32 	Pamdx14,
33 	Pamdx15,
34 	Pamdx16,
35 	Pamdx17,
36 	Pamdx18,
37 	Pamdx19,
38 	Pamdx20,
39 	Pamdy1,
40 	Pamdy2,
41 	Pamdy3,
42 	Pamdy4,
43 	Pamdy5,
44 	Pamdy6,
45 	Pamdy7,
46 	Pamdy8,
47 	Pamdy9,
48 	Pamdy10,
49 	Pamdy11,
50 	Pamdy12,
51 	Pamdy13,
52 	Pamdy14,
53 	Pamdy15,
54 	Pamdy16,
55 	Pamdy17,
56 	Pamdy18,
57 	Pamdy19,
58 	Pamdy20,
59 	Ppltscale,
60 	Pxpixelsz,
61 	Pypixelsz,
62 	Ppltra,
63 	Ppltrah,
64 	Ppltram,
65 	Ppltras,
66 	Ppltdec,
67 	Ppltdecd,
68 	Ppltdecm,
69 	Ppltdecs,
70 	Pnparam,
71 };
72 
73 typedef	struct	Plate	Plate;
74 struct	Plate
75 {
76 	char	rgn[7];
77 	char	disk;
78 	Angle	ra;
79 	Angle	dec;
80 };
81 
82 typedef	struct	Header	Header;
83 struct	Header
84 {
85 	float	param[Pnparam];
86 	int	amdflag;
87 
88 	float	x;
89 	float	y;
90 	float	xi;
91 	float	eta;
92 };
93 typedef	long	Type;
94 
95 typedef struct	Image	Image;
96 struct	Image
97 {
98 	int	nx;
99 	int	ny;	/* ny is the fast-varying dimension */
100 	Type	a[1];
101 };
102 
103 int	nplate;
104 Plate	plate[2000];		/* needs to go to 2000 when the north comes */
105 double	PI_180;
106 double	TWOPI;
107 int	debug;
108 struct
109 {
110 	float	min;
111 	float	max;
112 	float	del;
113 	double	gamma;
114 	int	neg;
115 } gam;
116 
117 char*	hms(Angle);
118 char*	dms(Angle);
119 double	xsqrt(double);
120 Angle	dist(Angle, Angle, Angle, Angle);
121 Header*	getheader(char*);
122 char*	getword(char*, char*);
123 void	amdinv(Header*, Angle, Angle, float, float);
124 void	ppoinv(Header*, Angle, Angle);
125 void	xypos(Header*, Angle, Angle, float, float);
126 void	traneqstd(Header*, Angle, Angle);
127 Angle	getra(char*);
128 Angle	getdec(char*);
129 void	getplates(void);
130 
131 Image*	dssread(char*);
132 void	hinv(Type*, int, int);
133 int	input_bit(Biobuf*);
134 int	input_nbits(Biobuf*, int);
135 void	qtree_decode(Biobuf*, Type*, int, int, int, int);
136 void	start_inputing_bits(void);
137 Bitmap*	image(Angle, Angle, Angle, Angle);
138 int	dogamma(int);
139