IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1531


Ignore:
Timestamp:
Aug 13, 2004, 1:33:13 PM (22 years ago)
Author:
gusciora
Message:

...

Location:
trunk/psLib/src
Files:
2 edited

Legend:

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

    r1497 r1531  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-12 01:32:21 $
     12*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-13 23:33:13 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9090}
    9191
    92 // XXX: I have no idea how this works.  This algorithm comes from an email
    93 // from Gene.  I assume (x,y) corresponds to (r,d) in the sphere coordinates.
    94 
    95 // XXX: In Gene's email, there are different variables with similar names
    96 // (y and Y) and in the code, there's cos_y, cos_Y, and cos(y).  Verify that
    97 // there are no typo's.
    98 
     92/******************************************************************************
     93This algorithm comes from an email from Gene.  I assume (x,y) corresponds to
     94(r,d) in the sphere coordinates.
     95 
     96XXX: In Gene's email, there are different variables with similar names (y
     97and Y) and in the code, there's cos_y, cos_Y, and cos(y).  Verify that there
     98are no typo's.
     99 *****************************************************************************/
    99100psSphere* psSphereTransformApply(psSphere* out,
    100101                                 const psSphereTransform* transform,
     
    161162}
    162163
    163 // XXX: Is this the correct way to calculate this?
    164164float cot(float x)
    165165{
     
    167167}
    168168
    169 // This is some kind of arc tan function.
     169/******************************************************************************
     170XXX: Verify this arc tan function.
     171 *****************************************************************************/
    170172float arg(float x,
    171173          float y)
     
    187189}
    188190
    189 // XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    190 // XXX: Waiting for the definition of the PS_PROJ_GLS projection.
     191/******************************************************************************
     192XXX: Waiting for the definition of the PS_PROJ_PAR projection.
     193XXX: Waiting for the definition of the PS_PROJ_GLS projection.
     194 *****************************************************************************/
    191195psPlane* psProject(const psSphere* coord,
    192196                   const psProjection* projection)
     
    230234}
    231235
    232 // XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    233 // XXX: Waiting for the definition of the PS_PROJ_GLS projection.
     236/******************************************************************************
     237XXX: Waiting for the definition of the PS_PROJ_PAR projection.
     238XXX: Waiting for the definition of the PS_PROJ_GLS projection.
     239 *****************************************************************************/
    234240psSphere* psDeproject(const psPlane* coord,
    235241                      const psProjection* projection)
     
    278284}
    279285
    280 // XXX: Do I need to check for unacceptable transformation parameters?
    281 // Maybe, if the points are on the North/South Pole, etc?
     286/******************************************************************************
     287The basic idea is to project both positions onto the linear plane, with
     288position1 at the center, then calculate the linear offset between those
     289projections.
     290 
     291XXX: Do I need to check for unacceptable transformation parameters?  Maybe,
     292     if the points are on the North/South Pole, etc?
     293 
     294XXX: Do I need to somehow scale this projection?
     295 *****************************************************************************/
    282296psSphere* psSphereGetOffset(const psSphere* restrict position1,
    283297                            const psSphere* restrict position2,
     
    285299                            psSphereOffsetUnit unit)
    286300{
    287     // psPlane* lin;
     301    psPlane* lin;
    288302    psProjection proj;
    289303    psSphere* tmp;
     
    292306
    293307    if (mode == PS_LINEAR) {
    294         // XXX: I have no idea how to construct this.  Maybe project both
    295         // sperical positions onto the plane, set the origin at one of the
    296         // points on the plane, then deproject?
    297 
    298         // XXX: Do I need to somehow scale this projection?
    299         // project position1? Will it project to (0.0, 0.0)?
    300308        proj.R = position1->r;
    301309        proj.D = position1->d;
     
    304312        proj.type = PS_PROJ_TAN;
    305313
    306         // lin = psProject(position2, proj);
    307         // tmp = psDeproject(lin, proj);
     314        lin = psProject(position2, &proj);
     315        tmp = psDeproject(lin, &proj);
    308316
    309317        // XXX: Do we need to convert units in tmp?
     
    328336
    329337        tmp = (psSphere* ) psAlloc(sizeof(psSphere));
    330         tmp->r = tmpR;
    331         tmp->d = tmpD;
     338        // XXX: Wrap these to an acceptable range.  Is this correct?
     339        tmp->r = fmod(tmpR, 2*M_PI);
     340        tmp->d = fmod(tmpD, 2*M_PI);
    332341        tmp->rErr = 0.0;
    333342        tmp->dErr = 0.0;
    334         // XXX: Do we need to wrap these to an acceptable range?
     343
    335344        return (tmp);
    336345    }
     
    339348}
    340349
    341 // XXX: Do I need to check for unacceptable transformation parameters?
    342 // Maybe, if the points are on the North/South Pole, etc?
    343 // XXX: I copied the algorithm from the ADD exactly.
     350/******************************************************************************
     351XXX: Do I need to check for unacceptable transformation parameters?  Maybe,
     352     if the points are on the North/South Pole, etc?
     353 
     354XXX: Do I need to somehow scale this projection?
     355 
     356XXX: I copied the algorithm from the ADD exactly.
     357 *****************************************************************************/
     358
    344359psSphere* psSphereSetOffset(const psSphere* restrict position,
    345360                            const psSphere* restrict offset,
     
    384399
    385400        tmp = (psSphere* ) psAlloc(sizeof(psSphere));
     401        // XXX: Is this an acceptable way to wrap the angular output?
    386402        tmp->r = position->r + tmpR;
    387         tmp->r = position->d + tmpD;
     403        tmp->r = fmod(tmp->r, 2.0*M_PI);
     404        tmp->d = position->d + tmpD;
     405        tmp->d = fmod(tmp->d, 2.0*M_PI);
    388406        tmp->rErr = 0.0;
    389407        tmp->dErr = 0.0;
    390408
    391         // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)
    392         // and (0 to 2*PI).
    393409        return (tmp);
    394410    }
  • trunk/psLib/src/astronomy/psCoord.c

    r1497 r1531  
    1010*  @author George Gusciora, MHPCC
    1111*
    12 *  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-12 01:32:21 $
     12*  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-13 23:33:13 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    9090}
    9191
    92 // XXX: I have no idea how this works.  This algorithm comes from an email
    93 // from Gene.  I assume (x,y) corresponds to (r,d) in the sphere coordinates.
    94 
    95 // XXX: In Gene's email, there are different variables with similar names
    96 // (y and Y) and in the code, there's cos_y, cos_Y, and cos(y).  Verify that
    97 // there are no typo's.
    98 
     92/******************************************************************************
     93This algorithm comes from an email from Gene.  I assume (x,y) corresponds to
     94(r,d) in the sphere coordinates.
     95 
     96XXX: In Gene's email, there are different variables with similar names (y
     97and Y) and in the code, there's cos_y, cos_Y, and cos(y).  Verify that there
     98are no typo's.
     99 *****************************************************************************/
    99100psSphere* psSphereTransformApply(psSphere* out,
    100101                                 const psSphereTransform* transform,
     
    161162}
    162163
    163 // XXX: Is this the correct way to calculate this?
    164164float cot(float x)
    165165{
     
    167167}
    168168
    169 // This is some kind of arc tan function.
     169/******************************************************************************
     170XXX: Verify this arc tan function.
     171 *****************************************************************************/
    170172float arg(float x,
    171173          float y)
     
    187189}
    188190
    189 // XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    190 // XXX: Waiting for the definition of the PS_PROJ_GLS projection.
     191/******************************************************************************
     192XXX: Waiting for the definition of the PS_PROJ_PAR projection.
     193XXX: Waiting for the definition of the PS_PROJ_GLS projection.
     194 *****************************************************************************/
    191195psPlane* psProject(const psSphere* coord,
    192196                   const psProjection* projection)
     
    230234}
    231235
    232 // XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    233 // XXX: Waiting for the definition of the PS_PROJ_GLS projection.
     236/******************************************************************************
     237XXX: Waiting for the definition of the PS_PROJ_PAR projection.
     238XXX: Waiting for the definition of the PS_PROJ_GLS projection.
     239 *****************************************************************************/
    234240psSphere* psDeproject(const psPlane* coord,
    235241                      const psProjection* projection)
     
    278284}
    279285
    280 // XXX: Do I need to check for unacceptable transformation parameters?
    281 // Maybe, if the points are on the North/South Pole, etc?
     286/******************************************************************************
     287The basic idea is to project both positions onto the linear plane, with
     288position1 at the center, then calculate the linear offset between those
     289projections.
     290 
     291XXX: Do I need to check for unacceptable transformation parameters?  Maybe,
     292     if the points are on the North/South Pole, etc?
     293 
     294XXX: Do I need to somehow scale this projection?
     295 *****************************************************************************/
    282296psSphere* psSphereGetOffset(const psSphere* restrict position1,
    283297                            const psSphere* restrict position2,
     
    285299                            psSphereOffsetUnit unit)
    286300{
    287     // psPlane* lin;
     301    psPlane* lin;
    288302    psProjection proj;
    289303    psSphere* tmp;
     
    292306
    293307    if (mode == PS_LINEAR) {
    294         // XXX: I have no idea how to construct this.  Maybe project both
    295         // sperical positions onto the plane, set the origin at one of the
    296         // points on the plane, then deproject?
    297 
    298         // XXX: Do I need to somehow scale this projection?
    299         // project position1? Will it project to (0.0, 0.0)?
    300308        proj.R = position1->r;
    301309        proj.D = position1->d;
     
    304312        proj.type = PS_PROJ_TAN;
    305313
    306         // lin = psProject(position2, proj);
    307         // tmp = psDeproject(lin, proj);
     314        lin = psProject(position2, &proj);
     315        tmp = psDeproject(lin, &proj);
    308316
    309317        // XXX: Do we need to convert units in tmp?
     
    328336
    329337        tmp = (psSphere* ) psAlloc(sizeof(psSphere));
    330         tmp->r = tmpR;
    331         tmp->d = tmpD;
     338        // XXX: Wrap these to an acceptable range.  Is this correct?
     339        tmp->r = fmod(tmpR, 2*M_PI);
     340        tmp->d = fmod(tmpD, 2*M_PI);
    332341        tmp->rErr = 0.0;
    333342        tmp->dErr = 0.0;
    334         // XXX: Do we need to wrap these to an acceptable range?
     343
    335344        return (tmp);
    336345    }
     
    339348}
    340349
    341 // XXX: Do I need to check for unacceptable transformation parameters?
    342 // Maybe, if the points are on the North/South Pole, etc?
    343 // XXX: I copied the algorithm from the ADD exactly.
     350/******************************************************************************
     351XXX: Do I need to check for unacceptable transformation parameters?  Maybe,
     352     if the points are on the North/South Pole, etc?
     353 
     354XXX: Do I need to somehow scale this projection?
     355 
     356XXX: I copied the algorithm from the ADD exactly.
     357 *****************************************************************************/
     358
    344359psSphere* psSphereSetOffset(const psSphere* restrict position,
    345360                            const psSphere* restrict offset,
     
    384399
    385400        tmp = (psSphere* ) psAlloc(sizeof(psSphere));
     401        // XXX: Is this an acceptable way to wrap the angular output?
    386402        tmp->r = position->r + tmpR;
    387         tmp->r = position->d + tmpD;
     403        tmp->r = fmod(tmp->r, 2.0*M_PI);
     404        tmp->d = position->d + tmpD;
     405        tmp->d = fmod(tmp->d, 2.0*M_PI);
    388406        tmp->rErr = 0.0;
    389407        tmp->dErr = 0.0;
    390408
    391         // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)
    392         // and (0 to 2*PI).
    393409        return (tmp);
    394410    }
Note: See TracChangeset for help on using the changeset viewer.