IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34826


Ignore:
Timestamp:
Dec 15, 2012, 7:16:10 AM (14 years ago)
Author:
eugene
Message:

add projection ops for boundary tree cells

Location:
branches/eam_branches/ipp-20121130/Ohana/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20121130/Ohana/src/addstar/src/findskycell.c

    r34825 r34826  
    202202    tree.ra[zone][band] = ra;
    203203    tree.dec[zone][band] = dec;
     204    tree.Xo[zone][band] = x;
     205    tree.Yo[zone][band] = y;
    204206    tree.cell[zone][band] = i;
    205207
     
    342344    // the proj cell is divided into Nx, Ny bits.
    343345    // (ra,dec) for (Ro,Do) -> (x,y).  given (Xo,Yo),(dX,dY) I can find ix,iy
    344     // I currently track Ro,Do (tree->RA_origin[zone], tree->...)
    345 
     346    // I currently track Ro,Do (tree->ra[zone][band], tree->dec[zone][band])
     347    // I need to have the skycell center in pixels (Xo,Yo) and the scale dX,dY
     348   
     349    // convert R,D to X,Y with hard-wired projection and scale, orientation?
     350   
     351    TreeCellProjection (&x, &y, ra, dec, tree, zone, band);
     352
     353    xi = x / tree->NX_SUB;
     354    yi = y / tree->NY_SUB;
     355
     356   
    346357
    347358  }
     
    349360  exit (0);
    350361}
     362
  • branches/eam_branches/ipp-20121130/Ohana/src/libdvo/include/dvo.h

    r34749 r34826  
    322322  int *NBAND;
    323323
    324   double   **ra;
    325   double  **dec;
    326   int    **cell;
    327   char  ***name;
     324  double   **ra; // RA of projection cell center
     325  double  **dec; // DEC of projection cell center
     326  int    **cell; // zone,band -> proj cell sequence
     327  char  ***name; // projection cell name
     328 
     329  int NX_SUB, NY_SUB;
     330
     331  int **Xo;
     332  int **Yo;
    328333} BoundaryTree;
    329334
  • branches/eam_branches/ipp-20121130/Ohana/src/libdvo/src/BoundaryTree.c

    r34291 r34826  
    318318}
    319319
     320
     321// projection = TAN
     322// need Ro, Do, Xo, Yo, dPix
     323
     324int TreeCellProjection (double *x, double *y, double r, double d, BoundaryTree *tree, int zone, int band) {
     325
     326    double Xo = tree->Yo[zone][band];
     327    double Yo = tree->Xo[zone][band];
     328    double Ro = tree->ra[zone][band];
     329    double Do = tree->dec[zone][band];
     330    double dPix = tree->dPix;
     331
     332    // this block only depends on Ro, Do
     333
     334    sdp  = sin(RAD_DEG*Do);
     335    cdp  = cos(RAD_DEG*Do);
     336    salp = sin(RAD_DEG*(ra - Ro));
     337    calp = cos(RAD_DEG*(ra - Ro));
     338    sdel = sin(RAD_DEG*dec);
     339    cdel = cos(RAD_DEG*dec);
     340   
     341    stht = sdel*sdp + cdel*cdp*calp;    /* sin(theta) */
     342    sphi = cdel*salp;                   /* = cos(theta)*sin(phi) */
     343    cphi = cdel*sdp*calp - sdel*cdp;    /* = cos(theta)*cos(phi) */
     344
     345    // defines the TAN projection (one of zenithal projections available, libdvo/src/coordops.c
     346    // R = cot (theta) = cos(theta) / sin(theta)
     347    if (stht == 0) {
     348        Rc = hypot(sphi, cphi);
     349        L = 180.0 * sphi / Rc;
     350        M = 180.0 * cphi / Rc;
     351    } else {
     352        L = +DEG_RAD * sphi / stht;
     353        M = -DEG_RAD * cphi / stht;
     354    }
     355
     356    // scale, rotation, parity:
     357    // rotation == 0.0 (pc1_1 == pc2_2 == 1.0, pc1_2 = pc2_1 = 0.0)
     358
     359    // if there were rotation or parity:
     360    // Ro = (coords[0].pc1_1*coords[0].pc2_2 - coords[0].pc1_2*coords[0].pc2_1);
     361    // Xo = (coords[0].pc2_2*L - coords[0].pc1_2*M) / Ro;
     362    // Yo = (coords[0].pc1_1*M - coords[0].pc2_1*L) / Ro;
     363
     364    Xo = L;
     365    Yo = M;
     366
     367    // scale is dPix
     368
     369    *x = Xo / dPix + Xo;
     370    *y = Yo / dPix + Yo;
     371   
     372    return TRUE;
     373}
     374
Note: See TracChangeset for help on using the changeset viewer.