Index: /trunk/psLib/psLib.kdevses
===================================================================
--- /trunk/psLib/psLib.kdevses	(revision 2859)
+++ /trunk/psLib/psLib.kdevses	(revision 2860)
@@ -2,20 +2,14 @@
 <!DOCTYPE KDevPrjSession>
 <KDevPrjSession>
- <DocsAndViews NumberOfDocuments="5" >
-  <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psHash.c" >
-   <View0 line="451" Type="Source" />
+ <DocsAndViews NumberOfDocuments="3" >
+  <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/test/image/tst_psImageManip.c" >
+   <View0 line="1514" Type="Source" />
   </Doc0>
-  <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psHash.h" >
-   <View0 line="42" Type="Source" />
+  <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImageManip.c" >
+   <View0 line="770" Type="Source" />
   </Doc1>
-  <Doc2 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psArray.c" >
+  <Doc2 NumberOfViews="1" URL="file:/home/desonia/psLib/src/dataManip/psConstants.h" >
    <View0 line="0" Type="Source" />
   </Doc2>
-  <Doc3 NumberOfViews="1" URL="file:/home/desonia/psLib/test/collections/tst_psHash04.c" >
-   <View0 line="0" Type="Source" />
-  </Doc3>
-  <Doc4 NumberOfViews="1" URL="file:/home/desonia/psLib/test/collections/tst_psHash05.c" >
-   <View0 line="31" Type="Source" />
-  </Doc4>
  </DocsAndViews>
  <pluginList>
Index: /trunk/psLib/src/dataManip/psConstants.h
===================================================================
--- /trunk/psLib/src/dataManip/psConstants.h	(revision 2859)
+++ /trunk/psLib/src/dataManip/psConstants.h	(revision 2860)
@@ -6,6 +6,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-29 22:15:51 $
+ *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-03 21:58:52 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -30,4 +30,9 @@
  *****************************************************************************/
 #define PS_ONE 1.0
