/* identify.c */ /* This software may only be used by you under license from AT&T Corp. ("AT&T"). A copy of AT&T's Source Code Agreement is available at AT&T's Internet website having the URL: If you received this software without first entering into a license with AT&T, you have an infringing copy of this software and cannot use it without violating AT&T's intellectual property rights. */ #include #include "vars.h" #include "externs.h" gint find_nearest_point (icoords *lcursor_pos, splotd *splot, datad *d, ggobid *gg) { /* * Returns index of nearest un-hidden point */ gint i, k, sqdist, near, xdist, ydist, npoint; npoint = -1; near = 20*20; /* If nothing is close, don't show any label */ for (i=0; inrows_in_plot; i++) { if (!d->hidden_now.els[ k=d->rows_in_plot[i] ]) { xdist = splot->screen[k].x - lcursor_pos->x; ydist = splot->screen[k].y - lcursor_pos->y; sqdist = xdist*xdist + ydist*ydist; if (sqdist < near) { near = sqdist; npoint = k; } } } return (npoint); }