Hi Tim,

Just off the top of my head this might get you started (email lingo, watch for typos)

on getNearestPoint aListOfPoints, aRefPoint
  d = the maxInteger
  tWhichPoint = 0

  repeat with i in aListOfPoints
    a = aRefPoint[1] - i[1]
    b = aRefPoint[2] - i [2]
    c = a*a + b*b
    if c < d then
      tWhichPoint = aListOfPoints.getOne(i)
    end if
  end repeat

  return tWhichPoint

end

hth,

Rob


On Tue, 11 Apr 2006 19:26:13 +0100, Tim Welford <[EMAIL PROTECTED]> wrote:


I need to find the closest one (radius) to any given point - i.e. the
mouseLoc - it needs to be fairly efficient as I will need to do it every
frame \ couple of frames.

Can someone point me in the right direction please.

[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
lingo-l@penworks.com  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to