+#define PS_PI   3.1415926535897932384626433832795029  /* pi */
+#define PS_PI_2 1.5707963267948966192313216916397514  /* pi/2 */
+#define PS_PI_4 0.7853981633974483096156608458198757  /* pi/4 */
+#define PS_1_PI 0.3183098861837906715377675267450287  /* 1/pi */
+#define PS_2_PI 0.6366197723675813430755350534900574  /* 2/pi */
 
 /*****************************************************************************
Index: /trunk/psLib/src/image/psImageManip.c
===================================================================
--- /trunk/psLib/src/image/psImageManip.c	(revision 2859)
+++ /trunk/psLib/src/image/psImageManip.c	(revision 2860)
@@ -10,6 +10,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-28 01:42:28 $
+ *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-03 21:58:53 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -25,5 +25,5 @@
 #include "psMemory.h"
 #include "psImageExtraction.h"
-
+#include "psConstants.h"
 #include "psImageErrors.h"
 
@@ -675,8 +675,8 @@
         return NULL;
     }
-    // put the angle in the range of 0...360.
-    angle = angle - 360.0f * floor(angle / 360.0f);
-
-    if (fabsf(angle - 90.0f) < FLT_EPSILON) {
+    // put the angle in the range of 0...2PI.
+    angle = angle - (2.0*PS_PI) * floor(angle / (2.0*PS_PI));
+
+    if (fabsf(angle - PS_PI_2) < FLT_EPSILON) {
         // perform 1/4 rotate counter-clockwise
         psS32 numRows = in->numCols;
@@ -702,10 +702,10 @@
             PSIMAGE_ROTATE_LEFT_90(U8);
             PSIMAGE_ROTATE_LEFT_90(U16);
-            //            PSIMAGE_ROTATE_LEFT_90(U32);      Not a requirement
-            //            PSIMAGE_ROTATE_LEFT_90(U64);      Not a requirement
+            PSIMAGE_ROTATE_LEFT_90(U32);    //  Not a requirement
+            PSIMAGE_ROTATE_LEFT_90(U64);    //  Not a requirement
             PSIMAGE_ROTATE_LEFT_90(S8);
             PSIMAGE_ROTATE_LEFT_90(S16);
-            //            PSIMAGE_ROTATE_LEFT_90(S32);      Not a requirement
-            //            PSIMAGE_ROTATE_LEFT_90(S64);      Not a requirement
+            PSIMAGE_ROTATE_LEFT_90(S32);    //  Not a requirement
+            PSIMAGE_ROTATE_LEFT_90(S64);    //  Not a requirement
             PSIMAGE_ROTATE_LEFT_90(F32);
             PSIMAGE_ROTATE_LEFT_90(F64);
@@ -723,5 +723,5 @@
             }
         }
-    } else if (fabsf(angle - 180.0f) < FLT_EPSILON) {
+    } else if (fabsf(angle - PS_PI) < FLT_EPSILON) {
         // perform 1/2 rotate
         psS32 numRows = in->numRows;
@@ -748,10 +748,10 @@
             PSIMAGE_ROTATE_180_CASE(U8);
             PSIMAGE_ROTATE_180_CASE(U16);
-            //            PSIMAGE_ROTATE_180_CASE(U32);    Not a requirement
-            //            PSIMAGE_ROTATE_180_CASE(U64);    Not a requirement
+            PSIMAGE_ROTATE_180_CASE(U32);    // Not a requirement
+            PSIMAGE_ROTATE_180_CASE(U64);    // Not a requirement
             PSIMAGE_ROTATE_180_CASE(S8);
             PSIMAGE_ROTATE_180_CASE(S16);
-            //            PSIMAGE_ROTATE_180_CASE(S32);    Not a requirement
-            //            PSIMAGE_ROTATE_180_CASE(S64);    Not a requirement
+            PSIMAGE_ROTATE_180_CASE(S32);    // Not a requirement
+            PSIMAGE_ROTATE_180_CASE(S64);    // Not a requirement
             PSIMAGE_ROTATE_180_CASE(F32);
             PSIMAGE_ROTATE_180_CASE(F64);
@@ -769,5 +769,5 @@
             }
         }
-    } else if (fabsf(angle - 270.0f) < FLT_EPSILON) {
+    } else if (fabsf(angle - (PS_PI+PS_PI_2)) < FLT_EPSILON) {
         // perform 1/4 rotate clockwise
         psS32 numRows = in->numCols;
@@ -793,10 +793,10 @@
             PSIMAGE_ROTATE_RIGHT_90(U8);
             PSIMAGE_ROTATE_RIGHT_90(U16);
-            //            PSIMAGE_ROTATE_RIGHT_90(U32);     Not a requirement
-            //            PSIMAGE_ROTATE_RIGHT_90(U64);     Not a requirement
+            PSIMAGE_ROTATE_RIGHT_90(U32);     // Not a requirement
+            PSIMAGE_ROTATE_RIGHT_90(U64);     // Not a requirement
             PSIMAGE_ROTATE_RIGHT_90(S8);
             PSIMAGE_ROTATE_RIGHT_90(S16);
-            //            PSIMAGE_ROTATE_RIGHT_90(S32);     Not a requirement
-            //            PSIMAGE_ROTATE_RIGHT_90(S64);     Not a requirement
+            PSIMAGE_ROTATE_RIGHT_90(S32);     // Not a requirement
+            PSIMAGE_ROTATE_RIGHT_90(S64);     // Not a requirement
             PSIMAGE_ROTATE_RIGHT_90(F32);
             PSIMAGE_ROTATE_RIGHT_90(F64);
@@ -822,7 +822,6 @@
         float centerX = (float)(numCols) / 2.0f;
         float centerY = (float)(numRows) / 2.0f;
-        float t = angle * (3.14159265358f / 180.0f);
-        double cosT = cosf(t);
-        double sinT = sinf(t);
+        double cosT = cosf(angle);
+        double sinT = sinf(angle);
 
         // calculate the corners of the rotated image so we know the proper output image size.
@@ -897,10 +896,10 @@
             PSIMAGE_ROTATE_ARBITRARY_LOOP(U16,MODE); \
             break; \
-            /*        case PS_TYPE_U32:    Not a requirement */ \
-            /*            PSIMAGE_ROTATE_ARBITRARY_LOOP(U32,MODE); */ \
-            /*            break; */ \
-            /*        case PS_TYPE_U64:    Not a requirement */ \
-            /*            PSIMAGE_ROTATE_ARBITRARY_LOOP(U64,MODE); */ \
-            /*            break; */ \
+        case PS_TYPE_U32:   /* Not a requirement */ \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(U32,MODE); \
+            break; \
+        case PS_TYPE_U64:   /* Not a requirement */ \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(U64,MODE); \
+            break;  \
         case PS_TYPE_S8: \
             PSIMAGE_ROTATE_ARBITRARY_LOOP(S8,MODE); \
