MCPcopy Create free account
hub / github.com/Image-Py/imagepy / snap

Method snap

imagepy/tools/Measure/coordinate_tol.py:24–30  ·  view source on GitHub ↗
(self, x, y, lim)

Source from the content-addressed store, hash-verified

22 self.body.append(p)
23
24 def snap(self, x, y, lim):
25 cur, minl = None, 1000
26 for i in self.body:
27 d = (i[0]-x)**2+(i[1]-y)**2
28 if d < minl:cur,minl = i,d
29 if minl**0.5>lim:return None
30 return self.body.index(cur)
31
32 def pick(self, x, y, lim):
33 return self.snap(x, y, lim)

Callers 2

pickMethod · 0.95
mouse_moveMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected