IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3884


Ignore:
Timestamp:
May 11, 2005, 12:02:16 PM (21 years ago)
Author:
desonia
Message:

changed PS_PI* to M_PI*.

Location:
trunk/psLib
Files:
20 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/pslib.kdevses

    r3880 r3884  
    44 <DocsAndViews NumberOfDocuments="6" >
    55  <Doc0 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psLib/src/image/psImageManip.h" >
    6    <View0 line="32" Type="Source" />
     6   <View0 Type="Source" />
    77  </Doc0>
    88  <Doc1 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psLib/src/image/psImageManip.c" >
     
    1010  </Doc1>
    1111  <Doc2 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psLib/src/dataManip/psMatrix.c" >
    12    <View0 line="377" Type="Source" />
     12   <View0 line="412" Type="Source" />
    1313  </Doc2>
    1414  <Doc3 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psLib/src/dataManip/psMatrix.h" >
    1515   <View0 line="0" Type="Source" />
    1616  </Doc3>
    17   <Doc4 NumberOfViews="1" URL="file:///usr/include/gsl/gsl_linalg.h" >
    18    <View0 line="53" Type="Source" />
     17  <Doc4 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psLib/test/dataManip/tst_psMatrix06.c" >
     18   <View0 line="0" Type="Source" />
    1919  </Doc4>
    20   <Doc5 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psLib/src/dataManip/psConstants.h" >
    21    <View0 line="32" Type="Source" />
     20  <Doc5 NumberOfViews="1" URL="file:///home/desonia/panstarrs/psLib/test/dataManip/tst_psMinimize06.c" >
     21   <View0 line="28" Type="Source" />
    2222  </Doc5>
    2323 </DocsAndViews>
  • trunk/psLib/src/astro/psCoord.c

    r3715 r3884  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-04-19 05:46:24 $
     12*  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-05-11 22:02:15 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    326326{
    327327    while (angle < FLT_EPSILON) {
    328         angle+=PS_PI*2;
    329     }
    330 
    331     while (angle >= (PS_PI*2)) {
    332         angle-=PS_PI*2;
     328        angle+=M_PI*2;
     329    }
     330
     331    while (angle >= (M_PI*2)) {
     332        angle-=M_PI*2;
    333333    }
    334334    return(angle);
     
    509509    } else if ( projection->type == PS_PROJ_PAR) {
    510510        out->x = phi*(2.0*cos(2.0*theta/3.0) - 1.0);
    511         out->y = PS_PI*sin(theta/3.0);
     511        out->y = M_PI*sin(theta/3.0);
    512512    } else {
    513513        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     
    558558        // Parabolic deprojection
    559559    } else if ( projection->type == PS_PROJ_PAR) {
    560         psF64 rho = y/PS_PI;
     560        psF64 rho = y/M_PI;
    561561        phi = x/(1.0 - 4.0*rho*rho);
    562562        theta = 3.0*asin(rho);
     
    647647        // Wrap these to an acceptable range.  This assumes that all
    648648        // angles are in radians.
    649         tmp->r = fmod(tmp->r, 2*PS_PI);
    650         tmp->d = fmod(tmp->d, 2*PS_PI);
     649        tmp->r = fmod(tmp->r, 2*M_PI);
     650        tmp->d = fmod(tmp->d, 2*M_PI);
    651651        tmp->rErr = 0.0;
    652652        tmp->dErr = 0.0;
     
    760760        // Add offset and wrap to 0 to 2PI if necessary
    761761        tmp->r = position->r + tmpR;
    762         tmp->r = fmod(tmp->r, 2.0*PS_PI);
     762        tmp->r = fmod(tmp->r, 2.0*M_PI);
    763763        tmp->d = position->d + tmpD;
    764         tmp->d = fmod(tmp->d, 2.0*PS_PI);
     764        tmp->d = fmod(tmp->d, 2.0*M_PI);
    765765        tmp->rErr = 0.0;
    766766        tmp->dErr = 0.0;
  • trunk/psLib/src/astro/psTime.c

    r3712 r3884  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-04-19 02:13:53 $
     12 *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-05-11 22:02:15 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4343
    4444/** Two times pi with double precision accuracy */
    45 #define TWOPI (2.0*PS_PI)
     45#define TWOPI (2.0*M_PI)
    4646
    4747/** Conversion from radians to degrees */
    48 #define R2DEG = (180.0/PS_PI)
     48#define R2DEG = (180.0/M_PI)
    4949
    5050                /** Maximum length of time string */
     
    563563
    564564        t = 2000.0 + (mjd - 51544.03)/365.2422;
    565         dut2ut1 = 0.022*sin(TWOPI*t) - 0.012*cos(TWOPI*t) - 0.006*sin(4.0*PS_PI*t) + 0.007*cos(4.0*PS_PI*t);
     565        dut2ut1 = 0.022*sin(TWOPI*t) - 0.012*cos(TWOPI*t) - 0.006*sin(4.0*M_PI*t) + 0.007*cos(4.0*M_PI*t);
    566566        result = dut->data.F64[0] + dut->data.F64[1]*(mjd - dut->data.F64[2]) - dut2ut1;
    567567
     
    692692    }
    693693
    694     // Create output sphere and convert arcsec to radians (i.e. x/60/60*PS_PI/180)
     694    // Create output sphere and convert arcsec to radians (i.e. x/60/60*M_PI/180)
    695695    output = psAlloc(sizeof(psSphere));
    696     output->r = x * PS_PI / 648000.0;
    697     output->d = y * PS_PI / 648000.0;
     696    output->r = x * M_PI / 648000.0;
     697    output->d = y * M_PI / 648000.0;
    698698
    699699    return output;
  • trunk/psLib/src/astronomy/psCoord.c

    r3715 r3884  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-04-19 05:46:24 $
     12*  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-05-11 22:02:15 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    326326{
    327327    while (angle < FLT_EPSILON) {
    328         angle+=PS_PI*2;
    329     }
    330 
    331     while (angle >= (PS_PI*2)) {
    332         angle-=PS_PI*2;
     328        angle+=M_PI*2;
     329    }
     330
     331    while (angle >= (M_PI*2)) {
     332        angle-=M_PI*2;
    333333    }
    334334    return(angle);
     
    509509    } else if ( projection->type == PS_PROJ_PAR) {
    510510        out->x = phi*(2.0*cos(2.0*theta/3.0) - 1.0);
    511         out->y = PS_PI*sin(theta/3.0);
     511        out->y = M_PI*sin(theta/3.0);
    512512    } else {
    513513        psError(PS_ERR_BAD_PARAMETER_TYPE, true,
     
    558558        // Parabolic deprojection
    559559    } else if ( projection->type == PS_PROJ_PAR) {
    560         psF64 rho = y/PS_PI;
     560        psF64 rho = y/M_PI;
    561561        phi = x/(1.0 - 4.0*rho*rho);
    562562        theta = 3.0*asin(rho);
     
    647647        // Wrap these to an acceptable range.  This assumes that all
    648648        // angles are in radians.
    649         tmp->r = fmod(tmp->r, 2*PS_PI);
    650         tmp->d = fmod(tmp->d, 2*PS_PI);
     649        tmp->r = fmod(tmp->r, 2*M_PI);
     650        tmp->d = fmod(tmp->d, 2*M_PI);
    651651        tmp->rErr = 0.0;
    652652        tmp->dErr = 0.0;
     
    760760        // Add offset and wrap to 0 to 2PI if necessary
    761761        tmp->r = position->r + tmpR;
    762         tmp->r = fmod(tmp->r, 2.0*PS_PI);
     762        tmp->r = fmod(tmp->r, 2.0*M_PI);
    763763        tmp->d = position->d + tmpD;
    764         tmp->d = fmod(tmp->d, 2.0*PS_PI);
     764        tmp->d = fmod(tmp->d, 2.0*M_PI);
    765765        tmp->rErr = 0.0;
    766766        tmp->dErr = 0.0;
  • trunk/psLib/src/astronomy/psTime.c

    r3712 r3884  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-04-19 02:13:53 $
     12 *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-05-11 22:02:15 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4343
    4444/** Two times pi with double precision accuracy */
    45 #define TWOPI (2.0*PS_PI)
     45#define TWOPI (2.0*M_PI)
    4646
    4747/** Conversion from radians to degrees */
    48 #define R2DEG = (180.0/PS_PI)
     48#define R2DEG = (180.0/M_PI)
    4949
    5050                /** Maximum length of time string */
     
    563563
    564564        t = 2000.0 + (mjd - 51544.03)/365.2422;
    565         dut2ut1 = 0.022*sin(TWOPI*t) - 0.012*cos(TWOPI*t) - 0.006*sin(4.0*PS_PI*t) + 0.007*cos(4.0*PS_PI*t);
     565        dut2ut1 = 0.022*sin(TWOPI*t) - 0.012*cos(TWOPI*t) - 0.006*sin(4.0*M_PI*t) + 0.007*cos(4.0*M_PI*t);
    566566        result = dut->data.F64[0] + dut->data.F64[1]*(mjd - dut->data.F64[2]) - dut2ut1;
    567567
     
    692692    }
    693693
    694     // Create output sphere and convert arcsec to radians (i.e. x/60/60*PS_PI/180)
     694    // Create output sphere and convert arcsec to radians (i.e. x/60/60*M_PI/180)
    695695    output = psAlloc(sizeof(psSphere));
    696     output->r = x * PS_PI / 648000.0;
    697     output->d = y * PS_PI / 648000.0;
     696    output->r = x * M_PI / 648000.0;
     697    output->d = y * M_PI / 648000.0;
    698698
    699699    return output;
  • trunk/psLib/src/dataManip/psConstants.h

    r3880 r3884  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-05-11 02:29:39 $
     8 *  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-05-11 22:02:16 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2020 */
    2121
     22#include<math.h> // for M_PI
     23
    2224/*****************************************************************************
    2325These constants are used by various functions in the psLib.
     
    3133These are common mathimatical constants used by various functions in the psLib.
    3234 *****************************************************************************/
    33 #define PS_PI   3.1415926535897932384626433832795029  /* pi */
    34 #define PS_PI_2 1.5707963267948966192313216916397514  /* pi/2 */
    35 #define PS_PI_4 0.7853981633974483096156608458198757  /* pi/4 */
    36 #define PS_1_PI 0.3183098861837906715377675267450287  /* 1/pi */
    37 #define PS_2_PI 0.6366197723675813430755350534900574  /* 2/pi */
    38 
    39 #define DEG_TO_RAD(DEGREES) ((DEGREES) * PS_PI / 180.0)
    40 #define MIN_TO_RAD(MINUTES) ((MINUTES) * PS_PI / (180.0 * 60.0))
    41 #define SEC_TO_RAD(SECONDS) ((SECONDS) * PS_PI / (180.0 * 60.0 * 60.0))
    42 #define RAD_TO_DEG(RADIANS) ((RADIANS) * 180.0 / PS_PI)
    43 #define RAD_TO_MIN(RADIANS) ((RADIANS) * 180.0 * 60.0 / PS_PI)
    44 #define RAD_TO_SEC(RADIANS) ((RADIANS) * 180.0 * 60.0 * 60.0 / PS_PI)
     35#ifndef M_PI
     36#define M_PI   3.1415926535897932384626433832795029  /* pi */
     37#define M_PI_2 1.5707963267948966192313216916397514  /* pi/2 */
     38#define M_PI_4 0.7853981633974483096156608458198757  /* pi/4 */
     39#define M_1_PI 0.3183098861837906715377675267450287  /* 1/pi */
     40#define M_2_PI 0.6366197723675813430755350534900574  /* 2/pi */
     41#endif
     42
     43#define DEG_TO_RAD(DEGREES) ((DEGREES) * M_PI / 180.0)
     44#define MIN_TO_RAD(MINUTES) ((MINUTES) * M_PI / (180.0 * 60.0))
     45#define SEC_TO_RAD(SECONDS) ((SECONDS) * M_PI / (180.0 * 60.0 * 60.0))
     46#define RAD_TO_DEG(RADIANS) ((RADIANS) * 180.0 / M_PI)
     47#define RAD_TO_MIN(RADIANS) ((RADIANS) * 180.0 * 60.0 / M_PI)
     48#define RAD_TO_SEC(RADIANS) ((RADIANS) * 180.0 * 60.0 * 60.0 / M_PI)
    4549
    4650/*****************************************************************************
  • trunk/psLib/src/dataManip/psFunctions.c

    r3857 r3884  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.100 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-05-05 22:33:14 $
     9 *  @version $Revision: 1.101 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-05-11 22:02:16 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    10011001
    10021002    if (normal == true) {
    1003         tmp = 1.0 / PS_SQRT_F32(2.0 * PS_PI * (sigma * sigma));
     1003        tmp = 1.0 / PS_SQRT_F32(2.0 * M_PI * (sigma * sigma));
    10041004    }
    10051005
  • trunk/psLib/src/dataManip/psMinimize.c

    r3873 r3884  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.115 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-05-10 01:57:47 $
     11 *  @version $Revision: 1.116 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-05-11 22:02:16 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    541541        psF64 flux = normalization * exp(-( u*u/(2.0 * sigmaX * sigmaX) +
    542542                                            v*v/(2.0 * sigmaY * sigmaY)))/
    543                      (2.0 * PS_PI * sigmaX * sigmaY);
     543                     (2.0 * M_PI * sigmaX * sigmaY);
    544544        out->data.F32[i] = flux;
    545545
     
    12041204    for (psS32 i=0;i<n;i++) {
    12051205        // NR 5.8.4
    1206         psF64 Y = cos(PS_PI * (0.5 + ((psF32) i)) / ((psF32) n));
     1206        psF64 Y = cos(M_PI * (0.5 + ((psF32) i)) / ((psF32) n));
    12071207        psF64 X = (Y + bma + bpa) - 1.0;
    12081208        tmpScalar.data.F64 = X;
     
    12321232        for (k=0;k<n;k++) {
    12331233            sum+= f->data.F64[k] *
    1234                   cos(PS_PI * ((psF32) j) * (0.5 + ((psF32) k)) / ((psF32) n));
     1234                  cos(M_PI * ((psF32) j) * (0.5 + ((psF32) k)) / ((psF32) n));
    12351235        }
    12361236
  • trunk/psLib/src/image/psImageManip.c

    r3880 r3884  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2005-05-11 02:29:39 $
     12 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2005-05-11 22:02:16 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    679679    }
    680680    // put the angle in the range of 0...2PI.
    681     angle = (float)((double)angle - (2.0*PS_PI) * floor(angle / (2.0*PS_PI)));
    682 
    683     if (fabsf(angle - PS_PI_2) < FLT_EPSILON) {
     681    angle = (float)((double)angle - (2.0*M_PI) * floor(angle / (2.0*M_PI)));
     682
     683    if (fabsf(angle - M_PI_2) < FLT_EPSILON) {
    684684        // perform 1/4 rotate counter-clockwise
    685685        psS32 numRows = in->numCols;
     
    726726            }
    727727        }
    728     } else if (fabsf(angle - PS_PI) < FLT_EPSILON) {
     728    } else if (fabsf(angle - M_PI) < FLT_EPSILON) {
    729729        // perform 1/2 rotate
    730730        psS32 numRows = in->numRows;
     
    772772            }
    773773        }
    774     } else if (fabsf(angle - (PS_PI+PS_PI_2)) < FLT_EPSILON) {
     774    } else if (fabsf(angle - (M_PI+M_PI_2)) < FLT_EPSILON) {
    775775        // perform 1/4 rotate clockwise
    776776        psS32 numRows = in->numCols;
  • trunk/psLib/src/image/psImageStats.c

    r3714 r3884  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.72 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-04-19 04:16:02 $
     11 *  @version $Revision: 1.73 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-05-11 22:02:16 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    207207    for (i = 0; i < n; i++) {
    208208        tmp = (double)(n - i);
    209         tmp = (PS_PI * (tmp - 0.5)) / ((double)n);
     209        tmp = (M_PI * (tmp - 0.5)) / ((double)n);
    210210        scalingFactors[i] = cos(tmp);
    211211    }
     
    416416    // Chebyshev polynomials are 0.
    417417    for (x = 0; x < input->numRows; x++) {
    418         double xTmp = cos(PS_PI * (0.5 + ((float) x)) / ((float) input->numRows));
     418        double xTmp = cos(M_PI * (0.5 + ((float) x)) / ((float) input->numRows));
    419419        double xNode = - ((xTmp + bma + bpa) - 1.0);
    420420        double xOrig = ((float) input->numRows) * (xNode - min) / (max - min);
    421421
    422422        for (y = 0; y < input->numCols; y++) {
    423             double yTmp = cos(PS_PI * (0.5 + ((float) y)) / ((float) input->numCols));
     423            double yTmp = cos(M_PI * (0.5 + ((float) y)) / ((float) input->numCols));
    424424            double yNode = - ((yTmp + bma + bpa) - 1.0);
    425425            double yOrig = ((float) input->numCols) * (yNode - min) / (max - min);
  • trunk/psLib/src/imageops/psImageStats.c

    r3714 r3884  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.72 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-04-19 04:16:02 $
     11 *  @version $Revision: 1.73 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-05-11 22:02:16 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    207207    for (i = 0; i < n; i++) {
    208208        tmp = (double)(n - i);
    209         tmp = (PS_PI * (tmp - 0.5)) / ((double)n);
     209        tmp = (M_PI * (tmp - 0.5)) / ((double)n);
    210210        scalingFactors[i] = cos(tmp);
    211211    }
     
    416416    // Chebyshev polynomials are 0.
    417417    for (x = 0; x < input->numRows; x++) {
    418         double xTmp = cos(PS_PI * (0.5 + ((float) x)) / ((float) input->numRows));
     418        double xTmp = cos(M_PI * (0.5 + ((float) x)) / ((float) input->numRows));
    419419        double xNode = - ((xTmp + bma + bpa) - 1.0);
    420420        double xOrig = ((float) input->numRows) * (xNode - min) / (max - min);
    421421
    422422        for (y = 0; y < input->numCols; y++) {
    423             double yTmp = cos(PS_PI * (0.5 + ((float) y)) / ((float) input->numCols));
     423            double yTmp = cos(M_PI * (0.5 + ((float) y)) / ((float) input->numCols));
    424424            double yNode = - ((yTmp + bma + bpa) - 1.0);
    425425            double yOrig = ((float) input->numCols) * (yNode - min) / (max - min);
  • trunk/psLib/src/math/psConstants.h

    r3880 r3884  
    66 *  @author GLG, MHPCC
    77 *
    8  *  @version $Revision: 1.65 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-05-11 02:29:39 $
     8 *  @version $Revision: 1.66 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-05-11 22:02:16 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2020 */
    2121
     22#include<math.h> // for M_PI
     23
    2224/*****************************************************************************
    2325These constants are used by various functions in the psLib.
     
    3133These are common mathimatical constants used by various functions in the psLib.
    3234 *****************************************************************************/
    33 #define PS_PI   3.1415926535897932384626433832795029  /* pi */
    34 #define PS_PI_2 1.5707963267948966192313216916397514  /* pi/2 */
    35 #define PS_PI_4 0.7853981633974483096156608458198757  /* pi/4 */
    36 #define PS_1_PI 0.3183098861837906715377675267450287  /* 1/pi */
    37 #define PS_2_PI 0.6366197723675813430755350534900574  /* 2/pi */
    38 
    39 #define DEG_TO_RAD(DEGREES) ((DEGREES) * PS_PI / 180.0)
    40 #define MIN_TO_RAD(MINUTES) ((MINUTES) * PS_PI / (180.0 * 60.0))
    41 #define SEC_TO_RAD(SECONDS) ((SECONDS) * PS_PI / (180.0 * 60.0 * 60.0))
    42 #define RAD_TO_DEG(RADIANS) ((RADIANS) * 180.0 / PS_PI)
    43 #define RAD_TO_MIN(RADIANS) ((RADIANS) * 180.0 * 60.0 / PS_PI)
    44 #define RAD_TO_SEC(RADIANS) ((RADIANS) * 180.0 * 60.0 * 60.0 / PS_PI)
     35#ifndef M_PI
     36#define M_PI   3.1415926535897932384626433832795029  /* pi */
     37#define M_PI_2 1.5707963267948966192313216916397514  /* pi/2 */
     38#define M_PI_4 0.7853981633974483096156608458198757  /* pi/4 */
     39#define M_1_PI 0.3183098861837906715377675267450287  /* 1/pi */
     40#define M_2_PI 0.6366197723675813430755350534900574  /* 2/pi */
     41#endif
     42
     43#define DEG_TO_RAD(DEGREES) ((DEGREES) * M_PI / 180.0)
     44#define MIN_TO_RAD(MINUTES) ((MINUTES) * M_PI / (180.0 * 60.0))
     45#define SEC_TO_RAD(SECONDS) ((SECONDS) * M_PI / (180.0 * 60.0 * 60.0))
     46#define RAD_TO_DEG(RADIANS) ((RADIANS) * 180.0 / M_PI)
     47#define RAD_TO_MIN(RADIANS) ((RADIANS) * 180.0 * 60.0 / M_PI)
     48#define RAD_TO_SEC(RADIANS) ((RADIANS) * 180.0 * 60.0 * 60.0 / M_PI)
    4549
    4650/*****************************************************************************
  • trunk/psLib/src/math/psMinimize.c

    r3873 r3884  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.115 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-05-10 01:57:47 $
     11 *  @version $Revision: 1.116 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-05-11 22:02:16 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    541541        psF64 flux = normalization * exp(-( u*u/(2.0 * sigmaX * sigmaX) +
    542542                                            v*v/(2.0 * sigmaY * sigmaY)))/
    543                      (2.0 * PS_PI * sigmaX * sigmaY);
     543                     (2.0 * M_PI * sigmaX * sigmaY);
    544544        out->data.F32[i] = flux;
    545545
     
    12041204    for (psS32 i=0;i<n;i++) {
    12051205        // NR 5.8.4
    1206         psF64 Y = cos(PS_PI * (0.5 + ((psF32) i)) / ((psF32) n));
     1206        psF64 Y = cos(M_PI * (0.5 + ((psF32) i)) / ((psF32) n));
    12071207        psF64 X = (Y + bma + bpa) - 1.0;
    12081208        tmpScalar.data.F64 = X;
     
    12321232        for (k=0;k<n;k++) {
    12331233            sum+= f->data.F64[k] *
    1234                   cos(PS_PI * ((psF32) j) * (0.5 + ((psF32) k)) / ((psF32) n));
     1234                  cos(M_PI * ((psF32) j) * (0.5 + ((psF32) k)) / ((psF32) n));
    12351235        }
    12361236
  • trunk/psLib/src/math/psPolynomial.c

    r3857 r3884  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.100 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-05-05 22:33:14 $
     9 *  @version $Revision: 1.101 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-05-11 22:02:16 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    10011001
    10021002    if (normal == true) {
    1003         tmp = 1.0 / PS_SQRT_F32(2.0 * PS_PI * (sigma * sigma));
     1003        tmp = 1.0 / PS_SQRT_F32(2.0 * M_PI * (sigma * sigma));
    10041004    }
    10051005
  • trunk/psLib/src/math/psSpline.c

    r3857 r3884  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.100 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-05-05 22:33:14 $
     9 *  @version $Revision: 1.101 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-05-11 22:02:16 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    10011001
    10021002    if (normal == true) {
    1003         tmp = 1.0 / PS_SQRT_F32(2.0 * PS_PI * (sigma * sigma));
     1003        tmp = 1.0 / PS_SQRT_F32(2.0 * M_PI * (sigma * sigma));
    10041004    }
    10051005
  • trunk/psLib/test/dataManip/tst_psMatrixVectorArithmetic02.c

    r3682 r3884  
    1010 *  @author  Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.12 $  $Name: not supported by cvs2svn $
    13  *  @date  $Date: 2005-04-07 20:27:42 $
     12 *  @version $Revision: 1.13 $  $Name: not supported by cvs2svn $
     13 *  @date  $Date: 2005-05-11 22:02:16 $
    1414 *
    1515 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    131131    testUnaryOpM( log, F64, 1000.0, 0.0, 3, 2, 3 );
    132132    testUnaryOpM( log, C32, 1000.0 + 0.0i, 0.0 + 0.0i, 3, 2, 3 );
    133     testUnaryOpM( sin, S32, PS_PI_2, 0, 3, 2, 1 );
    134     testUnaryOpM( sin, F32, PS_PI_2, 0.0, 3, 2, 1.0 );
    135     testUnaryOpM( sin, F64, PS_PI_2, 0.0, 3, 2, 1.0 );
    136     testUnaryOpM( sin, C32, PS_PI_2 + 0.0i, 0.0 + 0.0i, 3, 2, 1.0 );
     133    testUnaryOpM( sin, S32, M_PI_2, 0, 3, 2, 1 );
     134    testUnaryOpM( sin, F32, M_PI_2, 0.0, 3, 2, 1.0 );
     135    testUnaryOpM( sin, F64, M_PI_2, 0.0, 3, 2, 1.0 );
     136    testUnaryOpM( sin, C32, M_PI_2 + 0.0i, 0.0 + 0.0i, 3, 2, 1.0 );
    137137    testUnaryOpM( dsin, S32, 90, 0, 3, 2 , 1);
    138138    testUnaryOpM( dsin, F32, 90.0, 0.0, 3, 2, 1.0 );
     
    147147    testUnaryOpM( dcos, F64, 0.0, 0.0, 3, 2, 1.0 );
    148148    testUnaryOpM( dcos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, 1.0 );
    149     testUnaryOpM( tan, S32, PS_PI_4, 0, 3, 2, 1);
    150     testUnaryOpM( tan, F32, PS_PI_4, 0.0, 3, 2, 1.0 );
    151     testUnaryOpM( tan, F64, PS_PI_4, 0.0, 3, 2, 1.0 );
    152     testUnaryOpM( tan, C32, PS_PI_4 + 0.0i, 0.0 + 0.0i, 3, 2, 1 );
     149    testUnaryOpM( tan, S32, M_PI_4, 0, 3, 2, 1);
     150    testUnaryOpM( tan, F32, M_PI_4, 0.0, 3, 2, 1.0 );
     151    testUnaryOpM( tan, F64, M_PI_4, 0.0, 3, 2, 1.0 );
     152    testUnaryOpM( tan, C32, M_PI_4 + 0.0i, 0.0 + 0.0i, 3, 2, 1 );
    153153    testUnaryOpM( dtan, S32, 45, 0, 3, 2, 1 );
    154154    testUnaryOpM( dtan, F32, 45.0, 0.0, 3, 2, 1.0 );
    155155    testUnaryOpM( dtan, F64, 45.0, 0.0, 3, 2, 1.0 );
    156156    testUnaryOpM( dtan, C32, 45.0 + 45.0i, 0.0 + 0.0i, 3, 2, 1.0 );
    157     testUnaryOpM( asin, S32, 1, 0, 3, 2, PS_PI_2);
    158     testUnaryOpM( asin, F32, 1.0, 0.0, 3, 2, PS_PI_2  );
    159     testUnaryOpM( asin, F64, 1.0, 0.0, 3, 2, PS_PI_2);
    160     testUnaryOpM( asin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2, PS_PI_2);
     157    testUnaryOpM( asin, S32, 1, 0, 3, 2, M_PI_2);
     158    testUnaryOpM( asin, F32, 1.0, 0.0, 3, 2, M_PI_2  );
     159    testUnaryOpM( asin, F64, 1.0, 0.0, 3, 2, M_PI_2);
     160    testUnaryOpM( asin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2, M_PI_2);
    161161    testUnaryOpM( dasin, S32, 1.0, 0, 3, 2, 90 );
    162162    testUnaryOpM( dasin, F32, 1.0, 0.0, 3, 2, 90.0 );
    163163    testUnaryOpM( dasin, F64, 1.0, 0.0, 3, 2, 90.0 );
    164164    testUnaryOpM( dasin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 2, 90.0 );
    165     testUnaryOpM( acos, S32, 0, 0, 3, 2, PS_PI_2);
    166     testUnaryOpM( acos, F32, 0.0, 0.0, 3, 2, PS_PI_2 );
    167     testUnaryOpM( acos, F64, 0.0, 0.0, 3, 2, PS_PI_2 );
    168     testUnaryOpM( acos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, PS_PI_2 );
     165    testUnaryOpM( acos, S32, 0, 0, 3, 2, M_PI_2);
     166    testUnaryOpM( acos, F32, 0.0, 0.0, 3, 2, M_PI_2 );
     167    testUnaryOpM( acos, F64, 0.0, 0.0, 3, 2, M_PI_2 );
     168    testUnaryOpM( acos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, M_PI_2 );
    169169    testUnaryOpM( dacos, S32, 0, 0, 3, 2, 90 );
    170170    testUnaryOpM( dacos, F32, 0.0, 0.0, 3, 2, 90.0 );
    171171    testUnaryOpM( dacos, F64, 0.0, 0.0, 3, 2, 90.0 );
    172172    testUnaryOpM( dacos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 2, 90.0 );
    173     testUnaryOpM( atan, S32, 1, 0, 3, 2, PS_PI_4);
    174     testUnaryOpM( atan, F32, 1.0, 0.0, 3, 2, PS_PI_4 );
    175     testUnaryOpM( atan, F64, 1.0, 0.0, 3, 2, PS_PI_4);
    176     testUnaryOpM( atan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 2, PS_PI_4);
     173    testUnaryOpM( atan, S32, 1, 0, 3, 2, M_PI_4);
     174    testUnaryOpM( atan, F32, 1.0, 0.0, 3, 2, M_PI_4 );
     175    testUnaryOpM( atan, F64, 1.0, 0.0, 3, 2, M_PI_4);
     176    testUnaryOpM( atan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, 2, M_PI_4);
    177177    testUnaryOpM( datan, S32, 1, 0, 3, 2, 45 );
    178178    testUnaryOpM( datan, F32, 1.0, 0.0, 3, 2, 45.0 );
     
    216216    testUnaryOpV( log, F64, 1000.0, 0.0, 3, 3 );
    217217    testUnaryOpV( log, C32, 1000.0 + 0.0i, 0.0 + 0.0i, 3, 3 );
    218     testUnaryOpV( sin, S32, PS_PI_2, 0, 3, 1 );
    219     testUnaryOpV( sin, F32, PS_PI_2, 0.0, 3, 1.0 );
    220     testUnaryOpV( sin, F64, PS_PI_2, 0.0, 3, 1.0 );
    221     testUnaryOpV( sin, C32, PS_PI_2 + 0.0i, 0.0 + 0.0i, 3, 1.0 );
     218    testUnaryOpV( sin, S32, M_PI_2, 0, 3, 1 );
     219    testUnaryOpV( sin, F32, M_PI_2, 0.0, 3, 1.0 );
     220    testUnaryOpV( sin, F64, M_PI_2, 0.0, 3, 1.0 );
     221    testUnaryOpV( sin, C32, M_PI_2 + 0.0i, 0.0 + 0.0i, 3, 1.0 );
    222222    testUnaryOpV( dsin, S32, 90, 0, 3, 1);
    223223    testUnaryOpV( dsin, F32, 90.0, 0.0, 3, 1.0 );
     
    232232    testUnaryOpV( dcos, F64, 0.0, 0.0, 3, 1.0 );
    233233    testUnaryOpV( dcos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 1.0 );
    234     testUnaryOpV( tan, S32, PS_PI_4, 0, 3, 1);
    235     testUnaryOpV( tan, F32, PS_PI_4, 0.0, 3, 1.0 );
    236     testUnaryOpV( tan, F64, PS_PI_4, 0.0, 3, 1.0 );
    237     testUnaryOpV( tan, C32, PS_PI_4 + 0.0i, 0.0 + 0.0i, 3, 1 );
     234    testUnaryOpV( tan, S32, M_PI_4, 0, 3, 1);
     235    testUnaryOpV( tan, F32, M_PI_4, 0.0, 3, 1.0 );
     236    testUnaryOpV( tan, F64, M_PI_4, 0.0, 3, 1.0 );
     237    testUnaryOpV( tan, C32, M_PI_4 + 0.0i, 0.0 + 0.0i, 3, 1 );
    238238    testUnaryOpV( dtan, S32, 45, 0, 3, 1 );
    239239    testUnaryOpV( dtan, F32, 45.0, 0.0, 3, 1.0 );
    240240    testUnaryOpV( dtan, F64, 45.0, 0.0, 3, 1.0 );
    241241    testUnaryOpV( dtan, C32, 45.0 + 45.0i, 0.0 + 0.0i, 3, 1.0 );
    242     testUnaryOpV( asin, S32, 1, 0, 3, PS_PI_2);
    243     testUnaryOpV( asin, F32, 1.0, 0.0, 3, PS_PI_2  );
    244     testUnaryOpV( asin, F64, 1.0, 0.0, 3, PS_PI_2);
    245     testUnaryOpV( asin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, PS_PI_2);
     242    testUnaryOpV( asin, S32, 1, 0, 3, M_PI_2);
     243    testUnaryOpV( asin, F32, 1.0, 0.0, 3, M_PI_2  );
     244    testUnaryOpV( asin, F64, 1.0, 0.0, 3, M_PI_2);
     245    testUnaryOpV( asin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, M_PI_2);
    246246    testUnaryOpV( dasin, S32, 1.0, 0, 3, 90 );
    247247    testUnaryOpV( dasin, F32, 1.0, 0.0, 3, 90.0 );
    248248    testUnaryOpV( dasin, F64, 1.0, 0.0, 3, 90.0 );
    249249    testUnaryOpV( dasin, C32, 1.0 + 1.0i, 0.0 + 0.0i, 3, 90.0 );
    250     testUnaryOpV( acos, S32, 0, 0, 3, PS_PI_2);
    251     testUnaryOpV( acos, F32, 0.0, 0.0, 3, PS_PI_2 );
    252     testUnaryOpV( acos, F64, 0.0, 0.0, 3, PS_PI_2 );
    253     testUnaryOpV( acos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, PS_PI_2 );
     250    testUnaryOpV( acos, S32, 0, 0, 3, M_PI_2);
     251    testUnaryOpV( acos, F32, 0.0, 0.0, 3, M_PI_2 );
     252    testUnaryOpV( acos, F64, 0.0, 0.0, 3, M_PI_2 );
     253    testUnaryOpV( acos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, M_PI_2 );
    254254    testUnaryOpV( dacos, S32, 0, 0, 3, 90 );
    255255    testUnaryOpV( dacos, F32, 0.0, 0.0, 3, 90.0 );
    256256    testUnaryOpV( dacos, F64, 0.0, 0.0, 3, 90.0 );
    257257    testUnaryOpV( dacos, C32, 0.0 + 0.0i, 0.0 + 0.0i, 3, 90.0 );
    258     testUnaryOpV( atan, S32, 1, 0, 3, PS_PI_4);
    259     testUnaryOpV( atan, F32, 1.0, 0.0, 3, PS_PI_4 );
    260     testUnaryOpV( atan, F64, 1.0, 0.0, 3, PS_PI_4);
    261     testUnaryOpV( atan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, PS_PI_4);
     258    testUnaryOpV( atan, S32, 1, 0, 3, M_PI_4);
     259    testUnaryOpV( atan, F32, 1.0, 0.0, 3, M_PI_4 );
     260    testUnaryOpV( atan, F64, 1.0, 0.0, 3, M_PI_4);
     261    testUnaryOpV( atan, C32, 1.0 + 0.0i, 0.0 + 0.0i, 3, M_PI_4);
    262262    testUnaryOpV( datan, S32, 1, 0, 3, 45 );
    263263    testUnaryOpV( datan, F32, 1.0, 0.0, 3, 45.0 );
  • trunk/psLib/test/dataManip/tst_psVectorFFT.c

    r3682 r3884  
    66*  @author Robert DeSonia, MHPCC
    77*
    8 *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2005-04-07 20:27:42 $
     8*  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2005-05-11 22:02:16 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6868    vec->n = vec->nalloc;
    6969    for ( psU32 n = 0; n < 100; n++ ) {
    70         vec->data.F32[ n ] = sinf( ( psF32 ) n / 50.0f * PS_PI );
     70        vec->data.F32[ n ] = sinf( ( psF32 ) n / 50.0f * M_PI );
    7171    }
    7272
     
    111111    }
    112112    for ( psU32 n = 0; n < 100; n++ ) {
    113         psF32 val = sinf( ( psF32 ) n / 50.0f * PS_PI );
     113        psF32 val = sinf( ( psF32 ) n / 50.0f * M_PI );
    114114        psF32 vecVal = crealf( vec3->data.C32[ n ] ) / 100;
    115115        if ( fabsf( vecVal - val ) > 0.1f ) {
     
    548548    vec3->n = vec3->nalloc;
    549549    for ( psU32 n = 0; n < 100; n++ ) {
    550         vec->data.C32[ n ] = n + I * sinf( ( ( psF32 ) n ) / 50.f * PS_PI );
    551         vec3->data.C64[ n ] = n + I * sinf( ( ( psF64 ) n ) / 50.f * PS_PI );
     550        vec->data.C32[ n ] = n + I * sinf( ( ( psF32 ) n ) / 50.f * M_PI );
     551        vec3->data.C64[ n ] = n + I * sinf( ( ( psF64 ) n ) / 50.f * M_PI );
    552552    }
    553553
  • trunk/psLib/test/image/tst_psImageFFT.c

    r3702 r3884  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-04-15 00:12:09 $
     8 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-05-11 22:02:16 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6868
    6969    // 1. assign a image to a radial sinisoid
    70     GENIMAGE(img,m,n,F32, sinf((32.0f-row)/32.0f*PS_PI)+sinf((64.0f-col)/64.0f*PS_PI));
     70    GENIMAGE(img,m,n,F32, sinf((32.0f-row)/32.0f*M_PI)+sinf((64.0f-col)/64.0f*M_PI));
    7171
    7272    // 2. perform a forward transform
  • trunk/psLib/test/image/tst_psImageManip.c

    r3682 r3884  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-04-07 20:27:42 $
     8 *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-05-11 22:02:16 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    13151315
    13161316        if (rot == 90) {
    1317             radianRot = PS_PI_2;
     1317            radianRot = M_PI_2;
    13181318        } else if (rot == -90) {
    1319             radianRot = PS_PI+PS_PI_2;
     1319            radianRot = M_PI+M_PI_2;
    13201320        } else if (rot == 180 || rot == -180) {
    1321             radianRot = PS_PI;
     1321            radianRot = M_PI;
    13221322        } else {
    1323             radianRot = ((float)rot)*PS_PI/180.0;
     1323            radianRot = ((float)rot)*M_PI/180.0;
    13241324        }
    13251325
Note: See TracChangeset for help on using the changeset viewer.