@@ -909,10 +908,10 @@
             PSIMAGE_ROTATE_ARBITRARY_LOOP(S16,MODE); \
             break; \
-            /*        case PS_TYPE_S32:    Not a requirement */ \
-            /*            PSIMAGE_ROTATE_ARBITRARY_LOOP(S32,MODE); */ \
-            /*            break; */ \
-            /*        case PS_TYPE_S64:    Not a requirement */ \
-            /*            PSIMAGE_ROTATE_ARBITRARY_LOOP(S64,MODE); */ \
-            /*            break; */ \
+        case PS_TYPE_S32:   /* Not a requirement */ \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(S32,MODE); \
+            break; \
+        case PS_TYPE_S64:   /* Not a requirement */ \
+            PSIMAGE_ROTATE_ARBITRARY_LOOP(S64,MODE); \
+            break; \
         case PS_TYPE_F32: \
             PSIMAGE_ROTATE_ARBITRARY_LOOP(F32,MODE); \
Index: /trunk/psLib/src/image/psImageManip.h
===================================================================
--- /trunk/psLib/src/image/psImageManip.h	(revision 2859)
+++ /trunk/psLib/src/image/psImageManip.h	(revision 2860)
@@ -11,6 +11,6 @@
  *  @author Ross Harman, MHPCC
  *
- *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-11-16 20:00:21 $
+ *  @version $Revision: 1.16 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-03 21:58:53 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -44,5 +44,5 @@
  *  All pixels outside of the rectangular region in complex space formed by
  *  the min and max input parameters are set to the value vmax (if either
- *  the real or imaginary portion exceeds the respective max values), or vmin. 
+ *  the real or imaginary portion exceeds the respective max values), or vmin.
  *  This function is defined for psC32, and psC64 imagery only.
  *
@@ -93,5 +93,5 @@
  *  1/scale.  The scale, always a positive number, is equal in each dimension and
  *  specified the number of pixels used to define a new pixel in the output image.
- *  The output image is generated from all input image pixels. This function is 
+ *  The output image is generated from all input image pixels. This function is
  *  defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64.
  *
