IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 27, 2005, 4:25:22 PM (21 years ago)
Author:
drobbin
Message:

Implemented and tested psAberration, but results have not been verified.

File:
1 edited

Legend:

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

    r5447 r5450  
    99*  @author Robert Daniel DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2005-10-27 20:38:18 $
     11*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2005-10-28 02:25:22 $
    1313*
    1414*  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
     
    1919
    2020#include "psEarthOrientation.h"
    21 #include "psTime.h"
     21//#include "psTime.h"
    2222#include "psArray.h"
    2323#include "psPolynomial.h"
     
    163163                       double speed)
    164164{
    165 
    166 
    167     return NULL;
     165    PS_ASSERT_PTR_NON_NULL(apparent, NULL);
     166    PS_ASSERT_PTR_NON_NULL(direction, NULL);
     167    if (fabs(speed) < DBL_EPSILON) {
     168        psError(PS_ERR_BAD_PARAMETER_VALUE, true,
     169                "Aberration speed should not be equal to 0.\n");
     170        return NULL;
     171    }
     172
     173    if (actual == NULL) {
     174        actual = psSphereAlloc();
     175    } else {
     176        actual->r = 0.0;
     177        actual->d = 0.0;
     178        actual->rErr = 0.0;
     179        actual->dErr = 0.0;
     180    }
     181    psSphere *rp = psSphereAlloc();
     182    psSphere *r_p = psSphereAlloc();
     183    double mu = 0.0;
     184    double mu_p = 0.0;
     185    double a = 0.0;
     186
     187    //mu = apparent * direction;  I believe this should be:
     188    //    mu = apparent->r * direction->r + apparent->d * direction->d;
     189    psCube* directionVector = psSphereToCube(direction);
     190    psCube* apparentVector = psSphereToCube(apparent);
     191    mu = acos(directionVector->x*apparentVector->x +
     192              directionVector->y*apparentVector->y +
     193              directionVector->z*apparentVector->z);
     194
     195    //rp = apparent - mu * direction;
     196    rp->r = apparent->r - mu * direction->r;
     197    rp->d = apparent->d - mu * direction->d;
     198
     199    mu_p = mu + speed * ((mu * mu - 1.0) / (1.0 - speed * mu));
     200
     201    //Not sure if this is right.  ADD gets a scalar from division of rp (a vector)
     202    psCube* rpVector = psSphereToCube(rp);
     203    a = sqrt( (1.0 - mu_p * mu_p) /
     204              (sqrt(rpVector->x*rpVector->x
     205                    + rpVector->y*rpVector->y
     206                    + rpVector->z*rpVector->z)) );
     207
     208    //r_p = mu_p * direction + a * rp;
     209    r_p->r = mu_p * direction->r + a * rp->r;
     210    r_p->d = mu_p * direction->d + a * rp->d;
     211
     212    *actual = *r_p;
     213    /*
     214        psSphereRot *rot = NULL;
     215        double cosR = cos(direction->r);
     216        double cosD = cos(direction->d);
     217        double sinR = sin(direction->r);
     218        double sinD = sin(direction->d);
     219        rot = psSphereRotQuat(cosR*cosD, sinR*cosD, sinD, speed);
     220     
     221        actual = psSphereRotApply(actual, rot, apparent);
     222    */
     223    psFree(rp);
     224    psFree(r_p);
     225    psFree(directionVector);
     226    psFree(apparentVector);
     227    psFree(rpVector);
     228    return actual;
    168229}
    169230
Note: See TracChangeset for help on using the changeset viewer.