Index: trunk/doc/pslib/psLibADD.tex
===================================================================
--- trunk/doc/pslib/psLibADD.tex	(revision 1090)
+++ trunk/doc/pslib/psLibADD.tex	(revision 1208)
@@ -1,3 +1,3 @@
-%%% $Id: psLibADD.tex,v 1.20 2004-06-25 03:04:46 eugene Exp $
+%%% $Id: psLibADD.tex,v 1.21 2004-07-12 22:18:39 eugene Exp $
 \documentclass[panstarrs]{panstarrs}
 
@@ -685,4 +685,32 @@
 sum is renormalized by the ratio (12.57/16.00).
 
+\paragraph{Image Rotation}
+
+Image rotation can be performed in two possible ways under different
+circumstances, identified in the following discussion.
+
+In the simplest case, the rotation angle is an integer multiple of 90
+degrees ($\pi/2$ rad).  In these cases, the input and output pixels
+have a one-to-one mapping.  If the input image has dimensions of $N_x,
+N_y$, then the output image will have dimensions of either $N_x, N_y$
+(for even multiples of 90 degrees) or $N_y, N_x$ (for odd multiples).
+
+If the angle of the rotation is not a multiple of 90, then the output
+pixels necessarily result from the interpolation of several input
+pixels.  In this case, for an input image of dimensions $N_x, N_y$ and
+rotation angle $\theta$, the output image has dimensions $Lx = |N_x
+\cos \theta| + |N_y \sin \theta|$ and $Ly = |N_x \sin \theta| + |N_y
+\cos \theta|$, each dimension rounded up to the nearest integer as
+needed.  Every pixel in the output image is in general derived from an
+interpolation over 4 neighboring pixels.  The coordinate of a pixel in
+the output image ($i,j$) corresponds to a fractional pixel coordinate
+($x,y$) in the input image according to:
+\[ x = (i - i_o)*\cos\theta + (j - j_o)*\sin\theta \]
+\[ y = (i_o - i)*\sin\theta + (j - j_o)*\cos\theta \]
+where the offset coordinate ($i_o,j_o$) depends on the sign of the
+sine of the angle $\theta$.  If the sign of that sine is positive, the
+offset coordinate is ($N_y\sin\theta$,0), otherwise it is
+(0,$-N_x\sin\theta$).
+
 \subsubsection{Celestial Coordinate Conversions}
 
@@ -692,8 +720,8 @@
   PSLib function             & SLALIB function \\ \hline
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-  \code{psCoordinatesItoE()} & \code{sla_EQECL} \\
-  \code{psCoordinatesEtoI()} & \code{sla_ECLEQ} \\
-  \code{psCoordinatesItoG()} & \code{sla_EQGAL} \\
-  \code{psCoordinatesGtoI()} & \code{sla_GALEQ} \\
+  \code{psCoordinatesICRSToEcliptic()} & \code{sla_EQECL} \\
+  \code{psCoordinatesEclipticToICRS()} & \code{sla_ECLEQ} \\
+  \code{psCoordinatesICRSToGalactic()} & \code{sla_EQGAL} \\
+  \code{psCoordinatesGalacticToICRS()} & \code{sla_GALEQ} \\
 \end{tabular}
 
@@ -778,4 +806,45 @@
 {\rm where}\hspace{1cm} z & \equiv & \sqrt{1 - (x\pi/720^\circ)^2 - (y\pi/360^\circ)^2}
 \end{eqnarray}
+
+\subsubsection{Offset}
+
+Coordinate offsets can either spherical offsets or linear offsets.  
+
+A spherical offset is performed by adding the components of the
+offset, after unit conversion, to the given position.  The resulting
+coordinates must be wrapped to within the allowed range ($-\pi$ to
+$\pi$, 0 to $2\pi$).
+
+A linear offset is defined to be a linear offset in a tangent
+projection centered on the starting coordinate with $y$ axis aligned
+with the local direction or increasing Declination.  This projection
+is undefined only for the coordinates exactly at the north and south
+poles, in which case the orientation is defined to have the $y$ axis
+parallel to the line of RA = 0.0.  The scale of the projection is 1.0
+(ie, 1 'pixel' is 1 radian) and the given offsets must the scaled
+based on the given offset units.  
+
+Pseudo-code to implement the above for an offset:
+
+\begin{verbatim}
+psSphere *psSphereSetOffset (psSphere pos, psSphere offset) {
+
+  psPlane lin;
+  psSphere new;
+  psProjection proj;
+
+  proj.R = pos->r;
+  proj.D = pos->d;
+  proj.X = 0;
+  proj.Y = 0;
+  proj.type = PS_PROJ_TAN;
+
+  lin.x = offset.r;
+  lin.y = offset.d;
+
+  new = psDeproject (&lin, &proj);
+  return (new);
+}
+\end{verbatim}
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
