Index: /trunk/Ohana/src/libdvo/include/libdvo_astro.h
===================================================================
--- /trunk/Ohana/src/libdvo/include/libdvo_astro.h	(revision 39244)
+++ /trunk/Ohana/src/libdvo/include/libdvo_astro.h	(revision 39245)
@@ -138,4 +138,5 @@
 } Image;
 
+CoordTransform *AllocTransform (double phi, double Xo, double xo);
 CoordTransform *InitTransform (CoordTransformSystem input, CoordTransformSystem output);
 int ApplyTransform (double *x, double *y, double X, double Y, CoordTransform *transform);
Index: /trunk/Ohana/src/libdvo/src/coord_systems.c
===================================================================
--- /trunk/Ohana/src/libdvo/src/coord_systems.c	(revision 39244)
+++ /trunk/Ohana/src/libdvo/src/coord_systems.c	(revision 39245)
@@ -1,4 +1,28 @@
 # include "dvo.h"
     
+CoordTransform *AllocTransform (double phi, double Xo, double xo) {
+
+  CoordTransform *transform;
+  ALLOCATE (transform, CoordTransform, 1);
+  transform->isIdentity = FALSE;
+  
+  transform->phi = phi*RAD_DEG;
+  transform->Xo  = Xo*RAD_DEG;
+  transform->xo  = xo;
+
+  // pre-calculated constants:
+  transform->sin_phi_cos_Xo = sin(transform->phi)*cos(transform->Xo);
+  transform->sin_phi_sin_Xo = sin(transform->phi)*sin(transform->Xo);
+  transform->cos_phi        = cos(transform->phi);
+  
+  transform->cos_phi_cos_Xo = cos(transform->phi)*cos(transform->Xo);
+  transform->cos_phi_sin_Xo = cos(transform->phi)*sin(transform->Xo);
+  transform->sin_phi        = sin(transform->phi);
+  transform->cos_Xo 	    = cos(transform->Xo);
+  transform->sin_Xo 	    = sin(transform->Xo);
+
+  return transform;
+}
+
 CoordTransform *InitTransform (CoordTransformSystem input, CoordTransformSystem output) {
 
Index: /trunk/Ohana/src/opihi/cmd.astro/Makefile
===================================================================
--- /trunk/Ohana/src/opihi/cmd.astro/Makefile	(revision 39244)
+++ /trunk/Ohana/src/opihi/cmd.astro/Makefile	(revision 39245)
@@ -25,4 +25,5 @@
 $(SRC)/cneedles.$(ARCH).o		   \
 $(SRC)/cplot.$(ARCH).o		   \
+$(SRC)/crotation.$(ARCH).o	   \
 $(SRC)/csystem.$(ARCH).o	   \
 $(SRC)/ctimes.$(ARCH).o	   \
Index: /trunk/Ohana/src/opihi/cmd.astro/crotation.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.astro/crotation.c	(revision 39245)
+++ /trunk/Ohana/src/opihi/cmd.astro/crotation.c	(revision 39245)
@@ -0,0 +1,52 @@
+# include "astro.h"
+
+int crotation (int argc, char **argv) {
+
+  int i;
+  double X, Y, x, y;
+  opihi_flt *xptr, *yptr;
+  Vector *xvec, *yvec;
+  CoordTransform *transform;
+
+  if (argc != 6) {
+    gprint (GP_ERR, "USAGE: crotation (phi) (Xo) (xo) X Y\n");
+    return (FALSE);
+  }
+
+  double phi = atof(argv[1]);
+  double Xo  = atof(argv[2]);
+  double xo  = atof(argv[3]);
+  char *Xname = argv[4];
+  char *Yname = argv[5];
+
+  transform = AllocTransform (phi, Xo, xo);
+  if (SelectScalar (Xname, &X)) {
+    if (!SelectScalar (Yname, &Y)) return (FALSE);
+      
+    ApplyTransform (&x, &y, X, Y, transform);
+
+    gprint (GP_LOG, "%10.6f %10.6f\n", x, y);
+    return (TRUE);
+  }
+
+  /* find vectors */
+  if ((xvec = SelectVector (Xname, OLDVECTOR, TRUE)) == NULL) return (FALSE);
+  if ((yvec = SelectVector (Yname, OLDVECTOR, TRUE)) == NULL) return (FALSE);
+
+  if (xvec[0].Nelements != yvec[0].Nelements) {
+    gprint (GP_ERR, "vectors %s and %s not the same length\n", Xname, Yname);
+    return (FALSE);
+  }
+  
+  CastVector (xvec, OPIHI_FLT);
+  CastVector (yvec, OPIHI_FLT);
+
+  xptr = xvec[0].elements.Flt;
+  yptr = yvec[0].elements.Flt;
+
+  for (i = 0; i < xvec[0].Nelements; i++, xptr++, yptr++) {
+    ApplyTransform (xptr, yptr, *xptr, *yptr, transform);
+  }
+
+  return (TRUE);
+}
Index: /trunk/Ohana/src/opihi/cmd.astro/init.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.astro/init.c	(revision 39244)
+++ /trunk/Ohana/src/opihi/cmd.astro/init.c	(revision 39245)
@@ -9,4 +9,5 @@
 int cneedles                PROTO((int, char **));
 int cplot                   PROTO((int, char **));
+int crotation               PROTO((int, char **));
 int csystem                 PROTO((int, char **));
 int ctimes                  PROTO((int, char **));
@@ -78,4 +79,5 @@
   {1, "cneedles",    cneedles,     "plot vectors in sky coordinates"},
   {1, "cplot",       cplot,        "plot vectors in sky coordinates"},
+  {1, "crotation",   crotation,    "rotate in 3D"},
   {1, "csystem",     csystem,      "convert between coordinate systems"},
   {1, "ctimes",      ctimes,       "convert between time formats"},
Index: /trunk/Ohana/src/opihi/cmd.data/gaussdeviate.c
===================================================================
--- /trunk/Ohana/src/opihi/cmd.data/gaussdeviate.c	(revision 39244)
+++ /trunk/Ohana/src/opihi/cmd.data/gaussdeviate.c	(revision 39245)
@@ -31,4 +31,8 @@
 int gaussintegral (int argc, char **argv) {
   
+  gprint (GP_ERR, "fix gaussintegral\n");
+  return (FALSE);
+
+/*
   int i, Npts;
   Vector *vec;
@@ -53,4 +57,5 @@
   gprint (GP_ERR, "USAGE: gaussintegral Npts mean sigma\n");
   return (FALSE);
+*/
     
 }
