IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1374


Ignore:
Timestamp:
Aug 3, 2004, 2:55:17 PM (22 years ago)
Author:
desonia
Message:

doxygen grouping tweaks.

Location:
trunk/psLib/src
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/Doxyfile

    r1269 r1374  
    377377# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc
    378378
    379 FILE_PATTERNS          = *.h *.dox
     379FILE_PATTERNS          = *.c *.h *.dox
    380380
    381381# The RECURSIVE tag can be used to turn specify whether or not subdirectories
  • trunk/psLib/src/astro/psCoord.c

    r1325 r1374  
    11/** @file  psCoord.c
    2  *
    3  *  @brief Contains basic coordinate transformation definitions and operations
    4  *
    5  *  This file defines the basic types for astronomical coordinate
    6  *  transformation
    7  *
    8  *  @ingroup AstroImage
    9  *
    10  *  @author George Gusciora, MHPCC
    11  *
    12  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-07-29 02:08:02 $
    14  *
    15  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    16  */
     2*
     3*  @brief Contains basic coordinate transformation definitions and operations
     4*
     5*  This file defines the basic types for astronomical coordinate
     6*  transformation
     7*
     8*  @ingroup CoordinateTransform
     9*
     10*  @author George Gusciora, MHPCC
     11*
     12*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-04 00:55:17 $
     14*
     15*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     16*/
    1717
    1818#include "psType.h"
     
    2828
    2929// This is the only function in this file which I understand.
    30 psPlane *psPlaneTransformApply(psPlane *out,
    31                                const psPlaneTransform *transform,
    32                                const psPlane *coords)
    33 {
    34     if (out == NULL) {
    35         out = (psPlane *) psAlloc(sizeof(psPlane));
    36     }
    37     out->x = transform->x->coeff[0][0] +
    38              (transform->x->coeff[1][0] * coords->x) +
    39              (transform->x->coeff[0][1] * coords->y);
    40 
    41     out->y = transform->y->coeff[0][0] +
    42              (transform->y->coeff[1][0] * coords->x) +
    43              (transform->y->coeff[0][1] * coords->y);
    44 
    45     return(out);
     30psPlane *psPlaneTransformApply( psPlane *out,
     31                                const psPlaneTransform *transform,
     32                                const psPlane *coords )
     33{
     34    if ( out == NULL ) {
     35            out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
     36        }
     37    out->x = transform->x->coeff[ 0 ][ 0 ] +
     38             ( transform->x->coeff[ 1 ][ 0 ] * coords->x ) +
     39             ( transform->x->coeff[ 0 ][ 1 ] * coords->y );
     40             
     41    out->y = transform->y->coeff[ 0 ][ 0 ] +
     42             ( transform->y->coeff[ 1 ][ 0 ] * coords->x ) +
     43             ( transform->y->coeff[ 0 ][ 1 ] * coords->y );
     44             
     45    return ( out );
    4646}
    4747
     
    4949// This transformation takes into account parameters beyond an objects
    5050// spatial coordinates: term3 and term4.
    51 psPlane *psPlaneDistortApply(psPlane *out,
    52                              const psPlaneDistort *transform,
    53                              const psPlane *coords,
    54                              float term3,
    55                              float term4)
    56 {
    57     if (out == NULL) {
    58         out = (psPlane *) psAlloc(sizeof(psPlane));
    59     }
    60 
    61     out->x = transform->x->coeff[0][0][0][0] +
    62              (transform->x->coeff[1][0][0][0] * coords->x) +
    63              (transform->x->coeff[0][1][0][0] * coords->y) +
    64              (transform->x->coeff[0][0][1][0] * term3) +
    65              (transform->x->coeff[0][0][0][1] * term4);
    66 
    67     out->y = transform->y->coeff[0][0][0][0] +
    68              (transform->y->coeff[1][0][0][0] * coords->x) +
    69              (transform->y->coeff[0][1][0][0] * coords->y) +
    70              (transform->y->coeff[0][0][1][0] * term3) +
    71              (transform->y->coeff[0][0][0][1] * term4);
    72 
    73     return(out);
     51psPlane *psPlaneDistortApply( psPlane *out,
     52                              const psPlaneDistort *transform,
     53                              const psPlane *coords,
     54                              float term3,
     55                              float term4 )
     56{
     57    if ( out == NULL ) {
     58            out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
     59        }
     60       
     61    out->x = transform->x->coeff[ 0 ][ 0 ][ 0 ][ 0 ] +
     62             ( transform->x->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) +
     63             ( transform->x->coeff[ 0 ][ 1 ][ 0 ][ 0 ] * coords->y ) +
     64             ( transform->x->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) +
     65             ( transform->x->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 );
     66             
     67    out->y = transform->y->coeff[ 0 ][ 0 ][ 0 ][ 0 ] +
     68             ( transform->y->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) +
     69             ( transform->y->coeff[ 0 ][ 1 ][ 0 ][ 0 ] * coords->y ) +
     70             ( transform->y->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) +
     71             ( transform->y->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 );
     72             
     73    return ( out );
    7474}
    7575
    7676
    7777// This function prototype has been modified since the SDRS.
    78 psSphereTransform *psSphereTransformAlloc(double NPlat,
     78psSphereTransform *psSphereTransformAlloc( double NPlat,
    7979        double Xo,
    80         double xo)
    81 {
    82     psSphereTransform *tmp = (psSphereTransform *) psAlloc(sizeof(psSphereTransform));
    83 
    84     tmp->sinPhi = sin(NPlat);
    85     tmp->cosPhi = cos(NPlat);
     80        double xo )
     81{
     82    psSphereTransform * tmp = ( psSphereTransform * ) psAlloc( sizeof( psSphereTransform ) );
     83   
     84    tmp->sinPhi = sin( NPlat );
     85    tmp->cosPhi = cos( NPlat );
    8686    tmp->Xo = Xo;
    8787    tmp->xo = xo;
    88 
    89     return(tmp);
     88   
     89    return ( tmp );
    9090}
    9191
    9292// I understand this one too.
    93 void p_psSphereTransformFree(psSphereTransform *trans)
    94 {
    95     psFree(trans);
     93void p_psSphereTransformFree( psSphereTransform *trans )
     94{
     95    psFree( trans );
    9696}
    9797
     
    103103// there are no typo's.
    104104
    105 psSphere *psSphereTransformApply(psSphere *out,
    106                                  const psSphereTransform *transform,
    107                                  const psSphere *coord)
     105psSphere *psSphereTransformApply( psSphere *out,
     106                                  const psSphereTransform *transform,
     107                                  const psSphere *coord )
    108108{
    109109    double sinY = 0.0;
     
    114114    double y = 0.0;
    115115    double dx = 0.0;
    116 
    117     if (out == NULL) {
    118         out = (psSphere *) psAlloc(sizeof(psSphere));
    119     }
    120 
     116   
     117    if ( out == NULL ) {
     118            out = ( psSphere * ) psAlloc( sizeof( psSphere ) );
     119        }
     120       
    121121    x = coord->r;
    122122    y = coord->d;
    123     dx    = x - transform->xo;
    124     sinY = cos(y)*sin(dx)*transform->sinPhi + sin(y)*transform->cosPhi;
    125     cosY = sqrt(1.0 - sinY*sinY);
    126     sinX = (cos(y)*sin(dx)*transform->cosPhi - sin(y)*transform->sinPhi) /
    127            cos(y);
    128     cosX = cos(y)*cos(dx) / cos(y);
    129 
    130     out->r = atan2(sinX, cosX) + transform->Xo;
    131     out->d = atan2(sinY, cosY);
    132 
    133     return(out);
    134 }
    135 
    136 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time)
    137 {
    138     struct tm *tmTime = psTimeToTM(time);
    139     double year = (double) (1900 + tmTime->tm_year);
     123    dx = x - transform->xo;
     124    sinY = cos( y ) * sin( dx ) * transform->sinPhi + sin( y ) * transform->cosPhi;
     125    cosY = sqrt( 1.0 - sinY * sinY );
     126    sinX = ( cos( y ) * sin( dx ) * transform->cosPhi - sin( y ) * transform->sinPhi ) /
     127           cos( y );
     128    cosX = cos( y ) * cos( dx ) / cos( y );
     129   
     130    out->r = atan2( sinX, cosX ) + transform->Xo;
     131    out->d = atan2( sinY, cosY );
     132   
     133    return ( out );
     134}
     135
     136psSphereTransform *psSphereTransformICRStoEcliptic( psTime time )
     137{
     138    struct tm * tmTime = psTimeToTM( time );
     139    double year = ( double ) ( 1900 + tmTime->tm_year );
    140140    double T = year / 100.0;
    141     double phi = -23.452294 + 0.013013*T + 0.000001639*T*T - 0.000000503*T*T*T;
     141    double phi = -23.452294 + 0.013013 * T + 0.000001639 * T * T - 0.000000503 * T * T * T;
    142142    double Xo = 0.0;
    143143    double xo = 0.0;
    144 
    145     return(psSphereTransformAlloc(phi, Xo, xo));
    146 }
    147 
    148 psSphereTransform *psSphereTransformEcliptictoICRS(psTime time)
    149 {
    150     struct tm *tmTime = psTimeToTM(time);
    151     double year = (double) (1900 + tmTime->tm_year);
     144   
     145    return ( psSphereTransformAlloc( phi, Xo, xo ) );
     146}
     147
     148psSphereTransform *psSphereTransformEcliptictoICRS( psTime time )
     149{
     150    struct tm * tmTime = psTimeToTM( time );
     151    double year = ( double ) ( 1900 + tmTime->tm_year );
    152152    double T = year / 100.0;
    153     double phi = +23.452294 - 0.013013*T - 0.000001639*T*T + 0.000000503*T*T*T;
     153    double phi = + 23.452294 - 0.013013 * T - 0.000001639 * T * T + 0.000000503 * T * T * T;
    154154    double Xo = 0.0;
    155155    double xo = 0.0;
    156 
    157     return(psSphereTransformAlloc(phi, Xo, xo));
    158 }
    159 
    160 psSphereTransform *psSphereTransformICRStoGalatic(void)
    161 {
    162     return(psSphereTransformAlloc(62.6, 282.25, 33.0));
    163 }
    164 
    165 psSphereTransform *psSphereTransformGalatictoICRS(void)
    166 {
    167     return(psSphereTransformAlloc(-62.6, 33.0, 282.25));
     156   
     157    return ( psSphereTransformAlloc( phi, Xo, xo ) );
     158}
     159
     160psSphereTransform *psSphereTransformICRStoGalatic( void )
     161{
     162    return ( psSphereTransformAlloc( 62.6, 282.25, 33.0 ) );
     163}
     164
     165psSphereTransform *psSphereTransformGalatictoICRS( void )
     166{
     167    return ( psSphereTransformAlloc( -62.6, 33.0, 282.25 ) );
    168168}
    169169
    170170// XXX: Is this the correct way to calculate this?
    171 float cot(float x)
    172 {
    173     return(1.0 / atan(x));
     171float cot( float x )
     172{
     173    return ( 1.0 / atan( x ) );
    174174}
    175175
    176176// This is some kind of arc tan function.
    177 float arg(float x, float y)
    178 {
    179     if (x > 0) {
    180         return(atan(y/x));
    181     } else if ((x==0) && (y==0)) {
    182         return(0.5 * M_PI);
    183     } else if ((x==0) && (y==0)) {
    184         return(-0.5 * M_PI);
    185     } else if ((x==0) && (y==0)) {
    186         return(M_PI + atan(y/x));
    187     } else if ((x==0) && (y==0)) {
    188         return(-M_PI + atan(y/x));
    189     }
    190 
    191     psAbort(__func__, "Unacceptable range for (arg(%f, %f).\n", x, y);
    192     return(0.0);
     177float arg( float x, float y )
     178{
     179    if ( x > 0 ) {
     180            return ( atan( y / x ) );
     181        } else if ( ( x == 0 ) && ( y == 0 ) ) {
     182            return ( 0.5 * M_PI );
     183        } else if ( ( x == 0 ) && ( y == 0 ) ) {
     184            return ( -0.5 * M_PI );
     185        } else if ( ( x == 0 ) && ( y == 0 ) ) {
     186            return ( M_PI + atan( y / x ) );
     187        } else if ( ( x == 0 ) && ( y == 0 ) ) {
     188            return ( -M_PI + atan( y / x ) );
     189        }
     190       
     191    psAbort( __func__, "Unacceptable range for (arg(%f, %f).\n", x, y );
     192    return ( 0.0 );
    193193}
    194194
    195195// XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    196196// XXX: Waiting for the definition of the PS_PROJ_GLS projection.
    197 psPlane *psProject(const psSphere *coord,
    198                    const psProjection *projection)
     197psPlane *psProject( const psSphere *coord,
     198                    const psProjection *projection )
    199199{
    200200    float R = 0.0;
    201201    float alpha = 0.0;
    202     psPlane *tmp= (psPlane *) psAlloc(sizeof(psPlane));
    203 
    204     if (projection->type == PS_PROJ_TAN) {
    205         R = cot(coord->r) * (180.0 / M_PI);
    206         tmp->x = R * sin(coord->d);
    207         tmp->y = R * cos(coord->d);
    208 
    209     } else if (projection->type == PS_PROJ_SIN) {
    210         R = cos(coord->r) * (180.0 / M_PI);
    211         tmp->x = R * sin(coord->d);
    212         tmp->y = R * cos(coord->d);
    213 
    214     } else if (projection->type == PS_PROJ_CAR) {
    215         tmp->x = coord->d;
    216         tmp->y = coord->r;
    217 
    218     } else if (projection->type == PS_PROJ_MER) {
    219         tmp->x = coord->d;
    220         tmp->y = log(tan(45.0 + (0.5 * coord->r))) * 180.0/M_PI;
    221 
    222     } else if (projection->type == PS_PROJ_AIT) {
    223         alpha = 1.0 / ((180.0 / M_PI) *
    224                        sqrt(1.0 + (cos(coord->r) * cos(0.5 * coord->d) * 0.5)));
    225 
    226         tmp->x = 2.0 * alpha * cos(coord->r) * sin(0.5 * coord->d);
    227         tmp->y = alpha * sin(coord->d);
    228 
    229     } else if (projection->type == PS_PROJ_PAR) {
    230         psAbort(__func__, "The projection type PS_PROJ_PAR is undefined.\n");
    231 
    232     } else if (projection->type == PS_PROJ_GLS) {
    233         psAbort(__func__, "The projection type PS_PROJ_GLS is undefined.\n");
    234     }
    235 
    236     return(tmp);
     202    psPlane *tmp = ( psPlane * ) psAlloc( sizeof( psPlane ) );
     203   
     204    if ( projection->type == PS_PROJ_TAN ) {
     205            R = cot( coord->r ) * ( 180.0 / M_PI );
     206            tmp->x = R * sin( coord->d );
     207            tmp->y = R * cos( coord->d );
     208           
     209        } else if ( projection->type == PS_PROJ_SIN ) {
     210            R = cos( coord->r ) * ( 180.0 / M_PI );
     211            tmp->x = R * sin( coord->d );
     212            tmp->y = R * cos( coord->d );
     213           
     214        } else if ( projection->type == PS_PROJ_CAR ) {
     215            tmp->x = coord->d;
     216            tmp->y = coord->r;
     217           
     218        } else if ( projection->type == PS_PROJ_MER ) {
     219            tmp->x = coord->d;
     220            tmp->y = log( tan( 45.0 + ( 0.5 * coord->r ) ) ) * 180.0 / M_PI;
     221           
     222        } else if ( projection->type == PS_PROJ_AIT ) {
     223            alpha = 1.0 / ( ( 180.0 / M_PI ) *
     224                            sqrt( 1.0 + ( cos( coord->r ) * cos( 0.5 * coord->d ) * 0.5 ) ) );
     225                           
     226            tmp->x = 2.0 * alpha * cos( coord->r ) * sin( 0.5 * coord->d );
     227            tmp->y = alpha * sin( coord->d );
     228           
     229        } else if ( projection->type == PS_PROJ_PAR ) {
     230            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
     231           
     232        } else if ( projection->type == PS_PROJ_GLS ) {
     233            psAbort( __func__, "The projection type PS_PROJ_GLS is undefined.\n" );
     234        }
     235       
     236    return ( tmp );
    237237}
    238238
    239239// XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    240240// XXX: Waiting for the definition of the PS_PROJ_GLS projection.
    241 psSphere *psDeproject(const psPlane *coord,
    242                       const psProjection *projection)
     241psSphere *psDeproject( const psPlane *coord,
     242                       const psProjection *projection )
    243243{
    244244    float R = 0.0;
     
    246246    float chu1 = 0.0;
    247247    float chu2 = 0.0;
    248     psSphere *tmp= (psSphere *) psAlloc(sizeof(psSphere));
    249 
    250     if (projection->type == PS_PROJ_TAN) {
    251         R = sqrt((coord->x * coord->x) + (coord->y * coord->y));
    252         tmp->d = arg(-coord->y, coord->x);
    253         tmp->r = atan(180.0 / (R * M_PI));
    254 
    255     } else if (projection->type == PS_PROJ_SIN) {
    256         R = sqrt((coord->x * coord->x) + (coord->y * coord->y));
    257         tmp->d = arg(-coord->y, coord->x);
    258         tmp->r = acos((R * M_PI) / 180.0);
    259 
    260     } else if (projection->type == PS_PROJ_CAR) {
    261         tmp->d = coord->x;
    262         tmp->r = coord->y;
    263 
    264     } else if (projection->type == PS_PROJ_MER) {
    265         tmp->d = coord->x;
    266         tmp->r = (2.0 * atan(exp((coord->y * M_PI/180.0)))) - 180.0;
    267 
    268     } else if (projection->type == PS_PROJ_AIT) {
    269         chu1 = (coord->x * M_PI) / 720.0;
    270         chu1*= chu1;
    271         chu2 = (coord->y * M_PI) / 360.0;
    272         chu2*= chu2;
    273         chu = sqrt(1.0 - chu1 - chu2);
    274         tmp->d = 2.0 * arg((2.0 * chu * chu) - 1.0,
    275                            (coord->x * chu * M_PI)/360.0);
    276         tmp->r = asin((coord->y * chu * M_PI) / 180.0);
    277 
    278     } else if (projection->type == PS_PROJ_PAR) {
    279         psAbort(__func__, "The projection type PS_PROJ_PAR is undefined.\n");
    280 
    281     } else if (projection->type == PS_PROJ_GLS) {
    282         psAbort(__func__, "The projection type PS_PROJ_GLG is undefined.\n");
    283     }
    284 
    285     return(tmp);
     248    psSphere *tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
     249   
     250    if ( projection->type == PS_PROJ_TAN ) {
     251            R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
     252            tmp->d = arg( -coord->y, coord->x );
     253            tmp->r = atan( 180.0 / ( R * M_PI ) );
     254           
     255        } else if ( projection->type == PS_PROJ_SIN ) {
     256            R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
     257            tmp->d = arg( -coord->y, coord->x );
     258            tmp->r = acos( ( R * M_PI ) / 180.0 );
     259           
     260        } else if ( projection->type == PS_PROJ_CAR ) {
     261            tmp->d = coord->x;
     262            tmp->r = coord->y;
     263           
     264        } else if ( projection->type == PS_PROJ_MER ) {
     265            tmp->d = coord->x;
     266            tmp->r = ( 2.0 * atan( exp( ( coord->y * M_PI / 180.0 ) ) ) ) - 180.0;
     267           
     268        } else if ( projection->type == PS_PROJ_AIT ) {
     269            chu1 = ( coord->x * M_PI ) / 720.0;
     270            chu1 *= chu1;
     271            chu2 = ( coord->y * M_PI ) / 360.0;
     272            chu2 *= chu2;
     273            chu = sqrt( 1.0 - chu1 - chu2 );
     274            tmp->d = 2.0 * arg( ( 2.0 * chu * chu ) - 1.0,
     275                                ( coord->x * chu * M_PI ) / 360.0 );
     276            tmp->r = asin( ( coord->y * chu * M_PI ) / 180.0 );
     277           
     278        } else if ( projection->type == PS_PROJ_PAR ) {
     279            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
     280           
     281        } else if ( projection->type == PS_PROJ_GLS ) {
     282            psAbort( __func__, "The projection type PS_PROJ_GLG is undefined.\n" );
     283        }
     284       
     285    return ( tmp );
    286286}
    287287
    288288// XXX: Do I need to check for unacceptable transformation parameters?
    289289// Maybe, if the points are on the North/South Pole, etc?
    290 psSphere *psSphereGetOffset(const psSphere *restrict position1,
    291                             const psSphere *restrict position2,
    292                             psSphereOffsetMode mode,
    293                             psSphereOffsetUnit unit)
     290psSphere *psSphereGetOffset( const psSphere *restrict position1,
     291                             const psSphere *restrict position2,
     292                             psSphereOffsetMode mode,
     293                             psSphereOffsetUnit unit )
    294294{
    295295    //    psPlane *lin;
     
    298298    double tmpR = 0.0;
    299299    double tmpD = 0.0;
    300 
    301     if (mode == PS_LINEAR) {
    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);
    319     } else if (mode == PS_SPHERICAL) {
    320         tmpR = position2->r - position1->r;
    321         tmpD = position2->d - position1->d;
    322 
    323         if (unit == PS_ARCSEC) {
    324             tmpR = (tmpR * 180.0 * 60.0 * 60.0) / M_PI;
    325             tmpD = (tmpR * 180.0 * 60.0 * 60.0) / M_PI;
    326         } else if (unit == PS_ARCMIN) {
    327             tmpR = (tmpR * 180.0 * 60.0) / M_PI;
    328             tmpD = (tmpR * 180.0 * 60.0) / M_PI;
    329         } else if (unit == PS_DEGREE) {
    330             tmpR = (tmpR * 180.0) / M_PI;
    331             tmpD = (tmpR * 180.0) / M_PI;
    332         } else if (unit == PS_RADIAN) {}
    333         else {
    334             psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
    335         }
    336 
    337         tmp = (psSphere *) psAlloc(sizeof(psSphere));
    338         tmp->r = tmpR;
    339         tmp->d = tmpD;
    340         tmp->rErr = 0.0;
    341         tmp->dErr = 0.0;
    342         // XXX: Do we need to wrap these to an acceptable range?
    343         return(tmp);
    344     }
    345     psAbort(__func__, "Unrecognized offset mode\n");
    346     return(NULL);
     300   
     301    if ( mode == PS_LINEAR ) {
     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 );
     319        } else if ( mode == PS_SPHERICAL ) {
     320            tmpR = position2->r - position1->r;
     321            tmpD = position2->d - position1->d;
     322           
     323            if ( unit == PS_ARCSEC ) {
     324                    tmpR = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
     325                    tmpD = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
     326                } else if ( unit == PS_ARCMIN ) {
     327                    tmpR = ( tmpR * 180.0 * 60.0 ) / M_PI;
     328                    tmpD = ( tmpR * 180.0 * 60.0 ) / M_PI;
     329                } else if ( unit == PS_DEGREE ) {
     330                    tmpR = ( tmpR * 180.0 ) / M_PI;
     331                    tmpD = ( tmpR * 180.0 ) / M_PI;
     332                } else if ( unit == PS_RADIAN ) {}
     333            else {
     334                    psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
     335                }
     336               
     337            tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
     338            tmp->r = tmpR;
     339            tmp->d = tmpD;
     340            tmp->rErr = 0.0;
     341            tmp->dErr = 0.0;
     342            // XXX: Do we need to wrap these to an acceptable range?
     343            return ( tmp );
     344        }
     345    psAbort( __func__, "Unrecognized offset mode\n" );
     346    return ( NULL );
    347347}
    348348
     
    351351// Maybe, if the points are on the North/South Pole, etc?
    352352// XXX: I copied the algorithm from the ADD exactly.
    353 psSphere *psSphereSetOffset(const psSphere *restrict position,
    354                             const psSphere *restrict offset,
    355                             psSphereOffsetMode mode,
    356                             psSphereOffsetUnit unit)
     353psSphere *psSphereSetOffset( const psSphere *restrict position,
     354                             const psSphere *restrict offset,
     355                             psSphereOffsetMode mode,
     356                             psSphereOffsetUnit unit )
    357357{
    358358    psPlane lin;
     
    361361    double tmpR = 0.0;
    362362    double tmpD = 0.0;
    363 
    364     if (mode == PS_LINEAR) {
    365         proj.R = position->r;
    366         proj.D = position->d;
    367         proj.Xs = 1.0;
    368         proj.Ys = 1.0;
    369         proj.type = PS_PROJ_TAN;
    370 
    371         lin.x = offset->r;
    372         lin.y = offset->d;
    373 
    374         tmp = psDeproject(&lin, &proj);
    375         return(tmp);
    376 
    377     } else if (mode == PS_SPHERICAL) {
    378         if (unit == PS_ARCSEC) {
    379             tmpR = (M_PI * offset->r) / (180.0 * 60.0 * 60.0);
    380             tmpD = (M_PI * offset->d) / (180.0 * 60.0 * 60.0);
    381         } else if (unit == PS_ARCMIN) {
    382             tmpR = (M_PI * offset->r) / (180.0 * 60.0);
    383             tmpD = (M_PI * offset->d) / (180.0 * 60.0);
    384         } else if (unit == PS_DEGREE) {
    385             tmpR = (M_PI * offset->r) / (180.0);
    386             tmpD = (M_PI * offset->d) / (180.0);
    387         } else if (unit == PS_RADIAN) {
    388             tmpR = offset->r;
    389             tmpD = offset->d;
    390         } else {
    391             psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
    392         }
    393 
    394         tmp = (psSphere *) psAlloc(sizeof(psSphere));
    395         tmp->r = position->r + tmpR;
    396         tmp->r = position->d + tmpD;
    397         tmp->rErr = 0.0;
    398         tmp->dErr = 0.0;
    399 
    400         // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)
    401         // and (0 to 2*PI).
    402         return(tmp);
    403     }
    404     psAbort(__func__, "Unrecognized offset mode\n");
    405     return(NULL);
    406 }
     363   
     364    if ( mode == PS_LINEAR ) {
     365            proj.R = position->r;
     366            proj.D = position->d;
     367            proj.Xs = 1.0;
     368            proj.Ys = 1.0;
     369            proj.type = PS_PROJ_TAN;
     370           
     371            lin.x = offset->r;
     372            lin.y = offset->d;
     373           
     374            tmp = psDeproject( &lin, &proj );
     375            return ( tmp );
     376           
     377        } else if ( mode == PS_SPHERICAL ) {
     378            if ( unit == PS_ARCSEC ) {
     379                    tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 * 60.0 );
     380                    tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 * 60.0 );
     381                } else if ( unit == PS_ARCMIN ) {
     382                    tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 );
     383                    tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 );
     384                } else if ( unit == PS_DEGREE ) {
     385                    tmpR = ( M_PI * offset->r ) / ( 180.0 );
     386                    tmpD = ( M_PI * offset->d ) / ( 180.0 );
     387                } else if ( unit == PS_RADIAN ) {
     388                    tmpR = offset->r;
     389                    tmpD = offset->d;
     390                } else {
     391                    psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
     392                }
     393               
     394            tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
     395            tmp->r = position->r + tmpR;
     396            tmp->r = position->d + tmpD;
     397            tmp->rErr = 0.0;
     398            tmp->dErr = 0.0;
     399           
     400            // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)
     401            // and (0 to 2*PI).
     402            return ( tmp );
     403        }
     404    psAbort( __func__, "Unrecognized offset mode\n" );
     405    return ( NULL );
     406}
  • trunk/psLib/src/astro/psCoord.h

    r1325 r1374  
    11/** @file  psCoord.h
    2  *
    3  *  @brief Contains basic coordinate transformation definitions and operations
    4  *
    5  *  This file defines the basic types for astronomical coordinate
    6  *  transformation
    7  *
    8  *  @ingroup AstroImage
    9  *
    10  *  @author George Gusciora, MHPCC
    11  *
    12  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-07-29 02:08:02 $
    14  *
    15  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    16  */
     2*
     3*  @brief Contains basic coordinate transformation definitions and operations
     4*
     5*  This file defines the basic types for astronomical coordinate
     6*  transformation
     7*
     8*  @ingroup CoordinateTransform
     9*
     10*  @author George Gusciora, MHPCC
     11*
     12*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-04 00:55:17 $
     14*
     15*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     16*/
    1717
    1818# ifndef PS_COORD_H
     
    2626#include "psTime.h"
    2727
     28/// @addtogroup CoordinateTransform
     29/// @{
     30
    2831typedef struct
    29 {
    30     double x;      ///< x position
    31     double y;      ///< y position
    32     double xErr;   ///< Error in x position
    33     double yErr;   ///< Error in y position
    34 }
     32    {
     33        double x;      ///< x position
     34        double y;      ///< y position
     35        double xErr;   ///< Error in x position
     36        double yErr;   ///< Error in y position
     37    }
    3538psPlane;
    3639
    3740typedef struct
    38 {
    39     double r;      ///< RA
    40     double d;      ///< Dec
    41     double rErr;   ///< Error in RA
    42     double dErr;   ///< Error in Dec
    43 }
     41    {
     42        double r;      ///< RA
     43        double d;      ///< Dec
     44        double rErr;   ///< Error in RA
     45        double dErr;   ///< Error in Dec
     46    }
    4447psSphere;
    4548
    4649typedef struct
    47 {
    48     psDPolynomial2D *x;
    49     psDPolynomial2D *y;
    50 }
     50    {
     51        psDPolynomial2D *x;
     52        psDPolynomial2D *y;
     53    }
    5154psPlaneTransform;
    5255
    5356typedef struct
    54 {
    55     psDPolynomial4D *x;
    56     psDPolynomial4D *y;
    57 }
     57    {
     58        psDPolynomial4D *x;
     59        psDPolynomial4D *y;
     60    }
    5861psPlaneDistort;
    5962
    6063typedef struct
    61 {
    62     double sinPhi;                    ///< sin of North Pole lattitude
    63     double cosPhi;                    ///< cos of North Pole lattitude
    64     double Xo;                        ///< First PT of Ares lon
    65     double xo;                        ///< First PT of Ares equiv lon
    66 }
     64    {
     65        double sinPhi;                    ///< sin of North Pole lattitude
     66        double cosPhi;                    ///< cos of North Pole lattitude
     67        double Xo;                        ///< First PT of Ares lon
     68        double xo;                        ///< First PT of Ares equiv lon
     69    }
    6770psSphereTransform;
    6871
    6972typedef enum {
    70     PS_PROJ_TAN,       ///< Tangent projection
    71     PS_PROJ_SIN,       ///< Sine projection
    72     PS_PROJ_AIT,       ///< Aitoff projection
    73     PS_PROJ_PAR,       ///< Par projection
    74     PS_PROJ_GLS,       ///< GLS projection
    75     PS_PROJ_CAR,       ///< CAR projection
    76     PS_PROJ_MER,       ///< MER projection
     73    PS_PROJ_TAN,        ///< Tangent projection
     74    PS_PROJ_SIN,        ///< Sine projection
     75    PS_PROJ_AIT,        ///< Aitoff projection
     76    PS_PROJ_PAR,        ///< Par projection
     77    PS_PROJ_GLS,        ///< GLS projection
     78    PS_PROJ_CAR,        ///< CAR projection
     79    PS_PROJ_MER,        ///< MER projection
    7780    PS_PROJ_NTYPE      ///< Number of types; must be last.
    7881} psProjectionType;
    7982
    8083typedef struct
    81 {
    82     double R;     ///< Coordinates of projection center
    83     double D;     ///< Coordinates of projection center
    84     double Xs;    ///< plate-scale in X direction
    85     double Ys;    ///< plate-scale in Y direction
    86     psProjectionType type;  ///< Projection type
    87 }
     84    {
     85        double R;     ///< Coordinates of projection center
     86        double D;     ///< Coordinates of projection center
     87        double Xs;    ///< plate-scale in X direction
     88        double Ys;    ///< plate-scale in Y direction
     89        psProjectionType type;  ///< Projection type
     90    }
    8891psProjection;
    8992
     
    100103} psSphereOffsetUnit;
    101104
    102 psPlane *psPlaneTransformApply(psPlane *out,
    103                                const psPlaneTransform *transform,
    104                                const psPlane *coords);
     105psPlane *psPlaneTransformApply( psPlane *out,
     106                                const psPlaneTransform *transform,
     107                                const psPlane *coords );
     108                               
     109psPlane *psPlaneDistortApply( psPlane *out,
     110                              const psPlaneDistort *transform,
     111                              const psPlane *coords,
     112                              float term3,
     113                              float term4 );
     114                             
     115                             
     116// New function prototype.
     117psSphereTransform *psSphereTransformAlloc( double NPlat,
     118        double Xo,
     119        double xo );
     120       
     121void p_psSphereTransformFree( psSphereTransform *trans );
    105122
    106 psPlane *psPlaneDistortApply(psPlane *out,
    107                              const psPlaneDistort *transform,
    108                              const psPlane *coords,
    109                              float term3,
    110                              float term4);
     123psSphere *psSphereTransformApply( psSphere *out,
     124                                  const psSphereTransform *transform,
     125                                  const psSphere *coord );
     126                                 
     127psSphereTransform *psSphereTransformICRStoEcliptic( psTime time );
     128psSphereTransform *psSphereTransformEcliptictoICRS( psTime time );
     129psSphereTransform *psSphereTransformICRStoGalatic( void );
     130psSphereTransform *psSphereTransformGalatictoICRS( void );
    111131
    112 
    113 // New function prototype.
    114 psSphereTransform *psSphereTransformAlloc(double NPlat,
    115         double Xo,
    116         double xo);
    117 
    118 void p_psSphereTransformFree(psSphereTransform *trans);
    119 
    120 psSphere *psSphereTransformApply(psSphere *out,
    121                                  const psSphereTransform *transform,
    122                                  const psSphere *coord);
    123 
    124 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time);
    125 psSphereTransform *psSphereTransformEcliptictoICRS(psTime time);
    126 psSphereTransform *psSphereTransformICRStoGalatic(void);
    127 psSphereTransform *psSphereTransformGalatictoICRS(void);
    128 
    129 psPlane *psProject(const psSphere *coord,
    130                    const psProjection *projection);
    131 
    132 psSphere *psDeproject(const psPlane *coord,
    133                       const psProjection *projection);
    134 
    135 psSphere *psSphereGetOffset(const psSphere *restrict position1,
    136                             const psSphere *restrict position2,
    137                             psSphereOffsetMode mode,
    138                             psSphereOffsetUnit unit);
    139 
    140 psSphere *psSphereSetOffset(const psSphere *restrict position,
    141                             const psSphere *restrict offset,
    142                             psSphereOffsetMode mode,
    143                             psSphereOffsetUnit unit);
    144 
     132psPlane *psProject( const psSphere *coord,
     133                    const psProjection *projection );
     134                   
     135psSphere *psDeproject( const psPlane *coord,
     136                       const psProjection *projection );
     137                       
     138psSphere *psSphereGetOffset( const psSphere *restrict position1,
     139                             const psSphere *restrict position2,
     140                             psSphereOffsetMode mode,
     141                             psSphereOffsetUnit unit );
     142                             
     143psSphere *psSphereSetOffset( const psSphere *restrict position,
     144                             const psSphere *restrict offset,
     145                             psSphereOffsetMode mode,
     146                             psSphereOffsetUnit unit );
     147                             
     148/// @}
    145149
    146150#endif
  • trunk/psLib/src/astronomy/psCoord.c

    r1325 r1374  
    11/** @file  psCoord.c
    2  *
    3  *  @brief Contains basic coordinate transformation definitions and operations
    4  *
    5  *  This file defines the basic types for astronomical coordinate
    6  *  transformation
    7  *
    8  *  @ingroup AstroImage
    9  *
    10  *  @author George Gusciora, MHPCC
    11  *
    12  *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-07-29 02:08:02 $
    14  *
    15  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    16  */
     2*
     3*  @brief Contains basic coordinate transformation definitions and operations
     4*
     5*  This file defines the basic types for astronomical coordinate
     6*  transformation
     7*
     8*  @ingroup CoordinateTransform
     9*
     10*  @author George Gusciora, MHPCC
     11*
     12*  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-04 00:55:17 $
     14*
     15*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     16*/
    1717
    1818#include "psType.h"
     
    2828
    2929// This is the only function in this file which I understand.
    30 psPlane *psPlaneTransformApply(psPlane *out,
    31                                const psPlaneTransform *transform,
    32                                const psPlane *coords)
    33 {
    34     if (out == NULL) {
    35         out = (psPlane *) psAlloc(sizeof(psPlane));
    36     }
    37     out->x = transform->x->coeff[0][0] +
    38              (transform->x->coeff[1][0] * coords->x) +
    39              (transform->x->coeff[0][1] * coords->y);
    40 
    41     out->y = transform->y->coeff[0][0] +
    42              (transform->y->coeff[1][0] * coords->x) +
    43              (transform->y->coeff[0][1] * coords->y);
    44 
    45     return(out);
     30psPlane *psPlaneTransformApply( psPlane *out,
     31                                const psPlaneTransform *transform,
     32                                const psPlane *coords )
     33{
     34    if ( out == NULL ) {
     35            out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
     36        }
     37    out->x = transform->x->coeff[ 0 ][ 0 ] +
     38             ( transform->x->coeff[ 1 ][ 0 ] * coords->x ) +
     39             ( transform->x->coeff[ 0 ][ 1 ] * coords->y );
     40             
     41    out->y = transform->y->coeff[ 0 ][ 0 ] +
     42             ( transform->y->coeff[ 1 ][ 0 ] * coords->x ) +
     43             ( transform->y->coeff[ 0 ][ 1 ] * coords->y );
     44             
     45    return ( out );
    4646}
    4747
     
    4949// This transformation takes into account parameters beyond an objects
    5050// spatial coordinates: term3 and term4.
    51 psPlane *psPlaneDistortApply(psPlane *out,
    52                              const psPlaneDistort *transform,
    53                              const psPlane *coords,
    54                              float term3,
    55                              float term4)
    56 {
    57     if (out == NULL) {
    58         out = (psPlane *) psAlloc(sizeof(psPlane));
    59     }
    60 
    61     out->x = transform->x->coeff[0][0][0][0] +
    62              (transform->x->coeff[1][0][0][0] * coords->x) +
    63              (transform->x->coeff[0][1][0][0] * coords->y) +
    64              (transform->x->coeff[0][0][1][0] * term3) +
    65              (transform->x->coeff[0][0][0][1] * term4);
    66 
    67     out->y = transform->y->coeff[0][0][0][0] +
    68              (transform->y->coeff[1][0][0][0] * coords->x) +
    69              (transform->y->coeff[0][1][0][0] * coords->y) +
    70              (transform->y->coeff[0][0][1][0] * term3) +
    71              (transform->y->coeff[0][0][0][1] * term4);
    72 
    73     return(out);
     51psPlane *psPlaneDistortApply( psPlane *out,
     52                              const psPlaneDistort *transform,
     53                              const psPlane *coords,
     54                              float term3,
     55                              float term4 )
     56{
     57    if ( out == NULL ) {
     58            out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
     59        }
     60       
     61    out->x = transform->x->coeff[ 0 ][ 0 ][ 0 ][ 0 ] +
     62             ( transform->x->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) +
     63             ( transform->x->coeff[ 0 ][ 1 ][ 0 ][ 0 ] * coords->y ) +
     64             ( transform->x->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) +
     65             ( transform->x->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 );
     66             
     67    out->y = transform->y->coeff[ 0 ][ 0 ][ 0 ][ 0 ] +
     68             ( transform->y->coeff[ 1 ][ 0 ][ 0 ][ 0 ] * coords->x ) +
     69             ( transform->y->coeff[ 0 ][ 1 ][ 0 ][ 0 ] * coords->y ) +
     70             ( transform->y->coeff[ 0 ][ 0 ][ 1 ][ 0 ] * term3 ) +
     71             ( transform->y->coeff[ 0 ][ 0 ][ 0 ][ 1 ] * term4 );
     72             
     73    return ( out );
    7474}
    7575
    7676
    7777// This function prototype has been modified since the SDRS.
    78 psSphereTransform *psSphereTransformAlloc(double NPlat,
     78psSphereTransform *psSphereTransformAlloc( double NPlat,
    7979        double Xo,
    80         double xo)
    81 {
    82     psSphereTransform *tmp = (psSphereTransform *) psAlloc(sizeof(psSphereTransform));
    83 
    84     tmp->sinPhi = sin(NPlat);
    85     tmp->cosPhi = cos(NPlat);
     80        double xo )
     81{
     82    psSphereTransform * tmp = ( psSphereTransform * ) psAlloc( sizeof( psSphereTransform ) );
     83   
     84    tmp->sinPhi = sin( NPlat );
     85    tmp->cosPhi = cos( NPlat );
    8686    tmp->Xo = Xo;
    8787    tmp->xo = xo;
    88 
    89     return(tmp);
     88   
     89    return ( tmp );
    9090}
    9191
    9292// I understand this one too.
    93 void p_psSphereTransformFree(psSphereTransform *trans)
    94 {
    95     psFree(trans);
     93void p_psSphereTransformFree( psSphereTransform *trans )
     94{
     95    psFree( trans );
    9696}
    9797
     
    103103// there are no typo's.
    104104
    105 psSphere *psSphereTransformApply(psSphere *out,
    106                                  const psSphereTransform *transform,
    107                                  const psSphere *coord)
     105psSphere *psSphereTransformApply( psSphere *out,
     106                                  const psSphereTransform *transform,
     107                                  const psSphere *coord )
    108108{
    109109    double sinY = 0.0;
     
    114114    double y = 0.0;
    115115    double dx = 0.0;
    116 
    117     if (out == NULL) {
    118         out = (psSphere *) psAlloc(sizeof(psSphere));
    119     }
    120 
     116   
     117    if ( out == NULL ) {
     118            out = ( psSphere * ) psAlloc( sizeof( psSphere ) );
     119        }
     120       
    121121    x = coord->r;
    122122    y = coord->d;
    123     dx    = x - transform->xo;
    124     sinY = cos(y)*sin(dx)*transform->sinPhi + sin(y)*transform->cosPhi;
    125     cosY = sqrt(1.0 - sinY*sinY);
    126     sinX = (cos(y)*sin(dx)*transform->cosPhi - sin(y)*transform->sinPhi) /
    127            cos(y);
    128     cosX = cos(y)*cos(dx) / cos(y);
    129 
    130     out->r = atan2(sinX, cosX) + transform->Xo;
    131     out->d = atan2(sinY, cosY);
    132 
    133     return(out);
    134 }
    135 
    136 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time)
    137 {
    138     struct tm *tmTime = psTimeToTM(time);
    139     double year = (double) (1900 + tmTime->tm_year);
     123    dx = x - transform->xo;
     124    sinY = cos( y ) * sin( dx ) * transform->sinPhi + sin( y ) * transform->cosPhi;
     125    cosY = sqrt( 1.0 - sinY * sinY );
     126    sinX = ( cos( y ) * sin( dx ) * transform->cosPhi - sin( y ) * transform->sinPhi ) /
     127           cos( y );
     128    cosX = cos( y ) * cos( dx ) / cos( y );
     129   
     130    out->r = atan2( sinX, cosX ) + transform->Xo;
     131    out->d = atan2( sinY, cosY );
     132   
     133    return ( out );
     134}
     135
     136psSphereTransform *psSphereTransformICRStoEcliptic( psTime time )
     137{
     138    struct tm * tmTime = psTimeToTM( time );
     139    double year = ( double ) ( 1900 + tmTime->tm_year );
    140140    double T = year / 100.0;
    141     double phi = -23.452294 + 0.013013*T + 0.000001639*T*T - 0.000000503*T*T*T;
     141    double phi = -23.452294 + 0.013013 * T + 0.000001639 * T * T - 0.000000503 * T * T * T;
    142142    double Xo = 0.0;
    143143    double xo = 0.0;
    144 
    145     return(psSphereTransformAlloc(phi, Xo, xo));
    146 }
    147 
    148 psSphereTransform *psSphereTransformEcliptictoICRS(psTime time)
    149 {
    150     struct tm *tmTime = psTimeToTM(time);
    151     double year = (double) (1900 + tmTime->tm_year);
     144   
     145    return ( psSphereTransformAlloc( phi, Xo, xo ) );
     146}
     147
     148psSphereTransform *psSphereTransformEcliptictoICRS( psTime time )
     149{
     150    struct tm * tmTime = psTimeToTM( time );
     151    double year = ( double ) ( 1900 + tmTime->tm_year );
    152152    double T = year / 100.0;
    153     double phi = +23.452294 - 0.013013*T - 0.000001639*T*T + 0.000000503*T*T*T;
     153    double phi = + 23.452294 - 0.013013 * T - 0.000001639 * T * T + 0.000000503 * T * T * T;
    154154    double Xo = 0.0;
    155155    double xo = 0.0;
    156 
    157     return(psSphereTransformAlloc(phi, Xo, xo));
    158 }
    159 
    160 psSphereTransform *psSphereTransformICRStoGalatic(void)
    161 {
    162     return(psSphereTransformAlloc(62.6, 282.25, 33.0));
    163 }
    164 
    165 psSphereTransform *psSphereTransformGalatictoICRS(void)
    166 {
    167     return(psSphereTransformAlloc(-62.6, 33.0, 282.25));
     156   
     157    return ( psSphereTransformAlloc( phi, Xo, xo ) );
     158}
     159
     160psSphereTransform *psSphereTransformICRStoGalatic( void )
     161{
     162    return ( psSphereTransformAlloc( 62.6, 282.25, 33.0 ) );
     163}
     164
     165psSphereTransform *psSphereTransformGalatictoICRS( void )
     166{
     167    return ( psSphereTransformAlloc( -62.6, 33.0, 282.25 ) );
    168168}
    169169
    170170// XXX: Is this the correct way to calculate this?
    171 float cot(float x)
    172 {
    173     return(1.0 / atan(x));
     171float cot( float x )
     172{
     173    return ( 1.0 / atan( x ) );
    174174}
    175175
    176176// This is some kind of arc tan function.
    177 float arg(float x, float y)
    178 {
    179     if (x > 0) {
    180         return(atan(y/x));
    181     } else if ((x==0) && (y==0)) {
    182         return(0.5 * M_PI);
    183     } else if ((x==0) && (y==0)) {
    184         return(-0.5 * M_PI);
    185     } else if ((x==0) && (y==0)) {
    186         return(M_PI + atan(y/x));
    187     } else if ((x==0) && (y==0)) {
    188         return(-M_PI + atan(y/x));
    189     }
    190 
    191     psAbort(__func__, "Unacceptable range for (arg(%f, %f).\n", x, y);
    192     return(0.0);
     177float arg( float x, float y )
     178{
     179    if ( x > 0 ) {
     180            return ( atan( y / x ) );
     181        } else if ( ( x == 0 ) && ( y == 0 ) ) {
     182            return ( 0.5 * M_PI );
     183        } else if ( ( x == 0 ) && ( y == 0 ) ) {
     184            return ( -0.5 * M_PI );
     185        } else if ( ( x == 0 ) && ( y == 0 ) ) {
     186            return ( M_PI + atan( y / x ) );
     187        } else if ( ( x == 0 ) && ( y == 0 ) ) {
     188            return ( -M_PI + atan( y / x ) );
     189        }
     190       
     191    psAbort( __func__, "Unacceptable range for (arg(%f, %f).\n", x, y );
     192    return ( 0.0 );
    193193}
    194194
    195195// XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    196196// XXX: Waiting for the definition of the PS_PROJ_GLS projection.
    197 psPlane *psProject(const psSphere *coord,
    198                    const psProjection *projection)
     197psPlane *psProject( const psSphere *coord,
     198                    const psProjection *projection )
    199199{
    200200    float R = 0.0;
    201201    float alpha = 0.0;
    202     psPlane *tmp= (psPlane *) psAlloc(sizeof(psPlane));
    203 
    204     if (projection->type == PS_PROJ_TAN) {
    205         R = cot(coord->r) * (180.0 / M_PI);
    206         tmp->x = R * sin(coord->d);
    207         tmp->y = R * cos(coord->d);
    208 
    209     } else if (projection->type == PS_PROJ_SIN) {
    210         R = cos(coord->r) * (180.0 / M_PI);
    211         tmp->x = R * sin(coord->d);
    212         tmp->y = R * cos(coord->d);
    213 
    214     } else if (projection->type == PS_PROJ_CAR) {
    215         tmp->x = coord->d;
    216         tmp->y = coord->r;
    217 
    218     } else if (projection->type == PS_PROJ_MER) {
    219         tmp->x = coord->d;
    220         tmp->y = log(tan(45.0 + (0.5 * coord->r))) * 180.0/M_PI;
    221 
    222     } else if (projection->type == PS_PROJ_AIT) {
    223         alpha = 1.0 / ((180.0 / M_PI) *
    224                        sqrt(1.0 + (cos(coord->r) * cos(0.5 * coord->d) * 0.5)));
    225 
    226         tmp->x = 2.0 * alpha * cos(coord->r) * sin(0.5 * coord->d);
    227         tmp->y = alpha * sin(coord->d);
    228 
    229     } else if (projection->type == PS_PROJ_PAR) {
    230         psAbort(__func__, "The projection type PS_PROJ_PAR is undefined.\n");
    231 
    232     } else if (projection->type == PS_PROJ_GLS) {
    233         psAbort(__func__, "The projection type PS_PROJ_GLS is undefined.\n");
    234     }
    235 
    236     return(tmp);
     202    psPlane *tmp = ( psPlane * ) psAlloc( sizeof( psPlane ) );
     203   
     204    if ( projection->type == PS_PROJ_TAN ) {
     205            R = cot( coord->r ) * ( 180.0 / M_PI );
     206            tmp->x = R * sin( coord->d );
     207            tmp->y = R * cos( coord->d );
     208           
     209        } else if ( projection->type == PS_PROJ_SIN ) {
     210            R = cos( coord->r ) * ( 180.0 / M_PI );
     211            tmp->x = R * sin( coord->d );
     212            tmp->y = R * cos( coord->d );
     213           
     214        } else if ( projection->type == PS_PROJ_CAR ) {
     215            tmp->x = coord->d;
     216            tmp->y = coord->r;
     217           
     218        } else if ( projection->type == PS_PROJ_MER ) {
     219            tmp->x = coord->d;
     220            tmp->y = log( tan( 45.0 + ( 0.5 * coord->r ) ) ) * 180.0 / M_PI;
     221           
     222        } else if ( projection->type == PS_PROJ_AIT ) {
     223            alpha = 1.0 / ( ( 180.0 / M_PI ) *
     224                            sqrt( 1.0 + ( cos( coord->r ) * cos( 0.5 * coord->d ) * 0.5 ) ) );
     225                           
     226            tmp->x = 2.0 * alpha * cos( coord->r ) * sin( 0.5 * coord->d );
     227            tmp->y = alpha * sin( coord->d );
     228           
     229        } else if ( projection->type == PS_PROJ_PAR ) {
     230            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
     231           
     232        } else if ( projection->type == PS_PROJ_GLS ) {
     233            psAbort( __func__, "The projection type PS_PROJ_GLS is undefined.\n" );
     234        }
     235       
     236    return ( tmp );
    237237}
    238238
    239239// XXX: Waiting for the definition of the PS_PROJ_PAR projection.
    240240// XXX: Waiting for the definition of the PS_PROJ_GLS projection.
    241 psSphere *psDeproject(const psPlane *coord,
    242                       const psProjection *projection)
     241psSphere *psDeproject( const psPlane *coord,
     242                       const psProjection *projection )
    243243{
    244244    float R = 0.0;
     
    246246    float chu1 = 0.0;
    247247    float chu2 = 0.0;
    248     psSphere *tmp= (psSphere *) psAlloc(sizeof(psSphere));
    249 
    250     if (projection->type == PS_PROJ_TAN) {
    251         R = sqrt((coord->x * coord->x) + (coord->y * coord->y));
    252         tmp->d = arg(-coord->y, coord->x);
    253         tmp->r = atan(180.0 / (R * M_PI));
    254 
    255     } else if (projection->type == PS_PROJ_SIN) {
    256         R = sqrt((coord->x * coord->x) + (coord->y * coord->y));
    257         tmp->d = arg(-coord->y, coord->x);
    258         tmp->r = acos((R * M_PI) / 180.0);
    259 
    260     } else if (projection->type == PS_PROJ_CAR) {
    261         tmp->d = coord->x;
    262         tmp->r = coord->y;
    263 
    264     } else if (projection->type == PS_PROJ_MER) {
    265         tmp->d = coord->x;
    266         tmp->r = (2.0 * atan(exp((coord->y * M_PI/180.0)))) - 180.0;
    267 
    268     } else if (projection->type == PS_PROJ_AIT) {
    269         chu1 = (coord->x * M_PI) / 720.0;
    270         chu1*= chu1;
    271         chu2 = (coord->y * M_PI) / 360.0;
    272         chu2*= chu2;
    273         chu = sqrt(1.0 - chu1 - chu2);
    274         tmp->d = 2.0 * arg((2.0 * chu * chu) - 1.0,
    275                            (coord->x * chu * M_PI)/360.0);
    276         tmp->r = asin((coord->y * chu * M_PI) / 180.0);
    277 
    278     } else if (projection->type == PS_PROJ_PAR) {
    279         psAbort(__func__, "The projection type PS_PROJ_PAR is undefined.\n");
    280 
    281     } else if (projection->type == PS_PROJ_GLS) {
    282         psAbort(__func__, "The projection type PS_PROJ_GLG is undefined.\n");
    283     }
    284 
    285     return(tmp);
     248    psSphere *tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
     249   
     250    if ( projection->type == PS_PROJ_TAN ) {
     251            R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
     252            tmp->d = arg( -coord->y, coord->x );
     253            tmp->r = atan( 180.0 / ( R * M_PI ) );
     254           
     255        } else if ( projection->type == PS_PROJ_SIN ) {
     256            R = sqrt( ( coord->x * coord->x ) + ( coord->y * coord->y ) );
     257            tmp->d = arg( -coord->y, coord->x );
     258            tmp->r = acos( ( R * M_PI ) / 180.0 );
     259           
     260        } else if ( projection->type == PS_PROJ_CAR ) {
     261            tmp->d = coord->x;
     262            tmp->r = coord->y;
     263           
     264        } else if ( projection->type == PS_PROJ_MER ) {
     265            tmp->d = coord->x;
     266            tmp->r = ( 2.0 * atan( exp( ( coord->y * M_PI / 180.0 ) ) ) ) - 180.0;
     267           
     268        } else if ( projection->type == PS_PROJ_AIT ) {
     269            chu1 = ( coord->x * M_PI ) / 720.0;
     270            chu1 *= chu1;
     271            chu2 = ( coord->y * M_PI ) / 360.0;
     272            chu2 *= chu2;
     273            chu = sqrt( 1.0 - chu1 - chu2 );
     274            tmp->d = 2.0 * arg( ( 2.0 * chu * chu ) - 1.0,
     275                                ( coord->x * chu * M_PI ) / 360.0 );
     276            tmp->r = asin( ( coord->y * chu * M_PI ) / 180.0 );
     277           
     278        } else if ( projection->type == PS_PROJ_PAR ) {
     279            psAbort( __func__, "The projection type PS_PROJ_PAR is undefined.\n" );
     280           
     281        } else if ( projection->type == PS_PROJ_GLS ) {
     282            psAbort( __func__, "The projection type PS_PROJ_GLG is undefined.\n" );
     283        }
     284       
     285    return ( tmp );
    286286}
    287287
    288288// XXX: Do I need to check for unacceptable transformation parameters?
    289289// Maybe, if the points are on the North/South Pole, etc?
    290 psSphere *psSphereGetOffset(const psSphere *restrict position1,
    291                             const psSphere *restrict position2,
    292                             psSphereOffsetMode mode,
    293                             psSphereOffsetUnit unit)
     290psSphere *psSphereGetOffset( const psSphere *restrict position1,
     291                             const psSphere *restrict position2,
     292                             psSphereOffsetMode mode,
     293                             psSphereOffsetUnit unit )
    294294{
    295295    //    psPlane *lin;
     
    298298    double tmpR = 0.0;
    299299    double tmpD = 0.0;
    300 
    301     if (mode == PS_LINEAR) {
    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);
    319     } else if (mode == PS_SPHERICAL) {
    320         tmpR = position2->r - position1->r;
    321         tmpD = position2->d - position1->d;
    322 
    323         if (unit == PS_ARCSEC) {
    324             tmpR = (tmpR * 180.0 * 60.0 * 60.0) / M_PI;
    325             tmpD = (tmpR * 180.0 * 60.0 * 60.0) / M_PI;
    326         } else if (unit == PS_ARCMIN) {
    327             tmpR = (tmpR * 180.0 * 60.0) / M_PI;
    328             tmpD = (tmpR * 180.0 * 60.0) / M_PI;
    329         } else if (unit == PS_DEGREE) {
    330             tmpR = (tmpR * 180.0) / M_PI;
    331             tmpD = (tmpR * 180.0) / M_PI;
    332         } else if (unit == PS_RADIAN) {}
    333         else {
    334             psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
    335         }
    336 
    337         tmp = (psSphere *) psAlloc(sizeof(psSphere));
    338         tmp->r = tmpR;
    339         tmp->d = tmpD;
    340         tmp->rErr = 0.0;
    341         tmp->dErr = 0.0;
    342         // XXX: Do we need to wrap these to an acceptable range?
    343         return(tmp);
    344     }
    345     psAbort(__func__, "Unrecognized offset mode\n");
    346     return(NULL);
     300   
     301    if ( mode == PS_LINEAR ) {
     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 );
     319        } else if ( mode == PS_SPHERICAL ) {
     320            tmpR = position2->r - position1->r;
     321            tmpD = position2->d - position1->d;
     322           
     323            if ( unit == PS_ARCSEC ) {
     324                    tmpR = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
     325                    tmpD = ( tmpR * 180.0 * 60.0 * 60.0 ) / M_PI;
     326                } else if ( unit == PS_ARCMIN ) {
     327                    tmpR = ( tmpR * 180.0 * 60.0 ) / M_PI;
     328                    tmpD = ( tmpR * 180.0 * 60.0 ) / M_PI;
     329                } else if ( unit == PS_DEGREE ) {
     330                    tmpR = ( tmpR * 180.0 ) / M_PI;
     331                    tmpD = ( tmpR * 180.0 ) / M_PI;
     332                } else if ( unit == PS_RADIAN ) {}
     333            else {
     334                    psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
     335                }
     336               
     337            tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
     338            tmp->r = tmpR;
     339            tmp->d = tmpD;
     340            tmp->rErr = 0.0;
     341            tmp->dErr = 0.0;
     342            // XXX: Do we need to wrap these to an acceptable range?
     343            return ( tmp );
     344        }
     345    psAbort( __func__, "Unrecognized offset mode\n" );
     346    return ( NULL );
    347347}
    348348
     
    351351// Maybe, if the points are on the North/South Pole, etc?
    352352// XXX: I copied the algorithm from the ADD exactly.
    353 psSphere *psSphereSetOffset(const psSphere *restrict position,
    354                             const psSphere *restrict offset,
    355                             psSphereOffsetMode mode,
    356                             psSphereOffsetUnit unit)
     353psSphere *psSphereSetOffset( const psSphere *restrict position,
     354                             const psSphere *restrict offset,
     355                             psSphereOffsetMode mode,
     356                             psSphereOffsetUnit unit )
    357357{
    358358    psPlane lin;
     
    361361    double tmpR = 0.0;
    362362    double tmpD = 0.0;
    363 
    364     if (mode == PS_LINEAR) {
    365         proj.R = position->r;
    366         proj.D = position->d;
    367         proj.Xs = 1.0;
    368         proj.Ys = 1.0;
    369         proj.type = PS_PROJ_TAN;
    370 
    371         lin.x = offset->r;
    372         lin.y = offset->d;
    373 
    374         tmp = psDeproject(&lin, &proj);
    375         return(tmp);
    376 
    377     } else if (mode == PS_SPHERICAL) {
    378         if (unit == PS_ARCSEC) {
    379             tmpR = (M_PI * offset->r) / (180.0 * 60.0 * 60.0);
    380             tmpD = (M_PI * offset->d) / (180.0 * 60.0 * 60.0);
    381         } else if (unit == PS_ARCMIN) {
    382             tmpR = (M_PI * offset->r) / (180.0 * 60.0);
    383             tmpD = (M_PI * offset->d) / (180.0 * 60.0);
    384         } else if (unit == PS_DEGREE) {
    385             tmpR = (M_PI * offset->r) / (180.0);
    386             tmpD = (M_PI * offset->d) / (180.0);
    387         } else if (unit == PS_RADIAN) {
    388             tmpR = offset->r;
    389             tmpD = offset->d;
    390         } else {
    391             psAbort(__func__, "Unknown offset unit: 0x%x\n", unit);
    392         }
    393 
    394         tmp = (psSphere *) psAlloc(sizeof(psSphere));
    395         tmp->r = position->r + tmpR;
    396         tmp->r = position->d + tmpD;
    397         tmp->rErr = 0.0;
    398         tmp->dErr = 0.0;
    399 
    400         // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)
    401         // and (0 to 2*PI).
    402         return(tmp);
    403     }
    404     psAbort(__func__, "Unrecognized offset mode\n");
    405     return(NULL);
    406 }
     363   
     364    if ( mode == PS_LINEAR ) {
     365            proj.R = position->r;
     366            proj.D = position->d;
     367            proj.Xs = 1.0;
     368            proj.Ys = 1.0;
     369            proj.type = PS_PROJ_TAN;
     370           
     371            lin.x = offset->r;
     372            lin.y = offset->d;
     373           
     374            tmp = psDeproject( &lin, &proj );
     375            return ( tmp );
     376           
     377        } else if ( mode == PS_SPHERICAL ) {
     378            if ( unit == PS_ARCSEC ) {
     379                    tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 * 60.0 );
     380                    tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 * 60.0 );
     381                } else if ( unit == PS_ARCMIN ) {
     382                    tmpR = ( M_PI * offset->r ) / ( 180.0 * 60.0 );
     383                    tmpD = ( M_PI * offset->d ) / ( 180.0 * 60.0 );
     384                } else if ( unit == PS_DEGREE ) {
     385                    tmpR = ( M_PI * offset->r ) / ( 180.0 );
     386                    tmpD = ( M_PI * offset->d ) / ( 180.0 );
     387                } else if ( unit == PS_RADIAN ) {
     388                    tmpR = offset->r;
     389                    tmpD = offset->d;
     390                } else {
     391                    psAbort( __func__, "Unknown offset unit: 0x%x\n", unit );
     392                }
     393               
     394            tmp = ( psSphere * ) psAlloc( sizeof( psSphere ) );
     395            tmp->r = position->r + tmpR;
     396            tmp->r = position->d + tmpD;
     397            tmp->rErr = 0.0;
     398            tmp->dErr = 0.0;
     399           
     400            // XXX: wrap tmp->r and tmp->d to the allowed range (-PI to PI)
     401            // and (0 to 2*PI).
     402            return ( tmp );
     403        }
     404    psAbort( __func__, "Unrecognized offset mode\n" );
     405    return ( NULL );
     406}
  • trunk/psLib/src/astronomy/psCoord.h

    r1325 r1374  
    11/** @file  psCoord.h
    2  *
    3  *  @brief Contains basic coordinate transformation definitions and operations
    4  *
    5  *  This file defines the basic types for astronomical coordinate
    6  *  transformation
    7  *
    8  *  @ingroup AstroImage
    9  *
    10  *  @author George Gusciora, MHPCC
    11  *
    12  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-07-29 02:08:02 $
    14  *
    15  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    16  */
     2*
     3*  @brief Contains basic coordinate transformation definitions and operations
     4*
     5*  This file defines the basic types for astronomical coordinate
     6*  transformation
     7*
     8*  @ingroup CoordinateTransform
     9*
     10*  @author George Gusciora, MHPCC
     11*
     12*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-04 00:55:17 $
     14*
     15*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     16*/
    1717
    1818# ifndef PS_COORD_H
     
    2626#include "psTime.h"
    2727
     28/// @addtogroup CoordinateTransform
     29/// @{
     30
    2831typedef struct
    29 {
    30     double x;      ///< x position
    31     double y;      ///< y position
    32     double xErr;   ///< Error in x position
    33     double yErr;   ///< Error in y position
    34 }
     32    {
     33        double x;      ///< x position
     34        double y;      ///< y position
     35        double xErr;   ///< Error in x position
     36        double yErr;   ///< Error in y position
     37    }
    3538psPlane;
    3639
    3740typedef struct
    38 {
    39     double r;      ///< RA
    40     double d;      ///< Dec
    41     double rErr;   ///< Error in RA
    42     double dErr;   ///< Error in Dec
    43 }
     41    {
     42        double r;      ///< RA
     43        double d;      ///< Dec
     44        double rErr;   ///< Error in RA
     45        double dErr;   ///< Error in Dec
     46    }
    4447psSphere;
    4548
    4649typedef struct
    47 {
    48     psDPolynomial2D *x;
    49     psDPolynomial2D *y;
    50 }
     50    {
     51        psDPolynomial2D *x;
     52        psDPolynomial2D *y;
     53    }
    5154psPlaneTransform;
    5255
    5356typedef struct
    54 {
    55     psDPolynomial4D *x;
    56     psDPolynomial4D *y;
    57 }
     57    {
     58        psDPolynomial4D *x;
     59        psDPolynomial4D *y;
     60    }
    5861psPlaneDistort;
    5962
    6063typedef struct
    61 {
    62     double sinPhi;                    ///< sin of North Pole lattitude
    63     double cosPhi;                    ///< cos of North Pole lattitude
    64     double Xo;                        ///< First PT of Ares lon
    65     double xo;                        ///< First PT of Ares equiv lon
    66 }
     64    {
     65        double sinPhi;                    ///< sin of North Pole lattitude
     66        double cosPhi;                    ///< cos of North Pole lattitude
     67        double Xo;                        ///< First PT of Ares lon
     68        double xo;                        ///< First PT of Ares equiv lon
     69    }
    6770psSphereTransform;
    6871
    6972typedef enum {
    70     PS_PROJ_TAN,       ///< Tangent projection
    71     PS_PROJ_SIN,       ///< Sine projection
    72     PS_PROJ_AIT,       ///< Aitoff projection
    73     PS_PROJ_PAR,       ///< Par projection
    74     PS_PROJ_GLS,       ///< GLS projection
    75     PS_PROJ_CAR,       ///< CAR projection
    76     PS_PROJ_MER,       ///< MER projection
     73    PS_PROJ_TAN,        ///< Tangent projection
     74    PS_PROJ_SIN,        ///< Sine projection
     75    PS_PROJ_AIT,        ///< Aitoff projection
     76    PS_PROJ_PAR,        ///< Par projection
     77    PS_PROJ_GLS,        ///< GLS projection
     78    PS_PROJ_CAR,        ///< CAR projection
     79    PS_PROJ_MER,        ///< MER projection
    7780    PS_PROJ_NTYPE      ///< Number of types; must be last.
    7881} psProjectionType;
    7982
    8083typedef struct
    81 {
    82     double R;     ///< Coordinates of projection center
    83     double D;     ///< Coordinates of projection center
    84     double Xs;    ///< plate-scale in X direction
    85     double Ys;    ///< plate-scale in Y direction
    86     psProjectionType type;  ///< Projection type
    87 }
     84    {
     85        double R;     ///< Coordinates of projection center
     86        double D;     ///< Coordinates of projection center
     87        double Xs;    ///< plate-scale in X direction
     88        double Ys;    ///< plate-scale in Y direction
     89        psProjectionType type;  ///< Projection type
     90    }
    8891psProjection;
    8992
     
    100103} psSphereOffsetUnit;
    101104
    102 psPlane *psPlaneTransformApply(psPlane *out,
    103                                const psPlaneTransform *transform,
    104                                const psPlane *coords);
     105psPlane *psPlaneTransformApply( psPlane *out,
     106                                const psPlaneTransform *transform,
     107                                const psPlane *coords );
     108                               
     109psPlane *psPlaneDistortApply( psPlane *out,
     110                              const psPlaneDistort *transform,
     111                              const psPlane *coords,
     112                              float term3,
     113                              float term4 );
     114                             
     115                             
     116// New function prototype.
     117psSphereTransform *psSphereTransformAlloc( double NPlat,
     118        double Xo,
     119        double xo );
     120       
     121void p_psSphereTransformFree( psSphereTransform *trans );
    105122
    106 psPlane *psPlaneDistortApply(psPlane *out,
    107                              const psPlaneDistort *transform,
    108                              const psPlane *coords,
    109                              float term3,
    110                              float term4);
     123psSphere *psSphereTransformApply( psSphere *out,
     124                                  const psSphereTransform *transform,
     125                                  const psSphere *coord );
     126                                 
     127psSphereTransform *psSphereTransformICRStoEcliptic( psTime time );
     128psSphereTransform *psSphereTransformEcliptictoICRS( psTime time );
     129psSphereTransform *psSphereTransformICRStoGalatic( void );
     130psSphereTransform *psSphereTransformGalatictoICRS( void );
    111131
    112 
    113 // New function prototype.
    114 psSphereTransform *psSphereTransformAlloc(double NPlat,
    115         double Xo,
    116         double xo);
    117 
    118 void p_psSphereTransformFree(psSphereTransform *trans);
    119 
    120 psSphere *psSphereTransformApply(psSphere *out,
    121                                  const psSphereTransform *transform,
    122                                  const psSphere *coord);
    123 
    124 psSphereTransform *psSphereTransformICRStoEcliptic(psTime time);
    125 psSphereTransform *psSphereTransformEcliptictoICRS(psTime time);
    126 psSphereTransform *psSphereTransformICRStoGalatic(void);
    127 psSphereTransform *psSphereTransformGalatictoICRS(void);
    128 
    129 psPlane *psProject(const psSphere *coord,
    130                    const psProjection *projection);
    131 
    132 psSphere *psDeproject(const psPlane *coord,
    133                       const psProjection *projection);
    134 
    135 psSphere *psSphereGetOffset(const psSphere *restrict position1,
    136                             const psSphere *restrict position2,
    137                             psSphereOffsetMode mode,
    138                             psSphereOffsetUnit unit);
    139 
    140 psSphere *psSphereSetOffset(const psSphere *restrict position,
    141                             const psSphere *restrict offset,
    142                             psSphereOffsetMode mode,
    143                             psSphereOffsetUnit unit);
    144 
     132psPlane *psProject( const psSphere *coord,
     133                    const psProjection *projection );
     134                   
     135psSphere *psDeproject( const psPlane *coord,
     136                       const psProjection *projection );
     137                       
     138psSphere *psSphereGetOffset( const psSphere *restrict position1,
     139                             const psSphere *restrict position2,
     140                             psSphereOffsetMode mode,
     141                             psSphereOffsetUnit unit );
     142                             
     143psSphere *psSphereSetOffset( const psSphere *restrict position,
     144                             const psSphere *restrict offset,
     145                             psSphereOffsetMode mode,
     146                             psSphereOffsetUnit unit );
     147                             
     148/// @}
    145149
    146150#endif
  • trunk/psLib/src/astronomy/psCoord2.c

    r1325 r1374  
    1 // This file contains
     1/** @file  psCoord2.c
     2*
     3*  @brief Contains basic coordinate transformation definitions and operations
     4*
     5*  This file defines the basic types for astronomical coordinate
     6*  transformation
     7*
     8*  @ingroup CoordinateTransform
     9*
     10*  @author George Gusciora, MHPCC
     11*
     12*  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-04 00:55:17 $
     14*
     15*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     16*/
    217
    318#include "psType.h"
     
    722#include "psFunctions.h"
    823
    9 psGrommit *psGrommitAlloc(const psExposure *exp)
    10 {
    11     psGrommit *grommit = (psGrommit *) psAlloc(sizeof(psGrommit));
    12 
     24psGrommit *psGrommitAlloc( const psExposure *exp )
     25{
     26    psGrommit * grommit = ( psGrommit * ) psAlloc( sizeof( psGrommit ) );
     27   
    1328    grommit->latitude = exp->dec;              // XXX Is this correct?
    14     grommit->sinLat = sin(grommit->latitude);
    15     grommit->cosLat = cos(grommit->latitude);
     29    grommit->sinLat = sin( grommit->latitude );
     30    grommit->cosLat = cos( grommit->latitude );
    1631    grommit->abberationMag = 0.0;
    1732    grommit->height = 0.0;
     
    2540    grommit->longitudeOffset = ra;             // XXX Is this correct?
    2641    grommit->siderealTime = 0.0;
    27 
    28     return(grommit);
    29 }
    30 
    31 void p_psGrommitFree(psGrommit *grommit)
    32 {
    33     psFree(grommit);
    34 }
    35 
    36 psCell *psCellinFPA(psCell *out,
    37                     const psPlane *coord,
    38                     const psFPA *FPA)
    39 {
    40     psChip *tmpChip = NULL;
     42   
     43    return ( grommit );
     44}
     45
     46void p_psGrommitFree( psGrommit *grommit )
     47{
     48    psFree( grommit );
     49}
     50
     51psCell *psCellinFPA( psCell *out,
     52                     const psPlane *coord,
     53                     const psFPA *FPA )
     54{
     55    psChip * tmpChip = NULL;
    4156    psCell *tmpCell = NULL;
    42 
    43     tmpChip = psChipinFPA(tmpChip, coord, FPA);
    44     tmpCell = psCellinChip(tmpCell, coord, tmpChip);
    45     return(tmpCell);
    46 }
    47 
    48 
    49 psChip *psChipinFPA(psChip *out,
    50                     const psPlane *coord,
    51                     const psFPA *FPA)
    52 {
    53     psFPA *tmpChip = NULL;
    54 
    55     for (tmpChip = FPA->chips; tmpChip != NULL; tmpChip++) {
    56         tmpCoord = psPlaneTransformApply(out, tmpChip->fromFPA, coord);
    57 
    58 
    59         //XXX     if (this is the correct chip)
    60         return(tmpChip);
    61     }
     57   
     58    tmpChip = psChipinFPA( tmpChip, coord, FPA );
     59    tmpCell = psCellinChip( tmpCell, coord, tmpChip );
     60    return ( tmpCell );
     61}
     62
     63
     64psChip *psChipinFPA( psChip *out,
     65                     const psPlane *coord,
     66                     const psFPA *FPA )
     67{
     68    psFPA * tmpChip = NULL;
     69   
     70    for ( tmpChip = FPA->chips; tmpChip != NULL; tmpChip++ ) {
     71            tmpCoord = psPlaneTransformApply( out, tmpChip->fromFPA, coord );
     72           
     73           
     74            //XXX     if (this is the correct chip)
     75            return ( tmpChip );
     76        }
    6277}
    6378
     
    6681p_psCheckValidImageCoords(double x, double y, tmpImage)
    6782{
    68     if ((x < 0.0) ||
    69             (x > (double) tmpImage->numCols) ||
    70             (y < 0.0) ||
    71             (y > (double) tmpImage->numRows)) {
    72         return(0);
    73     }
    74     return(1);
     83    if ( ( x < 0.0 ) ||
     84            ( x > ( double ) tmpImage->numCols ) ||
     85            ( y < 0.0 ) ||
     86            ( y > ( double ) tmpImage->numRows ) ) {
     87            return ( 0 );
     88        }
     89    return ( 1 );
    7590}
    7691
     
    88103XXX: must deallocate memory.
    89104 *****************************************************************************/
    90 psCell *psCellinChip(psCell *out,
    91                      const psPlane *coord,
    92                      const psChip *chip)
    93 {
    94     psCell *tmpCell = NULL;
     105psCell *psCellinChip( psCell *out,
     106                      const psPlane *coord,
     107                      const psChip *chip )
     108{
     109    psCell * tmpCell = NULL;
    95110    psReadout *tmpReadout = NULL;
    96111    psPlane *tmpCoord = NULL;
    97 
    98     for (tmpCell = chip->cells; tmpCell != NULL; tmpCell++) {
    99         if (tmpCell->readouts != NULL) {
    100             tmpReadout = tmpCell->readouts;
    101             tmpCoord = psPlaneTransformApply(out, tmpCell->fromChip, coord);
    102             if (p_psCheckValidImageCoords(tmpCoord->x, tmpCoord->y,
    103                                           tmpReadout->image)) {
    104                 return(tmpCell);
    105             }
     112   
     113    for ( tmpCell = chip->cells; tmpCell != NULL; tmpCell++ ) {
     114            if ( tmpCell->readouts != NULL ) {
     115                    tmpReadout = tmpCell->readouts;
     116                    tmpCoord = psPlaneTransformApply( out, tmpCell->fromChip, coord );
     117                    if ( p_psCheckValidImageCoords( tmpCoord->x, tmpCoord->y,
     118                                                    tmpReadout->image ) ) {
     119                            return ( tmpCell );
     120                        }
     121                }
    106122        }
    107     }
    108     return(NULL);
    109 }
    110 
    111 psPlane *psCoordCelltoChip(psPlane *out,
     123    return ( NULL );
     124}
     125
     126psPlane *psCoordCelltoChip( psPlane *out,
     127                            const psPlane *in,
     128                            const psCell *cell )
     129{
     130    return ( psPlaneTransformApply( out, cell->toChip, in ) );
     131}
     132
     133psPlane *psCoordChipToFPA( psPlane *out,
    112134                           const psPlane *in,
    113                            const psCell *cell)
    114 {
    115     return(psPlaneTransformApply(out, cell->toChip, in));
    116 }
    117 
    118 psPlane *psCoordChipToFPA(psPlane *out,
     135                           const psChip *chip )
     136{
     137    return ( psPlaneTransformApply( out, chip->toFPA, in ) );
     138}
     139
     140psPlane *psCoordFPAtoTP( psPlane *out,
     141                         const psPlane *in,
     142                         const psFPA *fpa )
     143{
     144    return ( psPlaneTransformApply( out, fpa->toTangentPlane, in ) );
     145}
     146
     147psSphere *psCoordTPtoSky( psSphere *out,
    119148                          const psPlane *in,
    120                           const psChip *chip)
    121 {
    122     return(psPlaneTransformApply(out, chip->toFPA, in));
    123 }
    124 
    125 psPlane *psCoordFPAtoTP(psPlane *out,
    126                         const psPlane *in,
    127                         const psFPA *fpa)
    128 {
    129     return(psPlaneTransformApply(out, fpa->toTangentPlane, in));
    130 }
    131 
    132 psSphere *psCoordTPtoSky(psSphere *out,
    133                          const psPlane *in,
    134                          const psGrommit *grommit)
     149                          const psGrommit *grommit )
    135150{}
    136151
    137152
    138 psPlane *psCoordCellToFPA(psPlane *out,
    139                           const psPlane *in,
    140                           const psCell *cell)
    141 {
    142     return(psPlaneTransformApply(out, cell->toFPA, in));
     153psPlane *psCoordCellToFPA( psPlane *out,
     154                           const psPlane *in,
     155                           const psCell *cell )
     156{
     157    return ( psPlaneTransformApply( out, cell->toFPA, in ) );
    143158}
    144159
     
    147162// transformation, as well as a few psPlane structs.  Can this be implemented
    148163// better?
    149 psSphere *psCoordCelltoSky(psSphere *out,
    150                            const psPlane *in,
    151                            const psCell *cell)
    152 {
    153     psPlane *tmp1 = NULL;
     164psSphere *psCoordCelltoSky( psSphere *out,
     165                            const psPlane *in,
     166                            const psCell *cell )
     167{
     168    psPlane * tmp1 = NULL;
    154169    psPlane *tmp2 = NULL;
    155     psFPA *parFPA = (cell->parent)->parent;
     170    psFPA *parFPA = ( cell->parent ) ->parent;
    156171    psGrommit *tmpGrommit = NULL;
    157 
    158     tmp1 = psPlaneTransformApply(tmp1, cell->toFPA, in)
    159            tmp2 = psPlaneTransformApply(tmp2, parFPA->toTangentPlane, tmp1)
    160                   tmpGrommit = psGrommitAlloc(parFPA->exposure)
    161                                tmp3 = psCoordTPtoSky(out, tmp2, psGrommit);
    162 
    163     psFree(tmp1);
    164     psFree(tmp2);
    165     psFree(tmpGrommit);
    166 
    167     return(psCoordTPtoSky(out, tmp2, psGrommit);
    168        }
    169 
    170        psSphere *psCoordCelltoSkyQuick(psSphere *out,
    171                                        const psPlane *in,
    172                                        const psCell *cell)
    173        {
    174            psPlane *tmp1 = NULL;
    175 
    176            tmp1 = psPlaneTransformApply(tmp1, cell->toSky, in);
    177 
    178            //XXX: Do something to convert the linear coords in tmp1 to spherical
    179            // coords in out.
    180 
    181            free(tmp1)
    182 
    183            return(out);
    184        }
    185 
    186        psPlane *psCoordSkytoTP(psPlane *out,
    187                                const psSphere *in,
    188                                const psGrommit *grommit)
    189        {
    190            if (out == NULL) {
    191                out = (psPlane *) psAlloc(sizeof(psPlane));
    192            }
    193 
    194            return(out);
    195        }
    196 
    197        psPlane *psCoordTPtoFPA(psPlane *out,
    198                                const psPlane *in,
    199                                const psFPA *fpa)
    200        {
    201            return(psPlaneTransformApply(out, fpa->fromTangentPlane, in));
    202        }
    203 
    204        psPlane *psCoordFPAtoChip(psPlane *out,
    205                                  const psPlane *in,
    206                                  const psChip *chip)
    207        {
    208            return(psPlaneTransformApply(out, chip->fromFPA, in));
    209        }
    210 
    211 
    212        psPlane *psCoordChiptoCell(psPlane *out,
     172   
     173    tmp1 = psPlaneTransformApply( tmp1, cell->toFPA, in )
     174           tmp2 = psPlaneTransformApply( tmp2, parFPA->toTangentPlane, tmp1 )
     175                  tmpGrommit = psGrommitAlloc( parFPA->exposure )
     176                               tmp3 = psCoordTPtoSky( out, tmp2, psGrommit );
     177                               
     178    psFree( tmp1 );
     179    psFree( tmp2 );
     180    psFree( tmpGrommit );
     181   
     182    return ( psCoordTPtoSky( out, tmp2, psGrommit );
     183         }
     184         
     185         psSphere *psCoordCelltoSkyQuick( psSphere *out,
     186                                          const psPlane *in,
     187                                          const psCell *cell )
     188         {
     189             psPlane * tmp1 = NULL;
     190             
     191             tmp1 = psPlaneTransformApply( tmp1, cell->toSky, in );
     192             
     193             //XXX: Do something to convert the linear coords in tmp1 to spherical
     194             // coords in out.
     195             
     196             free( tmp1 )
     197             
     198             return ( out );
     199         }
     200         
     201         psPlane *psCoordSkytoTP( psPlane *out,
     202                                  const psSphere *in,
     203                                  const psGrommit *grommit )
     204         {
     205             if ( out == NULL ) {
     206                     out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
     207                 }
     208                 
     209             return ( out );
     210         }
     211         
     212         psPlane *psCoordTPtoFPA( psPlane *out,
    213213                                  const psPlane *in,
    214                                   const psCell *cell)
    215        {
    216            return(psPlaneTransformApply(out, cell->fromChip, in));
    217        }
    218 
    219        psPlane *psCoordSkytoCell(psPlane *out,
    220                                  const psSphere *in,
    221                                  const psCell *cell)
    222        {
    223            out = psCoordSkytoTP(out, in, tmpGrommit);
    224            out = psCoordTPtoFPA(out, out, whichFPA);
    225            out = psCoordFPAtoChip(out, out, whichChip);
    226            out = psCoordChiptoCell(out, out, whichCell);
    227 
    228            return(out);
    229        }
    230 
    231        psPlane *psCoordSkytoCellQuick(psPlane *out,
    232                                       const psSphere *in,
    233                                       const psCell *cell)
    234        {
    235            if (out == NULL) {
    236                out = (psPlane *) psAlloc(sizeof(psPlane));
    237            }
    238 
    239            return(out);
    240        }
    241 
    242 
     214                                  const psFPA *fpa )
     215         {
     216             return ( psPlaneTransformApply( out, fpa->fromTangentPlane, in ) );
     217         }
     218         
     219         psPlane *psCoordFPAtoChip( psPlane *out,
     220                                    const psPlane *in,
     221                                    const psChip *chip )
     222         {
     223             return ( psPlaneTransformApply( out, chip->fromFPA, in ) );
     224         }
     225         
     226         
     227         psPlane *psCoordChiptoCell( psPlane *out,
     228                                     const psPlane *in,
     229                                     const psCell *cell )
     230         {
     231             return ( psPlaneTransformApply( out, cell->fromChip, in ) );
     232         }
     233         
     234         psPlane *psCoordSkytoCell( psPlane *out,
     235                                    const psSphere *in,
     236                                    const psCell *cell )
     237         {
     238             out = psCoordSkytoTP( out, in, tmpGrommit );
     239             out = psCoordTPtoFPA( out, out, whichFPA );
     240             out = psCoordFPAtoChip( out, out, whichChip );
     241             out = psCoordChiptoCell( out, out, whichCell );
     242             
     243             return ( out );
     244         }
     245         
     246         psPlane *psCoordSkytoCellQuick( psPlane *out,
     247                                         const psSphere *in,
     248                                         const psCell *cell )
     249         {
     250             if ( out == NULL ) {
     251                     out = ( psPlane * ) psAlloc( sizeof( psPlane ) );
     252                 }
     253                 
     254             return ( out );
     255         }
     256         
     257         
     258         
  • trunk/psLib/src/astronomy/psCoord2.h

    r1312 r1374  
    11/** @file  psCoord2.h
    2  *
    3  *  @brief Contains basic coordinate transformation definitions and operations
    4  *
    5  *  This file defines the basic types for astronomical coordinate
    6  *  transformation
    7  *
    8  *  @ingroup AstroImage
    9  *
    10  *  @author George Gusciora, MHPCC
    11  *
    12  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-07-28 22:31:19 $
    14  *
    15  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    16  */
     2*
     3*  @brief Contains basic coordinate transformation definitions and operations
     4*
     5*  This file defines the basic types for astronomical coordinate
     6*  transformation
     7*
     8*  @ingroup CoordinateTransform
     9*
     10*  @author George Gusciora, MHPCC
     11*
     12*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-04 00:55:17 $
     14*
     15*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     16*/
    1717
    1818# ifndef PS_COORD2_H
     
    2525#include "psFunctions.h"
    2626
     27/// @addtogroup CoordinateTransform
     28/// @{
     29
    2730typedef struct
    28 {
    29     const double latitude;             ///<
    30     const double sinLat, cosLat;       ///<
    31     const double abberationMag;        ///<
    32     const double height;               ///<
    33     const double temperature;          ///<
    34     const double pressure;             ///<
    35     const double humidity;             ///<
    36     const double wavelength;           ///<
    37     const double lapseRate;            ///<
    38     const double refractA, refractB;   ///<
    39     const double longitudeOffset;      ///<
    40     const double siderealTime;         ///<
    41 }
     31    {
     32        const double latitude;             ///<
     33        const double sinLat, cosLat;       ///<
     34        const double abberationMag;        ///<
     35        const double height;               ///<
     36        const double temperature;          ///<
     37        const double pressure;             ///<
     38        const double humidity;             ///<
     39        const double wavelength;           ///<
     40        const double lapseRate;            ///<
     41        const double refractA, refractB;   ///<
     42        const double longitudeOffset;      ///<
     43        const double siderealTime;         ///<
     44    }
    4245psGrommit;
    4346
    4447typedef struct
    45 {
    46     int nX, nY;               ///<
    47     double x0, y0;            ///<
    48     double xScale, yScale;    ///<
    49     double **x, **y;          ///<
    50 }
     48    {
     49        int nX, nY;               ///<
     50        double x0, y0;            ///<
     51        double xScale, yScale;    ///<
     52        double **x, **y;          ///<
     53    }
    5154psFixedPattern;
    5255
    53 psGrommit *psGrommitAlloc(const psExposure *exp);
     56psGrommit *psGrommitAlloc( const psExposure *exp );
    5457
    55 void p_psGrommitFree(psGrommit *grommit);
     58void p_psGrommitFree( psGrommit *grommit );
    5659
    57 psCell *psCellinFPA(psCell *out,
    58                     const psPlane *coord,
    59                     const psFPA *FPA);
    60 
    61 psChip *psChipinFPA(psChip *out,
    62                     const psPlane *coord,
    63                     const psFPA *FPA);
    64 
    65 psCell *psCellinChip(psCell *out,
     60psCell *psCellinFPA( psCell *out,
    6661                     const psPlane *coord,
    67                      const psChip *chip);
    68 
    69 
    70 
    71 
    72 psPlane *psCoordCelltoChip(psPlane *out,
     62                     const psFPA *FPA );
     63                     
     64psChip *psChipinFPA( psChip *out,
     65                     const psPlane *coord,
     66                     const psFPA *FPA );
     67                     
     68psCell *psCellinChip( psCell *out,
     69                      const psPlane *coord,
     70                      const psChip *chip );
     71                     
     72                     
     73                     
     74                     
     75psPlane *psCoordCelltoChip( psPlane *out,
     76                            const psPlane *in,
     77                            const psCell *cell );
     78                           
     79psPlane *psCoordChipToFPA( psPlane *out,
    7380                           const psPlane *in,
    74                            const psCell *cell);
    75 
    76 psPlane *psCoordChipToFPA(psPlane *out,
     81                           const psChip *chip );
     82                           
     83psPlane *psCoordFPAtoTP( psPlane *out,
     84                         const psPlane *in,
     85                         const psFPA *fpa );
     86                         
     87psSphere *psCoordTPtoSky( psSphere *out,
    7788                          const psPlane *in,
    78                           const psChip *chip);
    79 
    80 psPlane *psCoordFPAtoTP(psPlane *out,
    81                         const psPlane *in,
    82                         const psFPA *fpa);
    83 
    84 psSphere *psCoordTPtoSky(psSphere *out,
     89                          const psGrommit *grommit );
     90                         
     91psPlane *psCoordCellToFPA( psPlane *out,
     92                           const psPlane *in,
     93                           const psCell *cell );
     94                           
     95psSphere *psCoordCelltoSky( psSphere *out,
     96                            const psPlane *in,
     97                            const psCell *cell );
     98                           
     99psSphere *psCoordCelltoSkyQuick( psSphere *out,
     100                                 const psPlane *in,
     101                                 const psCell *cell );
     102                                 
     103psPlane *psCoordSkytoTP( psPlane *out,
     104                         const psSphere *in,
     105                         const psGrommit *grommit );
     106                         
     107psPlane *psCoordTPtoFPA( psPlane *out,
    85108                         const psPlane *in,
    86                          const psGrommit *grommit);
    87 
    88 psPlane *psCoordCellToFPA(psPlane *out,
    89                           const psPlane *in,
    90                           const psCell *cell);
    91 
    92 psSphere *psCoordCelltoSky(psSphere *out,
     109                         const psFPA *fpa );
     110                         
     111psPlane *psCoordFPAtoChip( psPlane *out,
    93112                           const psPlane *in,
    94                            const psCell *cell);
    95 
    96 psSphere *psCoordCelltoSkyQuick(psSphere *out,
    97                                 const psPlane *in,
    98                                 const psCell *cell);
    99 
    100 psPlane *psCoordSkytoTP(psPlane *out,
    101                         const psSphere *in,
    102                         const psGrommit *grommit);
    103 
    104 psPlane *psCoordTPtoFPA(psPlane *out,
    105                         const psPlane *in,
    106                         const psFPA *fpa);
    107 
    108 psPlane *psCoordFPAtoChip(psPlane *out,
    109                           const psPlane *in,
    110                           const psChip *chip);
    111 
    112 psPlane *psCoordChiptoCell(psPlane *out,
    113                            const psPlane *in,
    114                            const psCell *cell);
    115 
    116 psPlane *psCoordSkytoCell(psPlane *out,
    117                           const psSphere *in,
    118                           const psCell *cell);
    119 
    120 psPlane *psCoordSkytoCellQuick(psPlane *out,
    121                                const psSphere *in,
    122                                const psCell *cell);
     113                           const psChip *chip );
     114                           
     115psPlane *psCoordChiptoCell( psPlane *out,
     116                            const psPlane *in,
     117                            const psCell *cell );
     118                           
     119psPlane *psCoordSkytoCell( psPlane *out,
     120                           const psSphere *in,
     121                           const psCell *cell );
     122                           
     123psPlane *psCoordSkytoCellQuick( psPlane *out,
     124                                const psSphere *in,
     125                                const psCell *cell );
     126                               
     127                               
     128/// @}
    123129
    124130#endif
  • trunk/psLib/src/astronomy/psMetadata.h

    r1351 r1374  
    1010*  @author Ross Harman, MHPCC
    1111*
    12 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-07-30 19:37:07 $
     12*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-04 00:55:17 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818#define PS_METADATA_H
    1919
    20 
    2120/// @addtogroup Metadata
    2221/// @{
     
    3029 */
    3130typedef enum {
    32     PS_META_ITEM_SET = 0,                ///< Null. Metadata is in psMetadataItem.items
    33     PS_META_S32,                         ///< Signed 32-bit integer data.
    34     PS_META_F32,                         ///< Single-precision float data.
    35     PS_META_F64,                         ///< Double-precision float data.
    36     PS_META_STR,                         ///< String data (Stored in as void *).
    37     PS_META_IMG,                         ///< Image data (Stored in as void *).
    38     PS_META_JPEG,                        ///< JPEG data (Stored in as void .
    39     PS_META_PNG,                         ///< PNG data (Stored in as void *).
    40     PS_META_ASTROM,                      ///< Astrometric coefficients (Stored in as void *).
    41     PS_META_UNKNOWN,                     ///< Other data (Stored in as void *).
     31    PS_META_ITEM_SET = 0,                 ///< Null. Metadata is in psMetadataItem.items
     32    PS_META_S32,                          ///< Signed 32-bit integer data.
     33    PS_META_F32,                          ///< Single-precision float data.
     34    PS_META_F64,                          ///< Double-precision float data.
     35    PS_META_STR,                          ///< String data (Stored in as void *).
     36    PS_META_IMG,                          ///< Image data (Stored in as void *).
     37    PS_META_JPEG,                         ///< JPEG data (Stored in as void .
     38    PS_META_PNG,                          ///< PNG data (Stored in as void *).
     39    PS_META_ASTROM,                       ///< Astrometric coefficients (Stored in as void *).
     40    PS_META_UNKNOWN,                      ///< Other data (Stored in as void *).
    4241    PS_META_NTYPE                       ///< Number of types. Must be last.
    4342} psMetadataType;
     
    9796 */
    9897psMetadataItem *psMetadataItemAlloc(
    99     const char *name,                    ///< Name of metadata item.
    100     psMetadataType type,                 ///< Type of metadata item.
    101     const char *comment,                 ///< Comment for metadata item.
     98    const char *name,                     ///< Name of metadata item.
     99    psMetadataType type,                  ///< Type of metadata item.
     100    const char *comment,                  ///< Comment for metadata item.
    102101    ...                                 ///< Arguments for name formatting and metadata item data.
    103102);
     
    117116 */
    118117psMetadataItem *psMetadataItemAllocV(
    119     const char *name,                    ///< Name of metadata item.
    120     psMetadataType type,                 ///< Type of metadata item.
    121     const char *comment,                 ///< Comment for metadata item.
     118    const char *name,                     ///< Name of metadata item.
     119    psMetadataType type,                  ///< Type of metadata item.
     120    const char *comment,                  ///< Comment for metadata item.
    122121    va_list list                        ///< Arguments for name formatting and metadata item data.
    123122);
     
    140139 */
    141140bool psMetadataAddItem(
    142     psMetadata *restrict md,             ///< Metadata collection to insert metadat item.
    143     int where,                           ///< Location to be added.
     141    psMetadata *restrict md,              ///< Metadata collection to insert metadat item.
     142    int where,                            ///< Location to be added.
    144143    psMetadataItem *restrict item       ///< Metadata item to be added.
    145144);
     
    152151 */
    153152bool psMetadataAdd(
    154     psMetadata *restrict md,             ///< Metadata collection to insert metadat item.
    155     int where,                           ///< Location to be added.
    156     const char *name,                    ///< Name of metadata item.
    157     psMetadataType type,                 ///< Type of metadata item.
    158     const char *comment,                 ///< Comment for metadata item.
     153    psMetadata *restrict md,              ///< Metadata collection to insert metadat item.
     154    int where,                            ///< Location to be added.
     155    const char *name,                     ///< Name of metadata item.
     156    psMetadataType type,                  ///< Type of metadata item.
     157    const char *comment,                  ///< Comment for metadata item.
    159158    ...                                 ///< Arguments for name formatting and metadata item data.
    160159);
     
    170169 */
    171170bool psMetadataRemove(
    172     psMetadata *restrict md,             ///< Metadata collection to insert metadat item.
    173     int where,                           ///< Location to be removed.
     171    psMetadata *restrict md,              ///< Metadata collection to insert metadat item.
     172    int where,                            ///< Location to be removed.
    174173    const char *restrict key            ///< Name of metadata key.
    175174);
     
    183182 */
    184183psMetadataItem *psMetadataLookup(
    185     psMetadata *restrict md,             ///< Metadata collection to insert metadat item.
     184    psMetadata *restrict md,              ///< Metadata collection to insert metadat item.
    186185    const char *restrict key            ///< Name of metadata key.
    187186);
     
    194193 */
    195194psMetadataItem *psMetadataGet(
    196     psMetadata *restrict md,             ///< Metadata collection to insert metadat item.
     195    psMetadata *restrict md,              ///< Metadata collection to insert metadat item.
    197196    int where                           ///< Location to be retrieved.
    198197);
     
    205204 */
    206205bool psMetadataSetIterator(
    207     psMetadata *restrict md,             ///< Metadata collection to iterate.
     206    psMetadata *restrict md,              ///< Metadata collection to iterate.
    208207    int where                           ///< Location of iterator.
    209208);
     
    216215 */
    217216psMetadataItem *psMetadataGetNext(
    218     psMetadata *restrict md,             ///< Metadata collection to iterate.
    219     const char *restrict match,          ///< Beginning of key name.
     217    psMetadata *restrict md,              ///< Metadata collection to iterate.
     218    const char *restrict match,           ///< Beginning of key name.
    220219    int which                           ///< Iterator to be used.
    221220);
     
    228227 */
    229228psMetadataItem *psMetadataGetPrevious(
    230     psMetadata *restrict md,             ///< Metadata collection to iterate.
    231     const char *restrict match,          ///< Beginning of key name.
     229    psMetadata *restrict md,              ///< Metadata collection to iterate.
     230    const char *restrict match,           ///< Beginning of key name.
    232231    int which                           ///< Iterator to be used.
    233232);
     
    244243 */
    245244void psMetadataItemPrint(
    246     FILE *fd,                                    ///< Pointer to file to write metadata item.
    247     const char *format,                          ///< Format to print metadata item.
     245    FILE *fd,                                     ///< Pointer to file to write metadata item.
     246    const char *format,                           ///< Format to print metadata item.
    248247    const psMetadataItem *restrict metadataItem ///< Metadata item to print.
    249248);
     
    256255 */
    257256psMetadata *psMetadataReadHeader(
    258     psMetadata *output,                  ///< Resulting metadata from read.
    259     const char *extname,                 ///< File name extension string.
    260     int extnum,                          ///< File name extension number.
     257    psMetadata *output,                   ///< Resulting metadata from read.
     258    const char *extname,                  ///< File name extension string.
     259    int extnum,                           ///< File name extension number.
    261260    const char *filename                ///< Name of file to read.
    262261);
     
    269268 */
    270269psMetadata *psMetadataFReadHeader(
    271     psMetadata *output,                  ///< Resulting metadata from read.
    272     const char *extname,                 ///< File name extension string.
    273     int extnum,                          ///< File name extension number.
     270    psMetadata *output,                   ///< Resulting metadata from read.
     271    const char *extname,                  ///< File name extension string.
     272    int extnum,                           ///< File name extension number.
    274273    fitsfile *fd                        ///< Pointer to file to read.
    275274);
  • trunk/psLib/src/astronomy/psPhotometry.h

    r1312 r1374  
    11/** @file  psPhotometry.h
    2  *
    3  *  @brief Contains basic photometric structures.
    4  *
    5  *  This file defines the basic photometric structures.
    6  *
    7  *  @ingroup AstroImage
    8  *
    9  *  @author George Gusciora, MHPCC
    10  *
    11  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2004-07-28 22:31:01 $
    13  *
    14  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    15  */
     2*
     3*  @brief Contains basic photometric structures.
     4*
     5*  This file defines the basic photometric structures.
     6*
     7*  @ingroup Photometry
     8*
     9*  @author George Gusciora, MHPCC
     10*
     11*  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-08-04 00:55:17 $
     13*
     14*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     15*/
    1616
    1717# ifndef PS_PHOTOMETRIC_H
     
    2424#include "psFunctions.h"
    2525
     26/// @addtogroup Photometry
     27/// @{
     28
    2629typedef struct
    27 {
    28     const int ID;
    29     const char *name;
    30     const char *camera;
    31     const char *filter;
    32     const char *detector;
    33 }
     30    {
     31        const int ID;
     32        const char *name;
     33        const char *camera;
     34        const char *filter;
     35        const char *detector;
     36    }
    3437psPhotSystem;
    3538
    3639typedef struct
    37 {
    38     psPhotSystem src;
    39     psPhotSystem dst;
    40     psPhotSystem pP, pM;
    41     psPhotSystem sP, sM;
    42     float pA, sA;
    43     psPolynomial3D transform;
    44 }
     40    {
     41        psPhotSystem src;
     42        psPhotSystem dst;
     43        psPhotSystem pP, pM;
     44        psPhotSystem sP, sM;
     45        float pA, sA;
     46        psPolynomial3D transform;
     47    }
    4548psPhotTransform;
    4649
     50/// @}
     51
    4752#endif
  • trunk/psLib/src/collections/psMetadata.h

    r1351 r1374  
    1010*  @author Ross Harman, MHPCC
    1111*
    12 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-07-30 19:37:07 $
     12*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-04 00:55:17 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818#define PS_METADATA_H
    1919
    20 
    2120/// @addtogroup Metadata
    2221/// @{
     
    3029 */
    3130typedef enum {
    32     PS_META_ITEM_SET = 0,                ///< Null. Metadata is in psMetadataItem.items
    33     PS_META_S32,                         ///< Signed 32-bit integer data.
    34     PS_META_F32,                         ///< Single-precision float data.
    35     PS_META_F64,                         ///< Double-precision float data.
    36     PS_META_STR,                         ///< String data (Stored in as void *).
    37     PS_META_IMG,                         ///< Image data (Stored in as void *).
    38     PS_META_JPEG,                        ///< JPEG data (Stored in as void .
    39     PS_META_PNG,                         ///< PNG data (Stored in as void *).
    40     PS_META_ASTROM,                      ///< Astrometric coefficients (Stored in as void *).
    41     PS_META_UNKNOWN,                     ///< Other data (Stored in as void *).
     31    PS_META_ITEM_SET = 0,                 ///< Null. Metadata is in psMetadataItem.items
     32    PS_META_S32,                          ///< Signed 32-bit integer data.
     33    PS_META_F32,                          ///< Single-precision float data.
     34    PS_META_F64,                          ///< Double-precision float data.
     35    PS_META_STR,                          ///< String data (Stored in as void *).
     36    PS_META_IMG,                          ///< Image data (Stored in as void *).
     37    PS_META_JPEG,                         ///< JPEG data (Stored in as void .
     38    PS_META_PNG,                          ///< PNG data (Stored in as void *).
     39    PS_META_ASTROM,                       ///< Astrometric coefficients (Stored in as void *).
     40    PS_META_UNKNOWN,                      ///< Other data (Stored in as void *).
    4241    PS_META_NTYPE                       ///< Number of types. Must be last.
    4342} psMetadataType;
     
    9796 */
    9897psMetadataItem *psMetadataItemAlloc(
    99     const char *name,                    ///< Name of metadata item.
    100     psMetadataType type,                 ///< Type of metadata item.
    101     const char *comment,                 ///< Comment for metadata item.
     98    const char *name,                     ///< Name of metadata item.
     99    psMetadataType type,                  ///< Type of metadata item.
     100    const char *comment,                  ///< Comment for metadata item.
    102101    ...                                 ///< Arguments for name formatting and metadata item data.
    103102);
     
    117116 */
    118117psMetadataItem *psMetadataItemAllocV(
    119     const char *name,                    ///< Name of metadata item.
    120     psMetadataType type,                 ///< Type of metadata item.
    121     const char *comment,                 ///< Comment for metadata item.
     118    const char *name,                     ///< Name of metadata item.
     119    psMetadataType type,                  ///< Type of metadata item.
     120    const char *comment,                  ///< Comment for metadata item.
    122121    va_list list                        ///< Arguments for name formatting and metadata item data.
    123122);
     
    140139 */
    141140bool psMetadataAddItem(
    142     psMetadata *restrict md,             ///< Metadata collection to insert metadat item.
    143     int where,                           ///< Location to be added.
     141    psMetadata *restrict md,              ///< Metadata collection to insert metadat item.
     142    int where,                            ///< Location to be added.
    144143    psMetadataItem *restrict item       ///< Metadata item to be added.
    145144);
     
    152151 */
    153152bool psMetadataAdd(
    154     psMetadata *restrict md,             ///< Metadata collection to insert metadat item.
    155     int where,                           ///< Location to be added.
    156     const char *name,                    ///< Name of metadata item.
    157     psMetadataType type,                 ///< Type of metadata item.
    158     const char *comment,                 ///< Comment for metadata item.
     153    psMetadata *restrict md,              ///< Metadata collection to insert metadat item.
     154    int where,                            ///< Location to be added.
     155    const char *name,                     ///< Name of metadata item.
     156    psMetadataType type,                  ///< Type of metadata item.
     157    const char *comment,                  ///< Comment for metadata item.
    159158    ...                                 ///< Arguments for name formatting and metadata item data.
    160159);
     
    170169 */
    171170bool psMetadataRemove(
    172     psMetadata *restrict md,             ///< Metadata collection to insert metadat item.
    173     int where,                           ///< Location to be removed.
     171    psMetadata *restrict md,              ///< Metadata collection to insert metadat item.
     172    int where,                            ///< Location to be removed.
    174173    const char *restrict key            ///< Name of metadata key.
    175174);
     
    183182 */
    184183psMetadataItem *psMetadataLookup(
    185     psMetadata *restrict md,             ///< Metadata collection to insert metadat item.
     184    psMetadata *restrict md,              ///< Metadata collection to insert metadat item.
    186185    const char *restrict key            ///< Name of metadata key.
    187186);
     
    194193 */
    195194psMetadataItem *psMetadataGet(
    196     psMetadata *restrict md,             ///< Metadata collection to insert metadat item.
     195    psMetadata *restrict md,              ///< Metadata collection to insert metadat item.
    197196    int where                           ///< Location to be retrieved.
    198197);
     
    205204 */
    206205bool psMetadataSetIterator(
    207     psMetadata *restrict md,             ///< Metadata collection to iterate.
     206    psMetadata *restrict md,              ///< Metadata collection to iterate.
    208207    int where                           ///< Location of iterator.
    209208);
     
    216215 */
    217216psMetadataItem *psMetadataGetNext(
    218     psMetadata *restrict md,             ///< Metadata collection to iterate.
    219     const char *restrict match,          ///< Beginning of key name.
     217    psMetadata *restrict md,              ///< Metadata collection to iterate.
     218    const char *restrict match,           ///< Beginning of key name.
    220219    int which                           ///< Iterator to be used.
    221220);
     
    228227 */
    229228psMetadataItem *psMetadataGetPrevious(
    230     psMetadata *restrict md,             ///< Metadata collection to iterate.
    231     const char *restrict match,          ///< Beginning of key name.
     229    psMetadata *restrict md,              ///< Metadata collection to iterate.
     230    const char *restrict match,           ///< Beginning of key name.
    232231    int which                           ///< Iterator to be used.
    233232);
     
    244243 */
    245244void psMetadataItemPrint(
    246     FILE *fd,                                    ///< Pointer to file to write metadata item.
    247     const char *format,                          ///< Format to print metadata item.
     245    FILE *fd,                                     ///< Pointer to file to write metadata item.
     246    const char *format,                           ///< Format to print metadata item.
    248247    const psMetadataItem *restrict metadataItem ///< Metadata item to print.
    249248);
     
    256255 */
    257256psMetadata *psMetadataReadHeader(
    258     psMetadata *output,                  ///< Resulting metadata from read.
    259     const char *extname,                 ///< File name extension string.
    260     int extnum,                          ///< File name extension number.
     257    psMetadata *output,                   ///< Resulting metadata from read.
     258    const char *extname,                  ///< File name extension string.
     259    int extnum,                           ///< File name extension number.
    261260    const char *filename                ///< Name of file to read.
    262261);
     
    269268 */
    270269psMetadata *psMetadataFReadHeader(
    271     psMetadata *output,                  ///< Resulting metadata from read.
    272     const char *extname,                 ///< File name extension string.
    273     int extnum,                          ///< File name extension number.
     270    psMetadata *output,                   ///< Resulting metadata from read.
     271    const char *extname,                  ///< File name extension string.
     272    int extnum,                           ///< File name extension number.
    274273    fitsfile *fd                        ///< Pointer to file to read.
    275274);
  • trunk/psLib/src/image/psImageExtraction.c

    r1359 r1374  
    1 /** @file  psImageManip.h
     1/** @file  psImageExtraction.c
    22*
    33*  @brief Contains basic image extraction operations, as specified in the
     
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-07-31 02:27:43 $
     11*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-08-04 00:55:17 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
  • trunk/psLib/src/image/psImageExtraction.h

    r1359 r1374  
    1 /** @file  psImageManip.h
     1/** @file  psImageExtraction.h
    22*
    33*  @brief Contains basic image extraction operations, as specified in the
     
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2004-07-31 02:27:43 $
     11*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-08-04 00:55:17 $
    1313*
    1414*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4141*/
    4242psImage *psImageSubset(
    43     psImage *out,                        ///< Subimage to return, or NULL.
    44     psImage *image,                      ///< Parent image.
    45     unsigned int numCols,                ///< Subimage width (<= image.nCols - col0).
    46     unsigned int numRows,                ///< Subimage height (<= image.nRows - row0).
    47     unsigned int col0,                   ///< Subimage col-offset (0 <= col0 < nCol).
     43    psImage *out,                         ///< Subimage to return, or NULL.
     44    psImage *image,                       ///< Parent image.
     45    unsigned int numCols,                 ///< Subimage width (<= image.nCols - col0).
     46    unsigned int numRows,                 ///< Subimage height (<= image.nRows - row0).
     47    unsigned int col0,                    ///< Subimage col-offset (0 <= col0 < nCol).
    4848    unsigned int row0                   ///< Subimage row-offset (0 <= row0 < nCol).
    4949);
  • trunk/psLib/src/image/psImageStats.h

    r1323 r1374  
    11/** @file psImageStats.h
    2  *  \brief Routines for calculating statistics on images.
    3  *  \ingroup Stats
    4  *  @ingroup Stats
    5  *
    6  *  This file will hold the prototypes for procedures which calculate
    7  *  statistic on images, histograms on images, and fit/evaluate Chebyshev
    8  *  polynomials to images.
    9  *
    10  *  @author George Gusciora, MHPCC
    11  *
    12  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-07-29 02:00:27 $
    14  *
    15  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    16  */
     2*  \brief Routines for calculating statistics on images.
     3*  @ingroup ImageStats
     4*
     5*  This file will hold the prototypes for procedures which calculate
     6*  statistic on images, histograms on images, and fit/evaluate Chebyshev
     7*  polynomials to images.
     8*
     9*  @author George Gusciora, MHPCC
     10*
     11*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-08-04 00:55:17 $
     13*
     14*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     15*/
    1716#if !defined(PS_IMAGE_STATS_H)
    1817#define PS_IMAGE_STATS_H
     
    2524#include "psFunctions.h"
    2625
     26/// @addtogroup ImageStats
     27/// @{
     28
    2729/// This routine must determine the various statistics for the image.
    28 psStats *psImageStats(psStats *stats, ///< defines statistics to be calculated
    29                       psImage *in,    ///< image (or subimage) to calculate stats
    30                       psImage *mask,  ///< mask data for image (NULL ok)
    31                       int maskVal);   ///< mask Mask for mask
    32 
    33 
    34 psHistogram *psImageHistogram(psHistogram *out,  ///< input histogram description & target
    35                               psImage *in,       ///< Image data to be histogramed.
    36                               psImage *mask,     ///< mask data for image (NULL ok)
    37                               unsigned int maskVal);  ///< mask Mask for mask
    38 
     30psStats *psImageStats( psStats *stats, ///< defines statistics to be calculated
     31                       psImage *in,     ///< image (or subimage) to calculate stats
     32                       psImage *mask,   ///< mask data for image (NULL ok)
     33                       int maskVal );   ///< mask Mask for mask
     34                       
     35                       
     36psHistogram *psImageHistogram( psHistogram *out,   ///< input histogram description & target
     37                               psImage *in,        ///< Image data to be histogramed.
     38                               psImage *mask,      ///< mask data for image (NULL ok)
     39                               unsigned int maskVal );  ///< mask Mask for mask
     40                               
    3941/// Fit a 2-D polynomial surface to an image.
    4042psPolynomial2D *
    41 psImageFitPolynomial(const psImage *input, ///< image to fit
    42                      psPolynomial2D *coeffs ///< coefficient structure carries in desired terms & target
     43psImageFitPolynomial( const psImage *input, ///< image to fit
     44                      psPolynomial2D *coeffs ///< coefficient structure carries in desired terms & target
    4345                    );
    44 
     46                   
    4547/// Evaluate a 2-D polynomial surface to image pixels.
    4648int
    47 psImageEvalPolynomial(const psImage *input, ///< image to fit
    48                       const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms
     49psImageEvalPolynomial( const psImage *input, ///< image to fit
     50                       const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms
    4951                     );
     52                     
     53/// @}
    5054
    5155#endif
  • trunk/psLib/src/imageops/psImageStats.h

    r1323 r1374  
    11/** @file psImageStats.h
    2  *  \brief Routines for calculating statistics on images.
    3  *  \ingroup Stats
    4  *  @ingroup Stats
    5  *
    6  *  This file will hold the prototypes for procedures which calculate
    7  *  statistic on images, histograms on images, and fit/evaluate Chebyshev
    8  *  polynomials to images.
    9  *
    10  *  @author George Gusciora, MHPCC
    11  *
    12  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-07-29 02:00:27 $
    14  *
    15  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
    16  */
     2*  \brief Routines for calculating statistics on images.
     3*  @ingroup ImageStats
     4*
     5*  This file will hold the prototypes for procedures which calculate
     6*  statistic on images, histograms on images, and fit/evaluate Chebyshev
     7*  polynomials to images.
     8*
     9*  @author George Gusciora, MHPCC
     10*
     11*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2004-08-04 00:55:17 $
     13*
     14*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     15*/
    1716#if !defined(PS_IMAGE_STATS_H)
    1817#define PS_IMAGE_STATS_H
     
    2524#include "psFunctions.h"
    2625
     26/// @addtogroup ImageStats
     27/// @{
     28
    2729/// This routine must determine the various statistics for the image.
    28 psStats *psImageStats(psStats *stats, ///< defines statistics to be calculated
    29                       psImage *in,    ///< image (or subimage) to calculate stats
    30                       psImage *mask,  ///< mask data for image (NULL ok)
    31                       int maskVal);   ///< mask Mask for mask
    32 
    33 
    34 psHistogram *psImageHistogram(psHistogram *out,  ///< input histogram description & target
    35                               psImage *in,       ///< Image data to be histogramed.
    36                               psImage *mask,     ///< mask data for image (NULL ok)
    37                               unsigned int maskVal);  ///< mask Mask for mask
    38 
     30psStats *psImageStats( psStats *stats, ///< defines statistics to be calculated
     31                       psImage *in,     ///< image (or subimage) to calculate stats
     32                       psImage *mask,   ///< mask data for image (NULL ok)
     33                       int maskVal );   ///< mask Mask for mask
     34                       
     35                       
     36psHistogram *psImageHistogram( psHistogram *out,   ///< input histogram description & target
     37                               psImage *in,        ///< Image data to be histogramed.
     38                               psImage *mask,      ///< mask data for image (NULL ok)
     39                               unsigned int maskVal );  ///< mask Mask for mask
     40                               
    3941/// Fit a 2-D polynomial surface to an image.
    4042psPolynomial2D *
    41 psImageFitPolynomial(const psImage *input, ///< image to fit
    42                      psPolynomial2D *coeffs ///< coefficient structure carries in desired terms & target
     43psImageFitPolynomial( const psImage *input, ///< image to fit
     44                      psPolynomial2D *coeffs ///< coefficient structure carries in desired terms & target
    4345                    );
    44 
     46                   
    4547/// Evaluate a 2-D polynomial surface to image pixels.
    4648int
    47 psImageEvalPolynomial(const psImage *input, ///< image to fit
    48                       const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms
     49psImageEvalPolynomial( const psImage *input, ///< image to fit
     50                       const psPolynomial2D *coeffs ///< coefficient structure carries in desired terms
    4951                     );
     52                     
     53/// @}
    5054
    5155#endif
  • trunk/psLib/src/pslib.h

    r1357 r1374  
    88*  @author Eric Van Alst, MHPCC
    99*
    10 *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
    11 *  @date $Date: 2004-07-31 01:50:33 $
     10*  @version $Revision: 1.17 $ $Name: not supported by cvs2svn $
     11*  @date $Date: 2004-08-04 00:55:17 $
    1212*
    1313*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7575#include "psVector.h"
    7676
     77/// @defgroup Array Array Container
     78/// @ingroup DataContainer
    7779#include "psArray.h"
    7880
    7981/// @defgroup Image Image Container
    8082/// @ingroup DataContainer
     83/// @{
    8184#include "psImage.h"
     85#include "psImageExtraction.h"
     86#include "psImageManip.h"
    8287
    83 /// @defgroup BitSet Bit Set
     88/// @defgroup ImageIO Image File I/O Functions
     89/// @ingroup Image
     90#include "psImageIO.h"
     91
     92
     93/// @defgroup ImageStats Image Statistical Functions
     94/// @ingroup Image
     95#include "psImageStats.h"
     96
     97/// @}
     98
     99/// @defgroup BitSet Bit Set Container
    84100/// @ingroup DataContainer
    85101#include "psBitSet.h"
     102
     103/// @}
    86104
    87105// Data Manipulation
    88106/// @defgroup DataManip Data Manipulation
    89107/// @{
     108
     109/// @defgroup Compare Comparison Functions
     110/// @ingroup DataManip
     111#include "psCompare.h"
    90112
    91113/// @defgroup Stats Statistic Functions
     
    101123#include "psMatrixVectorArithmetic.h"
    102124
    103 /// @defgroup Transform Fourier Transform
     125/// @defgroup Transform Fourier Transform Operations
    104126/// @ingroup DataManip
    105127#include "psFFT.h"
    106 
    107 /// @defgroup ImageIO Image File I/O
    108 /// @ingroup DataManip
    109 #include "psImageIO.h"
    110 
    111 #include "psImageManip.h"
    112 #include "psImageExtraction.h"
    113128
    114129#include "psFunctions.h"
     
    120135/// @defgroup Astronomy Astronomy Functions
    121136/// @{
     137
     138/// @defgroup AstroImage Astronomical Imagery
     139/// @ingroup Astronomy
     140#include "psCCD.h"
     141
     142/// @defgroup CoordinateTransform Coordinate Functions
     143/// @ingroup Astronomy
     144#include "psCoord.h"
     145#include "psCoord2.h"
     146
     147/// @defgroup Photometry Photometry
     148/// @ingroup Astronomy
     149#include "psPhotometry.h"
    122150
    123151/// @defgroup Time Time Functions
  • trunk/psLib/src/types/psMetadata.h

    r1351 r1374  
    1010*  @author Ross Harman, MHPCC
    1111*
    12 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-07-30 19:37:07 $
     12*  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-04 00:55:17 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1818#define PS_METADATA_H
    1919
    20 
    2120/// @addtogroup Metadata
    2221/// @{
     
    3029 */
    3130typedef enum {
    32     PS_META_ITEM_SET = 0,                ///< Null. Metadata is in psMetadataItem.items
    33     PS_META_S32,                         ///< Signed 32-bit integer data.
    34     PS_META_F32,                         ///< Single-precision float data.
    35     PS_META_F64,                         ///< Double-precision float data.
    36     PS_META_STR,                         ///< String data (Stored in as void *).
    37     PS_META_IMG,                         ///< Image data (Stored in as void *).
    38     PS_META_JPEG,                        ///< JPEG data (Stored in as void .
    39     PS_META_PNG,                         ///< PNG data (Stored in as void *).
    40     PS_META_ASTROM,                      ///< Astrometric coefficients (Stored in as void *).
    41     PS_META_UNKNOWN,                     ///< Other data (Stored in as void *).
     31    PS_META_ITEM_SET = 0,                 ///< Null. Metadata is in psMetadataItem.items
     32    PS_META_S32,                          ///< Signed 32-bit integer data.
     33    PS_META_F32,                          ///< Single-precision float data.
     34    PS_META_F64,                          ///< Double-precision float data.
     35    PS_META_STR,                          ///< String data (Stored in as void *).
     36    PS_META_IMG,                          ///< Image data (Stored in as void *).
     37    PS_META_JPEG,                         ///< JPEG data (Stored in as void .
     38    PS_META_PNG,                          ///< PNG data (Stored in as void *).
     39    PS_META_ASTROM,                       ///< Astrometric coefficients (Stored in as void *).
     40    PS_META_UNKNOWN,                      ///< Other data (Stored in as void *).
    4241    PS_META_NTYPE                       ///< Number of types. Must be last.
    4342} psMetadataType;
     
    9796 */
    9897psMetadataItem *psMetadataItemAlloc(
    99     const char *name,                    ///< Name of metadata item.
    100     psMetadataType type,                 ///< Type of metadata item.
    101     const char *comment,                 ///< Comment for metadata item.
     98    const char *name,                     ///< Name of metadata item.
     99    psMetadataType type,                  ///< Type of metadata item.
     100    const char *comment,                  ///< Comment for metadata item.
    102101    ...                                 ///< Arguments for name formatting and metadata item data.
    103102);
     
    117116 */
    118117psMetadataItem *psMetadataItemAllocV(
    119     const char *name,                    ///< Name of metadata item.
    120     psMetadataType type,                 ///< Type of metadata item.
    121     const char *comment,                 ///< Comment for metadata item.
     118    const char *name,                     ///< Name of metadata item.
     119    psMetadataType type,                  ///< Type of metadata item.
     120    const char *comment,                  ///< Comment for metadata item.
    122121    va_list list                        ///< Arguments for name formatting and metadata item data.
    123122);
     
    140139 */
    141140bool psMetadataAddItem(
    142     psMetadata *restrict md,             ///< Metadata collection to insert metadat item.
    143     int where,                           ///< Location to be added.
     141    psMetadata *restrict md,              ///< Metadata collection to insert metadat item.
     142    int where,                            ///< Location to be added.
    144143    psMetadataItem *restrict item       ///< Metadata item to be added.
    145144);
     
    152151 */
    153152bool psMetadataAdd(
    154     psMetadata *restrict md,             ///< Metadata collection to insert metadat item.
    155     int where,                           ///< Location to be added.
    156     const char *name,                    ///< Name of metadata item.
    157     psMetadataType type,                 ///< Type of metadata item.
    158     const char *comment,                 ///< Comment for metadata item.
     153    psMetadata *restrict md,              ///< Metadata collection to insert metadat item.
     154    int where,                            ///< Location to be added.
     155    const char *name,                     ///< Name of metadata item.
     156    psMetadataType type,                  ///< Type of metadata item.
     157    const char *comment,                  ///< Comment for metadata item.
    159158    ...                                 ///< Arguments for name formatting and metadata item data.
    160159);
     
    170169 */
    171170bool psMetadataRemove(
    172     psMetadata *restrict md,             ///< Metadata collection to insert metadat item.
    173     int where,                           ///< Location to be removed.
     171    psMetadata *restrict md,              ///< Metadata collection to insert metadat item.
     172    int where,                            ///< Location to be removed.
    174173    const char *restrict key            ///< Name of metadata key.
    175174);
     
    183182 */
    184183psMetadataItem *psMetadataLookup(
    185     psMetadata *restrict md,             ///< Metadata collection to insert metadat item.
     184    psMetadata *restrict md,              ///< Metadata collection to insert metadat item.
    186185    const char *restrict key            ///< Name of metadata key.
    187186);
     
    194193 */
    195194psMetadataItem *psMetadataGet(
    196     psMetadata *restrict md,             ///< Metadata collection to insert metadat item.
     195    psMetadata *restrict md,              ///< Metadata collection to insert metadat item.
    197196    int where                           ///< Location to be retrieved.
    198197);
     
    205204 */
    206205bool psMetadataSetIterator(
    207     psMetadata *restrict md,             ///< Metadata collection to iterate.
     206    psMetadata *restrict md,              ///< Metadata collection to iterate.
    208207    int where                           ///< Location of iterator.
    209208);
     
    216215 */
    217216psMetadataItem *psMetadataGetNext(
    218     psMetadata *restrict md,             ///< Metadata collection to iterate.
    219     const char *restrict match,          ///< Beginning of key name.
     217    psMetadata *restrict md,              ///< Metadata collection to iterate.
     218    const char *restrict match,           ///< Beginning of key name.
    220219    int which                           ///< Iterator to be used.
    221220);
     
    228227 */
    229228psMetadataItem *psMetadataGetPrevious(
    230     psMetadata *restrict md,             ///< Metadata collection to iterate.
    231     const char *restrict match,          ///< Beginning of key name.
     229    psMetadata *restrict md,              ///< Metadata collection to iterate.
     230    const char *restrict match,           ///< Beginning of key name.
    232231    int which                           ///< Iterator to be used.
    233232);
     
    244243 */
    245244void psMetadataItemPrint(
    246     FILE *fd,                                    ///< Pointer to file to write metadata item.
    247     const char *format,                          ///< Format to print metadata item.
     245    FILE *fd,                                     ///< Pointer to file to write metadata item.
     246    const char *format,                           ///< Format to print metadata item.
    248247    const psMetadataItem *restrict metadataItem ///< Metadata item to print.
    249248);
     
    256255 */
    257256psMetadata *psMetadataReadHeader(
    258     psMetadata *output,                  ///< Resulting metadata from read.
    259     const char *extname,                 ///< File name extension string.
    260     int extnum,                          ///< File name extension number.
     257    psMetadata *output,                   ///< Resulting metadata from read.
     258    const char *extname,                  ///< File name extension string.
     259    int extnum,                           ///< File name extension number.
    261260    const char *filename                ///< Name of file to read.
    262261);
     
    269268 */
    270269psMetadata *psMetadataFReadHeader(
    271     psMetadata *output,                  ///< Resulting metadata from read.
    272     const char *extname,                 ///< File name extension string.
    273     int extnum,                          ///< File name extension number.
     270    psMetadata *output,                   ///< Resulting metadata from read.
     271    const char *extname,                  ///< File name extension string.
     272    int extnum,                           ///< File name extension number.
    274273    fitsfile *fd                        ///< Pointer to file to read.
    275274);
Note: See TracChangeset for help on using the changeset viewer.