include include include define MSIZE 4. # Mark size # SPDELN -- Delete data point nearest the cursor. # The nearest point to the cursor in NDC coordinates is determined. procedure spdeln ( gp, gt, x, y, npts, wx, wy) pointer gp # GIO pointer pointer gt # GTOOLS pointer double x[npts], y[npts] # Data points int npts # Number of points real wx, wy # Position to be nearest int gt_geti() begin if (gt_geti (gt, GTTRANSPOSE) == NO) call spd1d (gp, x, y, npts, wx, wy) else call spd1d (gp, y, x, npts, wy, wx) end # SPD1 -- Do the actual delete. procedure spd1d (gp, x, y, npts, wx, wy) pointer gp # GIO pointer double x[npts], y[npts] # Data points int npts # Number of points real wx, wy # Position to be nearest int i, j real x0, y0, r2, r2min, wx0, wy0 begin # Transform world cursor coordinates to NDC. call gctran (gp, wx, wy, wx0, wy0, 1, 0) # Search for nearest point r2min = MAX_REAL do i = 1, npts { call gctran (gp, real (x[i]), real (y[i]), x0, y0, 1, 0) r2 = (x0 - wx0) ** 2 + (y0 - wy0) ** 2 if (r2 < r2min) { r2min = r2 j = i } } # Mark the deleted point with a cross if (j != 0) { call gscur (gp, real (x[j]), real (y[j])) call gmark (gp, real (x[j]), real (y[j]), GM_CROSS, MSIZE, MSIZE) } # Shift data after deleted point for (i=j; i