IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1530


Ignore:
Timestamp:
Aug 13, 2004, 12:41:24 PM (22 years ago)
Author:
gusciora
Message:

Latest changes from the SDRS.

Location:
trunk/psLib/src/astronomy
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astronomy/psAstrometry.c

    r1519 r1530  
    88*  @author George Gusciora, MHPCC
    99*
    10 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2004-08-13 00:01:57 $
     10*  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2004-08-13 22:41:24 $
    1212*
    1313*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9797}
    9898
    99 psCell* psCellInFPA(psCell* outCell,
    100                     const psPlane* fpaCoord,
     99psCell* psCellInFPA(const psPlane* fpaCoord,
    101100                    const psFPA* FPA)
    102101{
    103102    psChip* tmpChip = NULL;
    104103    psPlane* chipCoord = NULL;
     104    psCell* outCell = NULL;
    105105
    106106    if (fpaCoord == NULL) {
     
    112112
    113113    // Determine which chip contains the fpaCoords.
    114     tmpChip = psChipInFPA(tmpChip, fpaCoord, FPA);
     114    tmpChip = psChipInFPA(fpaCoord, FPA);
    115115
    116116    // Convert to those chip coordinates.
     
    118118
    119119    // Determine which cell contains those chip coordinates.
    120     outCell = psCellInChip(outCell, chipCoord, tmpChip);
     120    outCell = psCellInChip(chipCoord, tmpChip);
    121121
    122122    psFree(tmpChip);
     
    144144}
    145145
    146 /*****************************************************************************
    147 XXX: Should we return the result in "out"?
    148  *****************************************************************************/
    149 psChip* psChipInFPA(psChip* out,
    150                     const psPlane* fpaCoord,
     146psChip* psChipInFPA(const psPlane* fpaCoord,
    151147                    const psFPA* FPA)
    152148{
     
    172168                                          fpaCoord);
    173169
    174         tmpCell = psCellInChip(tmpCell, chipCoord, tmpChip);
     170        tmpCell = psCellInChip(chipCoord, tmpChip);
    175171        if (tmpCell != NULL) {
    176172            psFree(chipCoord);
     
    183179}
    184180
    185 /*****************************************************************************
    186 XXX: Should we return the result in "out"?
    187  *****************************************************************************/
    188 psCell* psCellInChip(psCell* outCell,
    189                      const psPlane* chipCoord,
     181psCell* psCellInChip(const psPlane* chipCoord,
    190182                     const psChip* chip)
    191183{
     
    277269
    278270    return(psPlaneDistortApply(outCoord, fpa->toTangentPlane, inCoord,
    279                                magnitude, color));
     271                               color, magnitude));
    280272}
    281273
     
    344336    // Convert the FPA coordinates to tangent plane Coordinates.
    345337    tpCoord = psPlaneDistortApply(tpCoord, parFPA->toTangentPlane,
    346                                   fpaCoord, magnitude, color);
     338                                  fpaCoord, color, magnitude);
    347339
    348340    // Generate a grommit for this FPA.
     
    359351}
    360352
    361 /*****************************************************************************
    362 XXX: After I deproject the tangent plane to a sphere, do I have to do a
    363 spherical transformation to get it to the sky?
    364  *****************************************************************************/
    365353psSphere* psCoordCellToSkyQuick(psSphere* outSphere,
    366354                                const psPlane* cellCoord,
     
    437425
    438426    return (psPlaneDistortApply(fpaCoord, fpa->fromTangentPlane,
    439                                 tpCoord, magnitude, color));
     427                                tpCoord, color, magnitude));
    440428}
    441429
     
    456444    }
    457445
    458     psChip *newChip = psChipInFPA(newChip, fpaCoord, FPA);
     446    // Determine which chip contains these FPA coordinates.
     447    psChip *newChip = psChipInFPA(fpaCoord, FPA);
    459448    if (newChip == NULL) {
    460449        return(NULL);
     
    482471    }
    483472
    484     psCell *newCell = psCellInChip(newCell, chipCoord, chip);
     473    // Determine which cell contains these FPA coordinates.
     474    psCell *newCell = psCellInChip(chipCoord, chip);
    485475    if (newCell == NULL) {
    486476        return(NULL);
     
    492482}
    493483
     484/*****************************************************************************
     485XXX: Should we do anything to determine which cell contains the coordinates?
     486 *****************************************************************************/
    494487psPlane* psCoordSkyToCell(psPlane* cellCoord,
    495488                          const psSphere* skyCoord,
     
    570563simply inverts the supplied psPlaneTransform transform.  It assumes that
    571564"transform" is linear.
     565 
     566This program assumes that the inverse of the following linear equations:
     567        X2 = A + (B * X1) + (C * Y1);
     568        Y2 = D + (E * X1) + (F * Y1);
     569is
     570        Y1 = (Y2 - ((E/B) * X2) - D + ((E*A)/B)) / (F - ((C*E)/B));
     571        X1 = (Y2 - ((F/C) * X2) - D + ((F*A)/C)) / (E - ((F*B)/C));
     572or
     573 X1 = (-D + ((F*A)/C)) / (E - ((F*B)/C)) +
     574      (X2 * -((F/C) / (E - ((F*B)/C)))) +
     575             (Y2 * (1.0 / (E - ((F*B)/C))));
     576        Y1 = (-D + ((E*A)/B))/(F - ((C*E)/B)) +
     577             (X2 * -((E/B) / (F - ((C*E)/B)))) +
     578             (Y2 * (1.0 / (F - ((C*E)/B))));
    572579 *****************************************************************************/
    573 psPlaneTransform *p_psInvertPlaneDistortTransform(psPlaneTransform *transform)
    574 {
     580psPlaneTransform *p_psInvertPlaneTransform(psPlaneTransform *transform)
     581{
     582    double A = transform->x->coeff[0][0];
     583    double B = transform->x->coeff[1][0];
     584    double C = transform->x->coeff[0][1];
     585    double D = transform->y->coeff[0][0];
     586    double E = transform->y->coeff[1][0];
     587    double F = transform->y->coeff[0][1];
     588
    575589    if (transform == NULL) {
    576590        psAbort(__func__, "input parameter transform is NULL.");
     
    578592    psPlaneTransform *out = psAlloc(sizeof(psPlaneTransform));
    579593
    580     // XXX: figure it out
     594    out->x->coeff[0][0] = -D + ((F*A)/C) / (E - ((F*B)/C));
     595    out->x->coeff[1][0] = -(F/C) / (E - ((F*B)/C));
     596    out->x->coeff[0][1] =  1.0 / (E - ((F*B)/C));
     597    out->y->coeff[0][0] = -D + ((E*A)/B) / (F - ((C*E)/B));
     598    out->y->coeff[1][0] = -(E/B) / (F - ((C*E)/B));
     599    out->y->coeff[0][1] =  1.0 / (F - ((C*E)/B));
     600
    581601    return(out);
    582602}
    583603
     604/*****************************************************************************
     605XXX: Should we do anything to determine which cell contains the coordinates?
     606 *****************************************************************************/
    584607psPlane* psCoordSkyToCellQuick(psPlane* cellCoord,
    585608                               const psSphere* skyCoord,
     
    614637    }
    615638
    616     TPtoCell = p_psInvertPlaneDistortTransform(cell->toTP);
     639    TPtoCell = p_psInvertPlaneTransform(cell->toTP);
    617640    cellCoord = psPlaneTransformApply(cellCoord, TPtoCell, tpCoord);
    618641
  • trunk/psLib/src/astronomy/psAstrometry.h

    r1514 r1530  
    88*  @author George Gusciora, MHPCC
    99*
    10 *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2004-08-12 05:36:53 $
     10*  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2004-08-13 22:41:24 $
    1212*
    1313*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    258258 */
    259259psCell* psCellInFPA(
    260     psCell* out,                       ///< a cell struct to recycle. If NULL, a new struct is created
    261260    const psPlane* coord,              ///< the coordinate in FPA plane
    262261    const psFPA* FPA                   ///< the FPA to search for the cell
     
    268267 */
    269268psChip* psChipInFPA(
    270     psChip* out,                       ///< a chip struct to recycle. If NULL, a new struct is created
    271269    const psPlane* coord,              ///< the coordinate in FPA plane
    272270    const psFPA* FPA                   ///< the FPA to search for the cell
     
    278276 */
    279277psCell* psCellInChip(
    280     psCell* out,                       ///< a cell struct to recycle. If NULL, a new struct is created
    281278    const psPlane* coord,              ///< the coordinate in Chip plane
    282279    const psChip* chip                 ///< the chip to search for the cell
Note: See TracChangeset for help on using the changeset viewer.