aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/apphot/polyphot/apyshift.x
diff options
context:
space:
mode:
Diffstat (limited to 'noao/digiphot/apphot/polyphot/apyshift.x')
-rw-r--r--noao/digiphot/apphot/polyphot/apyshift.x41
1 files changed, 41 insertions, 0 deletions
diff --git a/noao/digiphot/apphot/polyphot/apyshift.x b/noao/digiphot/apphot/polyphot/apyshift.x
new file mode 100644
index 00000000..4fd56cbe
--- /dev/null
+++ b/noao/digiphot/apphot/polyphot/apyshift.x
@@ -0,0 +1,41 @@
+include "../lib/apphot.h"
+include "../lib/polyphot.h"
+
+# AP_YSHIFT -- Shift a polygon to a new center position.
+
+procedure ap_yshift (py, im, x, y, nver, newx, newy)
+
+pointer py # pointer to the polyphot structure
+pointer im # the input image descriptor
+real x[ARB] # x coordinates of the vertices
+real y[ARB] # y coordinates of the vertices
+int nver # number of vertices
+real newx, newy # new x and y coordinates of center
+
+real xshift, yshift
+real apstatr()
+int apstati()
+
+begin
+ call apsetr (py, PYX, apstatr (py, PYCX))
+ call apsetr (py, PYY, apstatr (py, PYCY))
+
+ xshift = newx - apstatr (py, PYCX)
+ yshift = newy - apstatr (py, PYCY)
+ call aaddkr (x, xshift, x, nver)
+ call aaddkr (y, yshift, y, nver)
+ call apsetr (py, PYCX, newx)
+ call apsetr (py, PYCY, newy)
+
+ switch (apstati(py,WCSOUT)) {
+ case WCS_WORLD, WCS_PHYSICAL:
+ call ap_ltoo (py, newx, newy, xshift, yshift, 1)
+ case WCS_TV:
+ call ap_ltov (im, newx, newy, xshift, yshift, 1)
+ default:
+ xshift = newx
+ yshift = newy
+ }
+ call apsetr (py, OPYCX, xshift)
+ call apsetr (py, OPYCY, yshift)
+end