IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 27, 2005, 7:10:17 PM (21 years ago)
Author:
eugene
Message:

working on SkyRegion conversion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/skycat.c

    r5442 r5451  
    11# include "dvo1.h"
     2
     3int RD_to_XYpic (double *x, double *y, double r, double d, Coords *coords, double Rmin, double Rmax, double Rmid, int *leftside);
    24
    35int skycat (int argc, char **argv) {
     
    57  double Radius;
    68  int i, j, N, Nregions, ShowAll, NPTS, Npts, leftside, Depth, TableDepth;
    7   char filename[128];
    89  struct stat filestat;
    910  Vector Xvec, Yvec;
    1011  Graphdata graphmode;
    1112  double X[4], Y[4], Rmin, Rmax, Rmid;
    12   char catdir[256], gscfile[256];
    1313  int Ngraph, VERBOSE;
    1414  SkyTable *sky;
    1515  SkyList *skylist;
    1616  SkyRegion **regions;
    17 
    18   VarConfig ("CATDIR", "%s", catdir);
    19   VarConfig ("GSCFILE", "%s", gscfile);
    2017
    2118  VERBOSE = FALSE;
     
    4542
    4643  Radius = MAX (fabs(graphmode.xmax), fabs(graphmode.ymax));
    47   sky = SkyTableFromGSC (gscfile, TableDepth, VERBOSE);
    48   if (sky == NULL) return (FALSE);
     44
     45  sky = GetSkyTable ();
    4946  skylist = SkyListByRadius (sky, Depth, graphmode.coords.crval1, graphmode.coords.crval2, Radius);
    5047 
     
    6663
    6764  for (i = 0; i < Nregions; i++) {
    68     sprintf (filename, "%s/%s", catdir, regions[i][0].name);
    69     if (ShowAll || (stat (filename, &filestat) != -1)) {
     65    if (ShowAll || (stat ((char *) regions[i][0].filename, &filestat) != -1)) {
    7066      if (VERBOSE) fprintf (stderr, "%3d %s %6.2f - %6.2f, %6.2f - %6.2f\n", i, regions[i][0].name,
    7167                            regions[i][0].Rmin, regions[i][0].Rmax, regions[i][0].Dmin, regions[i][0].Dmax);
     
    114110
    115111}
     112
     113
     114int RD_to_XYpic (double *x, double *y, double r, double d, Coords *coords, double Rmin, double Rmax, double Rmid, int *leftside) {
     115
     116  while (r < Rmin) { r += 360.0; }
     117  while (r > Rmax) { r -= 360.0; }
     118
     119  if (*leftside == -1) {
     120    *leftside = (r < Rmid);
     121  } else {
     122    if (  *leftside && (r > Rmid + 90)) { r -= 360.0; }
     123    if (! *leftside && (r < Rmid - 90)) { r += 360.0; }
     124  }
     125
     126  RD_to_XY (x, y, r, d, coords);
     127
     128  return (TRUE);
     129}
Note: See TracChangeset for help on using the changeset viewer.