Index: trunk/Ohana/src/libdvo/include/dvo.h
===================================================================
--- trunk/Ohana/src/libdvo/include/dvo.h	(revision 27588)
+++ trunk/Ohana/src/libdvo/include/dvo.h	(revision 27817)
@@ -443,4 +443,5 @@
 void sort_image_subset (Image *image, off_t *subset, off_t N);
 void sort_coords_index (double *X, double *Y, off_t *S, off_t N);
+void sort_coords_indexonly (double *X, double *Y, off_t *S, off_t N);
 void sort_regions (SkyRegion *region, off_t N);
 
Index: trunk/Ohana/src/libdvo/src/dvosorts.c
===================================================================
--- trunk/Ohana/src/libdvo/src/dvosorts.c	(revision 27588)
+++ trunk/Ohana/src/libdvo/src/dvosorts.c	(revision 27817)
@@ -46,4 +46,19 @@
 }
 
+/* sort a coordinate pair (X,Y) and the associated index (S) */
+void sort_coords_indexonly (double *X, double *Y, off_t *S, off_t N) {
+  
+# define SWAPFUNC(A,B){ off_t itmp; \
+  itmp = S[A]; S[A] = S[B]; S[B] = itmp; \
+}
+# define COMPARE(A,B)(X[S[A]] < X[S[B]])
+
+  OHANA_SORT (N, COMPARE, SWAPFUNC);
+
+# undef SWAPFUNC
+# undef COMPARE
+
+}
+
 void sort_regions (SkyRegion *region, off_t N) {
 
