IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5319 for trunk/psLib/src/astro


Ignore:
Timestamp:
Oct 13, 2005, 2:07:37 PM (21 years ago)
Author:
drobbin
Message:

Fixed/Updated SphereRot functions and tests.

Location:
trunk/psLib/src/astro
Files:
2 edited

Legend:

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

    r5306 r5319  
    66 *
    77 *  @author Robert DeSonia, MHPCC
     8 *  @author Dave Robbins, MHPCC
    89 *
    9  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-10-13 20:23:57 $
     10 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-10-14 00:07:37 $
    1112 *
    1213 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6263    // calculate t*s*r.
    6364    psSphereRot* result = psSphereRotCombine(NULL,&t,&s);
    64     psMemSetDeallocator(result, (psFreeFunc)sphereRotFree);
    6565    psSphereRotCombine(result,result,&r);
    6666
     
    7979                             double q3)
    8080{
    81     psSphereRot* rot = psAlloc(sizeof(psSphereRot));
     81    psSphereRot* rot = (psSphereRot*)psAlloc(sizeof(psSphereRot));
     82    psMemSetDeallocator(rot, (psFreeFunc)sphereRotFree);
    8283
    8384    double len = sqrt(q0*q0 + q1*q1 + q2*q2 + q3*q3);
     
    113114                                 sin(coord->d),
    114115                                 0.0);
    115     psSphereRot* coordQuatConjugate = psSphereRotQuat(
    116                                           coordQuat->q0, coordQuat->q1, coordQuat->q2, coordQuat->q3);
    117     coordQuat = psSphereRotInvert(coordQuat);
     116    //    psSphereRot* coordQuatConjugate = psSphereRotQuat(
     117    //                                       coordQuat->q0, coordQuat->q1, coordQuat->q2, coordQuat->q3);
     118    //    coordQuat = psSphereRotInvert(coordQuat);
    118119
    119120    // calculate q=(rp)r'
    120     coordQuat = psSphereRotCombine(coordQuat, transform, coordQuat);
    121     coordQuat = psSphereRotCombine(coordQuat, coordQuat, coordQuatConjugate);
     121    //    coordQuat = psSphereRotCombine(coordQuat, transform, coordQuat);
     122    //    coordQuat = psSphereRotCombine(coordQuat, coordQuat, coordQuatConjugate);
    122123    // N.B., we can recycle coordQuat right away due to the implementation of
    123124    // psSphereRotCombine; it puts the input values in a local variable first
    124125
    125     out->r = atan2(coordQuat->q1,coordQuat->q0);
    126     out->d = asin(coordQuat->q2);
     126    //    out->r = atan2(coordQuat->q1,coordQuat->q0);
     127    //    out->d = asin(coordQuat->q2);
     128
     129
     130    //     psSphereRot *inv = psSphereRotInvert(transform);
     131    psSphereRot *inv = (psSphereRot*)psAlloc(sizeof(psSphereRot));
     132    *inv = *transform;
     133    psSphereRot *result = psSphereRotCombine(NULL, transform, coordQuat);
     134    psSphereRotInvert(inv);
     135    psSphereRotCombine(result, result, inv);
     136    out->r = atan2(result->q1, result->q0);
     137    out->d = asin(result->q2);
     138    out->rErr = 0.0;
     139    out->dErr = 0.0;
     140    psFree(inv);
     141    psFree(result);
    127142
    128143    psFree(coordQuat);
    129     psFree(coordQuatConjugate);
     144    //    psFree(coordQuatConjugate);
    130145
    131146    return out;
     
    141156    if (out == NULL) {
    142157        out = (psSphereRot* ) psAlloc(sizeof(psSphereRot));
     158        psMemSetDeallocator(out, (psFreeFunc)sphereRotFree);
    143159    }
    144160
  • trunk/psLib/src/astro/psSphereOps.h

    r5306 r5319  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-10-13 20:23:57 $
     9 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-10-14 00:07:37 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7373);
    7474
    75 psSphereRot* psSphereRotAlloc2(
    76     double alphaP,                      ///< north pole latitude
    77     double deltaP,                      ///< north pole longitude
    78     double phiP                         ///< defines the longitude in the input system of the equatorial intersection between the two systems (e.g, the first point of Ares).
    79 );
    80 
    81 psSphereRot* psSphereRotAlloc3(
    82     double alphaP,                      ///< north pole latitude
    83     double deltaP,                      ///< north pole longitude
    84     double phiP                         ///< defines the longitude in the input system of the equatorial intersection between the two systems (e.g, the first point of Ares).
    85 );
    86 
    87 psSphereRot* psSphereRotAlloc4(
    88     double alphaP,                      ///< north pole latitude
    89     double deltaP,                      ///< north pole longitude
    90     double phiP                         ///< defines the longitude in the input system of the equatorial intersection between the two systems (e.g, the first point of Ares).
    91 );
    92 
    93 psSphereRot* psSphereRotAlloc5(
    94     double alphaP,                      ///< north pole latitude
    95     double deltaP,                      ///< north pole longitude
    96     double phiP                         ///< defines the longitude in the input system of the equatorial intersection between the two systems (e.g, the first point of Ares).
    97 );
    98 
    99 psSphereRot* psSphereRotAlloc6(
    100     double alphaP,                      ///< north pole latitude
    101     double deltaP,                      ///< north pole longitude
    102     double phiP                         ///< defines the longitude in the input system of the equatorial intersection between the two systems (e.g, the first point of Ares).
    103 );
    104 
    105 psSphereRot* psSphereRotAlloc7(
    106     double alphaP,                      ///< north pole latitude
    107     double deltaP,                      ///< north pole longitude
    108     double phiP                         ///< defines the longitude in the input system of the equatorial intersection between the two systems (e.g, the first point of Ares).
    109 );
    110 
    111 psSphereRot* psSphereRotAlloc8(
    112     double alphaP,                      ///< north pole latitude
    113     double deltaP,                      ///< north pole longitude
    114     double phiP                         ///< defines the longitude in the input system of the equatorial intersection between the two systems (e.g, the first point of Ares).
    115 );
    116 
    117 
    11875/** Checks the type of a particular pointer.
    11976 *
Note: See TracChangeset for help on using the changeset viewer.