IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 28, 2004, 10:22:22 AM (22 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

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

    r1297 r1311  
    1010 *  @author George Gusciora, MHPCC
    1111 *
    12  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-07-27 05:30:55 $
     12 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-07-28 20:22:22 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323#include "psMemory.h"
    2424#include "psAbort.h"
     25#include "psTime.h"
    2526#include <math.h>
    2627#include <float.h>
     
    133134}
    134135
    135 // XXX: Add a date argument to determine the correct year.
    136 psSphereTransform *psSphereTransformICRStoEcliptic(void)
    137 {
    138     double year = 2004.0;
     136psSphereTransform *psSphereTransformICRStoEcliptic(psTime time)
     137{
     138    struct tm *tmTime = psTimeToTM(time);
     139    double year = (double) (1900 + tmTime->tm_year);
    139140    double T = year / 100.0;
    140141    double phi = -23.452294 + 0.013013*T + 0.000001639*T*T - 0.000000503*T*T*T;
     
    145146}
    146147
    147 // XXX: Add a date argument to determine the correct year.
    148148psSphereTransform *psSphereTransformEcliptictoICRS(void)
    149149{
    150     double year = 2004.0;
     150    struct tm *tmTime = psTimeToTM(time);
     151    double year = (double) (1900 + tmTime->tm_year);
    151152    double T = year / 100.0;
    152153    double phi = +23.452294 - 0.013013*T - 0.000001639*T*T + 0.000000503*T*T*T;
     
    285286}
    286287
     288// XXX: Do I need to check for unacceptable transformation parameters?
     289// Maybe, if the points are on the North/South Pole, etc?
    287290psSphere *psSphereGetOffset(const psSphere *restrict position1,
    288291                            const psSphere *restrict position2,
     
    290293                            psSphereOffsetUnit unit)
    291294{
    292     //    psPlane lin;
     295    psPlane *lin;
     296    psProjection proj;
    293297    psSphere *tmp;
    294     //    psProjection proj;
    295298    double tmpR = 0.0;
    296299    double tmpD = 0.0;
    297300
    298301    if (mode == PS_LINEAR) {
    299         // XXX: I have no idea how to construct this.
    300         return(NULL);
     302        // XXX: I have no idea how to construct this.  Maybe project both
     303        // sperical positions onto the plane, set the origin at one of the
     304        // points on the plane, then deproject?
     305
     306        // XXX: Do I need to somehow scale this projection?
     307        // project position1?  Will it project to (0.0, 0.0)?
     308        proj.R = position1->r;
     309        proj.D = position1->d;
     310        proj.Xs = 1.0;
     311        proj.Ys = 1.0;
     312        proj.type = PS_PROJ_TAN;
     313
     314        lin = psProject(position2, proj);
     315        tmp = psDeproject(lin, proj);
     316
     317        // XXX: Do we need to convert units in tmp?
     318        return(tmp);
    301319    } else if (mode == PS_SPHERICAL) {
    302320        tmpR = position2->r - position1->r;
     
    314332        } else if (unit == PS_RADIAN) {}
    315333        else {
    316             psAbort(__func__, "Unknow offset unit: 0x%x\n", unit);
     334            psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
    317335        }
    318336
     
    330348
    331349
     350// XXX: Do I need to check for unacceptable transformation parameters?
     351// Maybe, if the points are on the North/South Pole, etc?
    332352// XXX: I copied the algorithm from the ADD exactly.
    333353psSphere *psSphereSetOffset(const psSphere *restrict position,
     
    369389            tmpD = offset->d;
    370390        } else {
    371             psAbort(__func__, "Unknow offset unit: 0x%x\n", unit);
     391            psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
    372392        }
    373393
Note: See TracChangeset for help on using the changeset viewer.