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/region.c

    r41341 r41515  
    165165got_ctype:
    166166 
    167   graphmode.coords.crval1 = Ra;
    168   graphmode.coords.crval2 = Dec;
    169 
    170   float pc1_1 = (graphmode.flipeast)  ? -1 : 1;
    171   float pc2_2 = (graphmode.flipnorth) ? -1 : 1;
    172 
    173   graphmode.coords.pc1_1 =  cos(Angle*RAD_DEG)*pc1_1;
    174   graphmode.coords.pc1_2 =  sin(Angle*RAD_DEG)*pc2_2;
    175   graphmode.coords.pc2_1 = -sin(Angle*RAD_DEG)*pc1_1;
    176   graphmode.coords.pc2_2 =  cos(Angle*RAD_DEG)*pc2_2;
     167  // set the rotation
     168  {
     169    float pc1_1 = (graphmode.flipeast)  ? -1 : 1;
     170    float pc2_2 = (graphmode.flipnorth) ? -1 : 1;
     171
     172    graphmode.coords.pc1_1 =  cos(Angle*RAD_DEG)*pc1_1;
     173    graphmode.coords.pc1_2 =  sin(Angle*RAD_DEG)*pc2_2;
     174    graphmode.coords.pc2_1 = -sin(Angle*RAD_DEG)*pc1_1;
     175    graphmode.coords.pc2_2 =  cos(Angle*RAD_DEG)*pc2_2;
     176  }
     177
     178  // determine central pixel for projection:
     179  {
     180    // PSEUDOCYL modes need center R,D to be 0,0 and center pixel to be adjusted
     181    OhanaProjection proj = GetProjection (graphmode.coords.ctype);
     182    OhanaProjectionMode mode = GetProjectionMode (proj);
     183
     184    graphmode.coords.crpix1 = 0.0;
     185    graphmode.coords.crpix2 = 0.0;
     186
     187    if (mode == PROJ_MODE_PSEUDOCYL) {
     188      graphmode.coords.crval1 = Ra;
     189      graphmode.coords.crval2 = 0.0;
     190    } else {
     191      graphmode.coords.crval1 = Ra;
     192      graphmode.coords.crval2 = Dec;
     193    }
     194
     195    if (mode == PROJ_MODE_PSEUDOCYL) {
     196      double Xc, Yc;
     197      RD_to_XY (&Xc, &Yc, Ra, Dec, &graphmode.coords);
     198      graphmode.coords.crpix2 = -Yc;
     199      fprintf (stderr, "center pixel is %f, %f\n", Xc, Yc);
     200    }
     201  }
    177202
    178203  // ask kapa for coordinate limits, to get the right aspect ratio
Note: See TracChangeset for help on using the changeset viewer.