IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 2, 2021, 1:48:56 PM (5 years ago)
Author:
eugene
Message:

minor line-break cleanups; fix cgrid spacing for pseudocylindrical projections; some in-line initializations; allow projection center for pseudocylindrical projections to be non-zero for dec (changes projection center pixel)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.astro/cgrid.c

    r41341 r41515  
    4040  OnPic = FALSE;                                                        \
    4141  First = TRUE;                                                         \
    42   for (d = firstDEC; (d < 90 + dD) && (LOnPic || NorthPole || SouthPole); d += dD) { \
     42  for (d = firstDEC; (d < 90 + dD) && (LOnPic || NorthPole || SouthPole || InvalidCorner); d += dD) { \
    4343    D = MAX (-90, MIN(90, d));                                          \
    4444    ADD_COORDINATE((RA), D);                                            \
     
    4747  First = TRUE;                                                         \
    4848  LOnPic = TRUE;                                                        \
    49   for (d = firstDEC; (d > -90 - dD) && (LOnPic || NorthPole || SouthPole); d -= dD) { \
     49  for (d = firstDEC; (d > -90 - dD) && (LOnPic || NorthPole || SouthPole || InvalidCorner); d -= dD) { \
    5050    D = MAX (-90, MIN(90, d));                                          \
    5151    ADD_COORDINATE((RA), D);                                            \
     
    5959  First = TRUE;                                                         \
    6060  lastRA = graphmode.coords.crval1 + 180.0;                             \
    61   for (r = firstRA; (r < lastRA + dR) && (LOnPic || NorthPole || SouthPole); r += dR) { \
     61  for (r = firstRA; (r < lastRA + dR) && (LOnPic || NorthPole || SouthPole || InvalidCorner); r += dR) { \
    6262    R = MIN (r, lastRA);                                        \
    6363    ADD_COORDINATE(R, D);                                               \
     
    6767  LOnPic = TRUE;                                                        \
    6868  lastRA = graphmode.coords.crval1 - 180.0;                             \
    69   for (r = firstRA; (r > lastRA - dR) && (LOnPic || NorthPole || SouthPole); r -= dR) { \
     69  for (r = firstRA; (r > lastRA - dR) && (LOnPic || NorthPole || SouthPole || InvalidCorner); r -= dR) { \
    7070    R = MAX (r, lastRA);                                        \
    7171    ADD_COORDINATE(R, D);                                               \
     
    167167    SouthPole = TRUE;
    168168
     169  // PSEUDOCYL modes need center R,D to be 0,0 and center pixel to be adjusted
     170  OhanaProjection proj = GetProjection (graphmode.coords.ctype);
     171  OhanaProjectionMode mode = GetProjectionMode (proj);
     172  int InvalidCorner = FALSE;
     173  if (mode == PROJ_MODE_PSEUDOCYL) {
     174    // for PSEUDOCYL, the ra range is 360 if the corners are invalid
     175    InvalidCorner |= XY_to_RD (&r, &d, graphmode.xmin, graphmode.ymin, &graphmode.coords);
     176    InvalidCorner |= XY_to_RD (&r, &d, graphmode.xmax, graphmode.ymin, &graphmode.coords);
     177    InvalidCorner |= XY_to_RD (&r, &d, graphmode.xmax, graphmode.ymax, &graphmode.coords);
     178    InvalidCorner |= XY_to_RD (&r, &d, graphmode.xmin, graphmode.ymax, &graphmode.coords);
     179  }   
     180
    169181  range = MIN (fabs(graphmode.coords.cdelt1*(graphmode.xmax-graphmode.xmin)), fabs(graphmode.coords.cdelt2*(graphmode.ymax-graphmode.ymin)));
    170   if (NorthPole || SouthPole) range = 360;
     182  if (NorthPole || SouthPole || InvalidCorner) range = 360;
    171183  dR = range * GRID_SPACING;
    172184  dD = range * GRID_SPACING;
Note: See TracChangeset for help on using the changeset viewer.