Just had a bet in the pub I can get the previous script shorter:)))
It's using vector maths (not sure how quick it is but it's shorter code)
on getNearest pList,pCenter
pStartVector = vector(pCenter[1],pCenter[2],0)
pCount = pList.count
if pCount > 0 then
pNearest = 0
repeat with y = 1 to pCount
pVector = vector(pList[y][1],pList[y][2],0)
pDistance = pVector.distanceTo(pStartVector)
if pDistance > pNearest then
pNearest = y
end if
end repeat
return pNearest
end if
End
Damn mobile phone...let me know if it works...beer is at stake:)
[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
[email protected] (Problems, email [EMAIL PROTECTED]). Lingo-L is for
learning and helping with programming Lingo. Thanks!]