def PointIsOk coords num result True coords num coords num del coords

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
def PointIsOk(coords,num):
result = True
x = coords[num]["x"]
y = coords[num]["y"]
del coords[num]
length = len(coords)
for i in range(0,length):
j = i-1
ix = coords[i]["x"]
iy = coords[i]["y"]
jx = coords[j]["x"]
jy = coords[j]["y"]
if (((iy<jy) & (iy<=y) & (y<=jy) & (jy-iy)*(x-ix)>(jx-ix)*(y-iy)) |
((iy>jy) & (jy<=y) & (y<=iy) & (jy-iy)*(x-ix)<(jx-ix)*(y-iy))
):
result = not result
return result