@@ -110,8 +110,8 @@
 /** Resample image to new scale.
  *
- *  A new image is constructed in which the dimensions are increased by a 
- *  factor of scale. The scale, always a positive number, is equal in each 
- *  dimension. The output image is generated from all input image pixels. 
- *  Each pixel in the output image is derived by interpolating between 
+ *  A new image is constructed in which the dimensions are increased by a
+ *  factor of scale. The scale, always a positive number, is equal in each
+ *  dimension. The output image is generated from all input image pixels.
+ *  Each pixel in the output image is derived by interpolating between
  *  neighboring pixels using the specified interpolation method (mode).
  *
@@ -127,10 +127,10 @@
 /** Rotate the input image by given angle, specified in degrees.
  *
- *  The output image must contain all of the pixels from the input image in 
- *  their new frame. Pixels in the output image which do not map to input 
- *  pixels should be set to exposed. The center of rotation is always the 
- *  center pixel of the image. The rotation is specified in the sense that a 
- *  positive angle is an anti-clockwise rotation. This function must be 
- *  defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64, 
+ *  The output image must contain all of the pixels from the input image in
+ *  their new frame. Pixels in the output image which do not map to input
+ *  pixels should be set to exposed. The center of rotation is always the
+ *  center pixel of the image. The rotation is specified in the sense that a
+ *  positive angle is an anti-clockwise rotation. This function must be
+ *  defined for the following types: psU8, psU16, psS8, psS16, psF32, psF64,
  *  psC32, psC64.
  *
@@ -140,5 +140,5 @@
     psImage* out,                      ///< an psImage to recycle.  If NULL, a new image is created
     const psImage* in,                 ///< input image
-    float angle,                       ///< the rotation angle in degrees.
+    float angle,                       ///< the rotation angle in radians.
     psC64 unexposedValue,              ///< the output image pixel values for non-imagery areas
     psImageInterpolateMode mode        ///< the interpolation mode used
@@ -147,9 +147,9 @@
 /** Shift image by an arbitrary number of pixels (dx,dy) in either direction.
  *
- *  If the shift values are fractional, the output pixel values should 
- *  interpolate between the input pixel values. The output image has the same 
- *  dimensions as the input image. Pixels which fall off the edge of the 
- *  output image are lost. Newly exposed pixels are set to the value given by 
- *  exposed. This function must be defined for the following types: psU8, 
+ *  If the shift values are fractional, the output pixel values should
+ *  interpolate between the input pixel values. The output image has the same
+ *  dimensions as the input image. Pixels which fall off the edge of the
+ *  output image are lost. Newly exposed pixels are set to the value given by
+ *  exposed. This function must be defined for the following types: psU8,
  *  psU16, psS8, psS16, psF32, psF64, psC32, psC64.
  *
@@ -166,7 +166,7 @@
 
 /** Roll image by an integer number of pixels in either direction.
- * 
+ *
  *  The output image is the same dimensions as the input image.  Edge pixels
- *  wrap to the other side (no values are lost).  This function is 
+ *  wrap to the other side (no values are lost).  This function is
  *  defined for psU8, psS8, psS16, psF32, psF64, psC32, and psC64.
  *
Index: /trunk/psLib/src/math/psConstants.h
===================================================================
--- /trunk/psLib/src/math/psConstants.h	(revision 2859)
+++ /trunk/psLib/src/math/psConstants.h	(revision 2860)
@@ -6,6 +6,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.51 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-29 22:15:51 $
+ *  @version $Revision: 1.52 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-03 21:58:52 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -30,4 +30,9 @@
  *****************************************************************************/
 #define PS_ONE 1.0
+#define PS_PI   3.1415926535897932384626433832795029  /* pi */
+#define PS_PI_2 1.5707963267948966192313216916397514  /* pi/2 */
+#define PS_PI_4 0.7853981633974483096156608458198757  /* pi/4 */
+#define PS_1_PI 0.3183098861837906715377675267450287  /* 1/pi */
+#define PS_2_PI 0.6366197723675813430755350534900574  /* 2/pi */
 
 /*****************************************************************************
Index: /trunk/psLib/test/image/tst_psImageManip.c
===================================================================
--- /trunk/psLib/test/image/tst_psImageManip.c	(revision 2859)
+++ /trunk/psLib/test/image/tst_psImageManip.c	(revision 2860)
@@ -6,6 +6,6 @@
  *  @author Robert DeSonia, MHPCC
  *
- *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2004-12-30 20:18:37 $
+ *  @version $Revision: 1.35 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-01-03 21:58:53 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -1279,5 +1279,4 @@
     psImage* fOut = NULL;
     psImage* sOut = NULL;
-    psImage* s32Out = NULL;
     psImage* fBiOut = NULL;
     psImage* sBiOut = NULL;
@@ -1290,14 +1289,11 @@
     psImage* fImg = psImageAlloc(cols,rows,PS_TYPE_F32);
     psImage* sImg = psImageAlloc(cols,rows,PS_TYPE_S16);
-    psImage* s32Img = psImageAlloc(cols,rows,PS_TYPE_S32);
 
     for(psS32 row=0;row<rows;row++) {
         psF32* fRow = fImg->data.F32[row];
         psS16* sRow = sImg->data.S16[row];
-        psS32* s32Row = s32Img->data.S32[row];
         for (psS32 col=0;col<cols;col++) {
             fRow[col] = (psF32)(row)+(psF32)(col)/100.0f;
             sRow[col] = row-2*col;
-            s32Row[col] = row-2*col;
         }
     }
@@ -1324,9 +1320,21 @@
     psS32 index = 0;
     psBool fail = false;
+    psF32 radianRot;
     for (psS32 rot=-180;rot<=180;rot+=45) {
         psImage* oldOut = fOut;
         psImage* oldBiOut = fBiOut;
-        fOut = psImageRotate(fOut,fImg,rot,-1.0,PS_INTERPOLATE_FLAT);
-        fBiOut = psImageRotate(fBiOut,fImg,rot,-1.0,PS_INTERPOLATE_BILINEAR);
+
+        if (rot == 90) {
+            radianRot = PS_PI_2;
+        } else if (rot == -90) {
+            radianRot = PS_PI+PS_PI_2;
+        } else if (rot == 180 || rot == -180) {
+            radianRot = PS_PI;
+        } else {
+            radianRot = ((float)rot)*PS_PI/180.0;
+        }
+
+        fOut = psImageRotate(fOut,fImg,radianRot,-1.0,PS_INTERPOLATE_FLAT);
+        fBiOut = psImageRotate(fBiOut,fImg,radianRot,-1.0,PS_INTERPOLATE_BILINEAR);
         // Verify the returned psImage structure is equal to the input
         // parameter out if provided.
@@ -1339,6 +1347,6 @@
             return 4;
         }
-        sOut = psImageRotate(sOut,sImg,rot,-1.0,PS_INTERPOLATE_FLAT);
-        sBiOut = psImageRotate(sBiOut,sImg,rot,-1.0,PS_INTERPOLATE_BILINEAR);
+        sOut = psImageRotate(sOut,sImg,radianRot,-1.0,PS_INTERPOLATE_FLAT);
+        sBiOut = psImageRotate(sBiOut,sImg,radianRot,-1.0,PS_INTERPOLATE_BILINEAR);
         if (! psImageWriteSection(fOut,0,0,0,NULL,index,"temp/fOut.fits") ) {
             psError(PS_ERR_UNKNOWN, true,"Can not write to temp/fOut.fits, so why continue!?");
@@ -1466,16 +1474,4 @@
         }
 
-        // Verify psImage structure returned is NULL and program execution doesn't stop
-        // if the input image type is not supported. Do not check for 0 degree rotation
-        // since an imgae copy will be used.
-        if (rot != 0 ) {
-            psLogMsg(__func__,PS_LOG_INFO,"Following should be an error invalid type for rotate.");
-            s32Out = psImageRotate(s32Out,s32Img,rot,-1.0,PS_INTERPOLATE_FLAT);
-            if( s32Out != NULL ) {
-                psError(PS_ERR_UNKNOWN, true,"psImage returned is not NULL for invalid image type.");
-                return 5;
-            }
-        }
-
         index++;
     }
@@ -1517,6 +1513,4 @@
     psFree(sBiTruth);
     psFree(fBiOut);
-    psFree(s32Img);
-    psFree(s32Out);
 
     return 0;
