Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

psConstants.h

Go to the documentation of this file.
00001 /** @file  psConstants.h
00002  *
00003  *  This file will hold definitions of various constants as well as common
00004  *  macros used throughout psLib.
00005  *
00006  *  @author GLG, MHPCC
00007  *
00008  *  @version $Revision: 1.93 $ $Name: rel12 $
00009  *  @date $Date: 2006/06/30 02:20:06 $
00010  *
00011  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
00012  *
00013  *  XXX: Add parenthesis around all arguments so that these macros can be
00014  *       called with complex expressions.
00015  *
00016  *  XXX: All functions which use the PS_ASSERT macros must be scrutinized so
00017  *  that we ensure that an argument which is expected to be output is
00018  *  psFree'ed before reurning NULL.
00019  *
00020  *  XXX: The macros have a name similar to PS_CHECK_CONDITION() and generally
00021  *  throw a psError if the CONDITION is true.  However, some throw the error
00022  *  if the CONDITION is false.  This should be consistant.
00023  *
00024  */
00025 
00026 #include <math.h> // for M_PI
00027 
00028 /*****************************************************************************
00029 These are common mathimatical constants used by various functions in the psLib.
00030  *****************************************************************************/
00031 #ifndef M_PI
00032 #define M_PI   3.1415926535897932384626433832795029  /* pi */
00033 #define M_PI_2 1.5707963267948966192313216916397514  /* pi/2 */
00034 #define M_PI_4 0.7853981633974483096156608458198757  /* pi/4 */
00035 #define M_1_PI 0.3183098861837906715377675267450287  /* 1/pi */
00036 #define M_2_PI 0.6366197723675813430755350534900574  /* 2/pi */
00037 #endif // #ifndef M_PI
00038 
00039 #define DEG_TO_RAD(DEGREES) ((DEGREES) * M_PI / 180.0)
00040 #define MIN_TO_RAD(MINUTES) ((MINUTES) * M_PI / (180.0 * 60.0))
00041 #define SEC_TO_RAD(SECONDS) ((SECONDS) * M_PI / (180.0 * 60.0 * 60.0))
00042 #define RAD_TO_DEG(RADIANS) ((RADIANS) * 180.0 / M_PI)
00043 #define RAD_TO_MIN(RADIANS) ((RADIANS) * 180.0 * 60.0 / M_PI)
00044 #define RAD_TO_SEC(RADIANS) ((RADIANS) * 180.0 * 60.0 * 60.0 / M_PI)
00045 
00046 /*****************************************************************************
00047     Misc. macros:
00048 *****************************************************************************/
00049 #define PS_MAX(A, B) \
00050 (((A) > (B)) ? (A) : (B))
00051 
00052 #define PS_MIN(A, B) \
00053 (((A) < (B)) ? (A) : (B))
00054 
00055 #define PS_SQR(A) \
00056 ((A) * (A))
00057 
00058 #define PS_SWAP(X,Y) {double tmp=(X); (X) = (Y); (Y) = tmp;}

Generated on Mon Jul 3 14:13:44 2006 for Pan-STARRS Foundation Library by  doxygen 1.4.4