plate.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * This file is part of the UCB release of Plan 9. It is subject to the license
  3. * terms in the LICENSE file found in the top-level directory of this
  4. * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
  5. * part of the UCB release of Plan 9, including this file, may be copied,
  6. * modified, propagated, or distributed except according to the terms contained
  7. * in the LICENSE file.
  8. */
  9. #define RAD(x) ((x)*PI_180)
  10. #define DEG(x) ((x)/PI_180)
  11. #define ARCSECONDS_PER_RADIAN (DEG(1)*3600)
  12. #define input_nybble(infile) input_nbits(infile,4)
  13. typedef float Angle; /* in radians */
  14. enum
  15. {
  16. /*
  17. * parameters for plate
  18. */
  19. Pppo1 = 0,
  20. Pppo2,
  21. Pppo3,
  22. Pppo4,
  23. Pppo5,
  24. Pppo6,
  25. Pamdx1,
  26. Pamdx2,
  27. Pamdx3,
  28. Pamdx4,
  29. Pamdx5,
  30. Pamdx6,
  31. Pamdx7,
  32. Pamdx8,
  33. Pamdx9,
  34. Pamdx10,
  35. Pamdx11,
  36. Pamdx12,
  37. Pamdx13,
  38. Pamdx14,
  39. Pamdx15,
  40. Pamdx16,
  41. Pamdx17,
  42. Pamdx18,
  43. Pamdx19,
  44. Pamdx20,
  45. Pamdy1,
  46. Pamdy2,
  47. Pamdy3,
  48. Pamdy4,
  49. Pamdy5,
  50. Pamdy6,
  51. Pamdy7,
  52. Pamdy8,
  53. Pamdy9,
  54. Pamdy10,
  55. Pamdy11,
  56. Pamdy12,
  57. Pamdy13,
  58. Pamdy14,
  59. Pamdy15,
  60. Pamdy16,
  61. Pamdy17,
  62. Pamdy18,
  63. Pamdy19,
  64. Pamdy20,
  65. Ppltscale,
  66. Pxpixelsz,
  67. Pypixelsz,
  68. Ppltra,
  69. Ppltrah,
  70. Ppltram,
  71. Ppltras,
  72. Ppltdec,
  73. Ppltdecd,
  74. Ppltdecm,
  75. Ppltdecs,
  76. Pnparam,
  77. };
  78. typedef struct Plate Plate;
  79. struct Plate
  80. {
  81. char rgn[7];
  82. char disk;
  83. Angle ra;
  84. Angle dec;
  85. };
  86. typedef struct Header Header;
  87. struct Header
  88. {
  89. float param[Pnparam];
  90. int amdflag;
  91. float x;
  92. float y;
  93. float xi;
  94. float eta;
  95. };
  96. typedef long Type;
  97. typedef struct Image Image;
  98. struct Image
  99. {
  100. int nx;
  101. int ny; /* ny is the fast-varying dimension */
  102. Type a[1];
  103. };
  104. int nplate;
  105. Plate plate[2000]; /* needs to go to 2000 when the north comes */
  106. double PI_180;
  107. double TWOPI;
  108. int debug;
  109. struct
  110. {
  111. float min;
  112. float max;
  113. float del;
  114. double gamma;
  115. int neg;
  116. } gam;
  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. Image* dssread(char*);
  131. void hinv(Type*, int, int);
  132. int input_bit(Biobuf*);
  133. int input_nbits(Biobuf*, int);
  134. void qtree_decode(Biobuf*, Type*, int, int, int, int);
  135. void start_inputing_bits(void);
  136. Bitmap* image(Angle, Angle, Angle, Angle);
  137. int dogamma(int);