IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 7079


Ignore:
Timestamp:
May 5, 2006, 5:34:21 PM (20 years ago)
Author:
magnier
Message:

cleaned up ELIXIR/OLD version split

File:
1 edited

Legend:

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

    r6484 r7079  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.118 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2006-02-24 23:43:15 $
     12*  @version $Revision: 1.119 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2006-05-06 03:34:21 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    3232#include <float.h>
    3333
     34# define ELIXIR_CODE 1
    3435
    3536static void planeFree(psPlane *p)
     
    375376        cosDelta = cos(coord->d);
    376377
     378        # if ELIXIR_CODE
     379
     380        sinTheta =  cosDelta*cosAlpha*cosDp + sinDelta*sinDp;
     381    sinPhiCT =  cosDelta*sinAlpha;
     382    cosPhiCT =  cosDelta*cosAlpha*sinDp - sinDelta*cosDp;
     383    # else
     384
    377385        sinTheta =  sinDelta*sinDp + cosDelta*cosDp*cosAlpha;
    378         cosPhiCT =  sinDelta*cosDp - cosDelta*sinDp*cosAlpha;
    379         sinPhiCT = -cosDelta*sinAlpha;
    380     } else {
    381         phi = coord->r - projection->R;
    382         theta = coord->d - projection->D;
    383     }
    384 
    385     // Perform the specified projection
    386     switch (projection->type) {
     386    cosPhiCT =  sinDelta*cosDp - cosDelta*sinDp*cosAlpha;
     387    sinPhiCT = -cosDelta*sinAlpha;
     388    # endif
     389
     390} else {
     391    phi = coord->r - projection->R;
     392    theta = coord->d - projection->D;
     393}
     394
     395// Perform the specified projection
     396switch (projection->type) {
    387397    case PS_PROJ_TAN:
    388398        // Gnomonic projection
     
    468478    case PS_PROJ_TAN:
    469479        // Gnonomic deprojection
     480        // the MHPCC version here was fine
     481        # if 0
     482
     483        sinPhi   = (R == 0) ? 0.0 : +x / R;
     484        cosPhi   = (R == 0) ? 1.0 : -y / R;
    470485        rho      = sqrt (1 + R*R);
     486        sinTheta = 1 / rho;
     487        cosTheta = R / rho;
     488        # else
     489
     490            rho      = sqrt (1 + R*R);
    471491        sinTheta = 1 / rho;
    472492        cosTheta = R / rho;
    473493        sinPhi   = (R == 0) ? 0.0 : +x / R;
    474494        cosPhi   = (R == 0) ? 1.0 : -y / R;
     495        # endif
     496
    475497        break;
    476498    case PS_PROJ_SIN:
     
    508530
    509531        // Convert from projection spherical coordinates
    510         psF64 delta = asin(sinTheta*sinDp + cosTheta*cosDp*cosPhi);
    511         psF64 sinAlphaF = -cosTheta*sinPhi;
    512         psF64 cosAlphaF = -cosTheta*cosPhi*sinDp + sinTheta*cosDp;
     532        // psLib versions:
     533        # if ELIXIR_CODE
     534        // XXX the elixir version : does the ADD have a sign error
     535        psF64 delta = asin(sinTheta*sinDp - cosTheta*cosPhi*cosDp);
     536        psF64 sinAlpha = cosTheta*sinPhi;
     537        psF64 cosAlpha = sinTheta*cosDp + cosTheta*cosPhi*sinDp;
     538        # else
     539
     540            psF64 delta = asin(sinTheta*sinDp + cosTheta*cosDp*cosPhi);
     541        psF64 sinAlpha = -cosTheta*sinPhi;
     542        psF64 cosAlpha = -cosTheta*cosPhi*sinDp + sinTheta*cosDp;
     543        # endif
    513544
    514545        out->d = delta;
    515         out->r = atan2(sinAlphaF, cosAlphaF) + projection->R;
     546        out->r = atan2(sinAlpha, cosAlpha) + projection->R;
    516547    } else {
    517548        out->r = phi   + projection->R;
Note: See TracChangeset for help on using the changeset viewer.