aboutsummaryrefslogtreecommitdiff
path: root/pkg/xtools/icfit/icgaddd.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /pkg/xtools/icfit/icgaddd.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'pkg/xtools/icfit/icgaddd.x')
-rw-r--r--pkg/xtools/icfit/icgaddd.x50
1 files changed, 50 insertions, 0 deletions
diff --git a/pkg/xtools/icfit/icgaddd.x b/pkg/xtools/icfit/icgaddd.x
new file mode 100644
index 00000000..b32c6b5a
--- /dev/null
+++ b/pkg/xtools/icfit/icgaddd.x
@@ -0,0 +1,50 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <gset.h>
+
+define MSIZE 2. # Mark size
+
+# ICG_ADD -- Add a point.
+
+procedure icg_addd (gp, wx, wy, wt, x, y, w1, w2, npts)
+
+pointer gp # GIO pointer
+real wx # X point to insert
+real wy # Y point to insert
+real wt # Weight of point to add
+double x[npts] # Independent variable
+double y[npts] # Dependent variable
+double w1[npts] # Current weights
+double w2[npts] # Initial weights
+int npts # Number of points
+
+int i, j
+
+begin
+ # Find the place to insert the new point.
+ if (x[1] < x[npts])
+ for (i = npts; (i > 0) && (wx < x[i]); i = i - 1)
+ ;
+ else
+ for (i = npts; (i > 0) && (wx > x[i]); i = i - 1)
+ ;
+
+ # Shift the data to insert the new point.
+ for (j = npts; j > i; j = j - 1) {
+ x[j+1] = x[j]
+ y[j+1] = y[j]
+ w1[j+1] = w1[j]
+ w2[j+1] = w2[j]
+ }
+
+ # Add the new point and increment the number of points.
+ i = i + 1
+ x[i] = wx
+ y[i] = wy
+ w1[i] = wt
+ w2[i] = wt
+ npts = npts + 1
+
+ # Mark the point
+ call gmark (gp, real (x[i]), real (y[i]), GM_PLUS, MSIZE, MSIZE)
+end