IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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

Fixed/Updated SphereRot functions and tests.

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.