IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 19, 2007, 8:57:05 AM (19 years ago)
Author:
eugene
Message:

substantial work on astrometry model tables

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/astrom/pmAstrometryUtils.c

    r15254 r15884  
    77 *  @author EAM, IfA
    88 *
    9  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2007-10-09 19:27:04 $
     9 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2007-12-19 18:57:05 $
    1111 *
    1212 *  Copyright 2006 Institute for Astronomy, University of Hawaii
     
    129129}
    130130
     131// rotate a transformation L(x,y) by theta
     132psPlaneTransform *psPlaneTransformRotate (psPlaneTransform *output, psPlaneTransform *input, double theta)
     133{
     134    // validate fit order
     135    if (output == NULL) {
     136        output = psPlaneTransformAlloc(input->x->nX, input->x->nY);
     137    }
     138
     139    /* given the polynomial transformations:
     140     *  L(x,y) = \sum_i \sum_j A_{i,j} x^i y^j and
     141     *  M(x,y) = \sum_i \sum_j B_{i,j} x^i y^j
     142     * we can rotate L,M to L',M' by applying the rotation matrix (c,s),(-s,c).
     143     * the resulting terms of L and M are:
     144     * A'_{i,j} = c A_{i,j} + s B_{i,j}
     145     * B'_{i,j} = c B_{i,j} - s A_{i,j}
     146     */
     147
     148    float cs = cos(theta);
     149    float sn = sin(theta);
     150
     151    for (int i = 0; i <= input->x->nX; i++) {
     152        for (int j = 0; j <= input->x->nY; j++) {
     153            // XXX what about inconsistent x and y masking?
     154            output->x->coeffMask[i][j] = input->x->coeffMask[i][j];
     155            output->y->coeffMask[i][j] = input->y->coeffMask[i][j];
     156            if (output->x->coeffMask[i][j]) {
     157                output->x->coeff[i][j] = 0.0;
     158                output->y->coeff[i][j] = 0.0;
     159            } else {
     160                output->x->coeff[i][j] = cs*input->x->coeff[i][j] + sn*input->y->coeff[i][j];
     161                output->y->coeff[i][j] = cs*input->y->coeff[i][j] - sn*input->x->coeff[i][j];
     162            }
     163        }
     164    }
     165    return output;
     166}
     167
    131168// construct a psPlaneTransform which is the identify transformation
    132169psPlaneTransform *psPlaneTransformIdentity (int order)
Note: See TracChangeset for help on using the changeset viewer.