I've the following code snippet. Why do the loop not remove all points from list points
, I'm very confused about that. I mean, all points are in the triangle.
print "check whether",points,"are in triangle"
print "p=",points[0]," is in triangle=",isPointInTri(a,b,c,points[0])
print "p=",points[1]," is in triangle=",isPointInTri(a,b,c,points[1])
for p in points:
if isPointInTri(a,b,c,p):
points.remove(p)
print "now, the following points are available", points
print points
This is the output:
check whether [(2, 1), (4, 1)] are in triangle
p= (2, 1) is in triangle= True
p= (4, 1) is in triangle= True
now, the following points are available [(4, 1)]
[(4, 1)]
Has anyone an idea?