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

Method snap

imagepy/tools/Measure/area_tol.py:32–39  ·  view source on GitHub ↗
(self, x, y, lim)

Source from the content-addressed store, hash-verified

30 self.buf = []
31
32 def snap(self, x, y, lim):
33 cur, cid, minl = None, None, 1000
34 for pg in self.body:
35 for i in pg:
36 d = (i[0]-x)**2+(i[1]-y)**2
37 if d < minl:cur,cid,minl = pg,i,d
38 if minl**0.5>lim:return None
39 return cur, cur.index(cid)
40
41 def pick(self, x, y, lim):
42 rst = self.snap(x, y, lim)

Callers 11

pickMethod · 0.95
mouse_moveMethod · 0.45
mouse_moveMethod · 0.45
mouse_moveMethod · 0.45
mouse_moveMethod · 0.45
mouse_moveMethod · 0.45
mouse_moveMethod · 0.45
mouse_moveMethod · 0.45
mouse_moveMethod · 0.45
mouse_moveMethod · 0.45
mouse_moveMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected