IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6230


Ignore:
Timestamp:
Jan 27, 2006, 3:31:44 PM (20 years ago)
Author:
drobbin
Message:

Implemented psPixelsTransform.

Location:
trunk/psLib/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psCoord.c

    r6204 r6230  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.101 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2006-01-26 21:10:22 $
     12*  @version $Revision: 1.102 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2006-01-28 01:31:44 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    206206
    207207// XXX: Verify the order/nterms poly changes
    208 psPlaneTransform* psPlaneTransformAlloc(int order1, int order2)
     208psPlaneTransform* psPlaneTransformAlloc(int order1,
     209                                        int order2)
    209210{
    210211    PS_ASSERT_INT_NONNEGATIVE(order1, NULL);
     
    240241}
    241242
    242 psPlane* psPlaneTransformApply(
    243     psPlane* out,
    244     const psPlaneTransform* transform,
    245     const psPlane* coords)
     243psPlane* psPlaneTransformApply(psPlane* out,
     244                               const psPlaneTransform* transform,
     245                               const psPlane* coords)
    246246{
    247247    PS_ASSERT_PTR_NON_NULL(transform, NULL);
     
    267267
    268268// XXX: Verify the order/nterms poly changes
    269 psPlaneDistort* psPlaneDistortAlloc(int order1, int order2, int order3, int order4)
     269psPlaneDistort* psPlaneDistortAlloc(int order1,
     270                                    int order2,
     271                                    int order3,
     272                                    int order4)
    270273{
    271274    PS_ASSERT_INT_NONNEGATIVE(order1, NULL);
     
    347350}
    348351
    349 psProjection* psProjectionAlloc(
    350     double R,
    351     double D,
    352     double Xs,
    353     double Ys,
    354     psProjectionType type)
     352psProjection* psProjectionAlloc(double R,
     353                                double D,
     354                                double Xs,
     355                                double Ys,
     356                                psProjectionType type)
    355357{
    356358    psProjection *p = psAlloc(sizeof(psProjection));
     
    372374
    373375
    374 psPlane* p_psProject(
    375     psPlane *outPlane,
    376     const psSphere* coord,
    377     const psProjection* projection)
     376psPlane* p_psProject(psPlane *outPlane,
     377                     const psSphere* coord,
     378                     const psProjection* projection)
    378379{
    379380    PS_ASSERT_PTR_NON_NULL(coord, NULL);
     
    457458}
    458459
    459 psSphere* p_psDeproject(
    460     psSphere *outSphere,
    461     const psPlane* coord,
    462     const psProjection* projection)
     460psSphere* p_psDeproject(psSphere *outSphere,
     461                        const psPlane* coord,
     462                        const psProjection* projection)
    463463{
    464464    PS_ASSERT_PTR_NON_NULL(coord, NULL);
     
    604604routine far too many times.
    605605 *****************************************************************************/
    606 psPlaneTransform *psPlaneTransformCombine(
    607     psPlaneTransform *out,
    608     const psPlaneTransform *trans1,
    609     const psPlaneTransform *trans2,
    610     psRegion region,
    611     int nSamples)
     606psPlaneTransform *psPlaneTransformCombine(psPlaneTransform *out,
     607        const psPlaneTransform *trans1,
     608        const psPlaneTransform *trans2,
     609        psRegion region,
     610        int nSamples)
    612611{
    613612    psTrace(__func__, 3, "---- %s() begin ----\n", __func__);
     
    10161015}
    10171016
    1018 psPlane *psPlaneTransformDeriv(
    1019     psPlane *out,
    1020     const psPlaneTransform *transformation,
    1021     const psPlane *coord
    1022 )
     1017psPlane *psPlaneTransformDeriv(psPlane *out,
     1018                               const psPlaneTransform *transformation,
     1019                               const psPlane *coord)
    10231020{
    10241021    PS_ASSERT_PTR_NON_NULL(transformation, NULL);
     
    10801077    }
    10811078    return(out);
     1079}
     1080
     1081psPixels *psPixelsTransform(psPixels *out,
     1082                            const psPixels *input,
     1083                            const psPlaneTransform *inToOut)
     1084{
     1085    PS_ASSERT_PTR_NON_NULL(input, NULL);
     1086    PS_ASSERT_PTR_NON_NULL(inToOut, NULL);
     1087    PS_ASSERT_PTR_NON_NULL(inToOut->x, NULL);
     1088    PS_ASSERT_PTR_NON_NULL(inToOut->y, NULL);
     1089    if (out == NULL) {
     1090        //XXX: Should the length (nalloc) be 1 and append be used everytime a pixel is added?
     1091        //        out = psPixelsAlloc(input->nalloc);
     1092        out = psPixelsAlloc(1);
     1093    }
     1094    psPlane *coord = psPlaneAlloc();
     1095    psPlane *deriv = psPlaneAlloc();
     1096    psPlane *fxnVal = psPlaneAlloc();
     1097
     1098    int i = 0;
     1099    //    int m = 0;
     1100    //    while (input->data.x[i] != 0.0 && input->data.y[i] != 0.0) {
     1101    for ( i = 0; i < input->n; i++) {
     1102        coord->x = input->data[i].x;
     1103        coord->y = input->data[i].y;
     1104        deriv = psPlaneTransformDeriv(deriv, inToOut, coord);
     1105        fxnVal = psPlaneTransformApply(fxnVal, inToOut, coord);
     1106        if (fabs(fxnVal->x - coord->x) < fabs(deriv->x) &&
     1107                fabs(fxnVal->y - coord->y) < fabs(deriv->y)) {
     1108            int x = (int)(round(fabs(deriv->x)));
     1109            int y = (int)(round(fabs(deriv->y)));
     1110            for (int j = -x; j <= x; j++) {
     1111                for (int k = -y; k <= y; k++) {
     1112                    //                    out->data[m].x = fxnVal->x + x;
     1113                    //                    out->data[m].y = fxnVal->y + y;
     1114                    //                    m++;
     1115                    out = p_psPixelsAppend(out, 1, (float)(fxnVal->x+j),
     1116                                           (float)(fxnVal->y+k) );
     1117                }
     1118            }
     1119        }
     1120    }
     1121
     1122    psFree(coord);
     1123    psFree(deriv);
     1124    psFree(fxnVal);
     1125    return out;
    10821126}
    10831127
  • trunk/psLib/src/astro/psCoord.h

    r5814 r6230  
    1111 *  @author GLG, MHPCC
    1212 *
    13  *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-12-20 05:05:37 $
     13 *  @version $Revision: 1.50 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2006-01-28 01:31:44 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2525#include "psList.h"
    2626#include "psPolynomial.h"
     27#include "psPixels.h"
    2728//#include "psTime.h"
    2829
     
    435436);
    436437
     438/** Generates a list of pixels in the output coordinate frame that overlap the input
     439 *  pixels in the input coordinate frame through the specified transformation, inToOut.
     440 *
     441 *  psPixelsTransform is more complicated than simply transforming the input pixels,
     442 *  but requires the evaluation of the derivatives of the transformation in order to
     443 *  obtain the list of all pixels in the output coordinate frame that possibly overlap
     444 *  the pixel in the input coordinate frame.  In the event that input or inToOut are
     445 *  NULL, the function shall generate an error and return NULL.  If out is non-NULL it
     446 *  shall be modified and returned;  otherwise a new psPixels shall be allocated and
     447 *  returned.
     448 *
     449 *  @return psPixels*:      the list of overlapping pixels.
     450 */
     451psPixels *psPixelsTransform(
     452    psPixels *out,                     ///< output list of overlapping pixels
     453    const psPixels *input,             ///< input list of pixels
     454    const psPlaneTransform *inToOut    ///< specified transformation
     455);
     456
    437457/// @}
    438458
  • trunk/psLib/src/astro/psEarthOrientation.c

    r6204 r6230  
    88 *  @author Robert Daniel DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.31 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2006-01-26 21:10:22 $
     10 *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2006-01-28 01:31:44 $
    1212 *
    1313 *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
     
    11121112    // Convert psTime to MJD
    11131113    double MJD = psTimeToMJD(time);
     1114    printf("\nMJD check = %.13g\n", MJD);
    11141115    if (MJD == NAN) {
    11151116        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
  • trunk/psLib/src/types/psPixels.h

    r5530 r6230  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-11-16 23:06:35 $
     9 *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2006-01-28 01:31:44 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4141typedef struct
    4242{
    43     long n;                            ///< Number in usa
     43    long n;                            ///< Number in use
    4444    const long nalloc;                 ///< Number allocated
    4545    psPixelCoord* data;                ///< The pixel coordinates
Note: See TracChangeset for help on using the changeset viewer.