이 python 파일을 실행할 때이 오류가 계속 발생합니다. 여기Float 객체가 할당시 반복 가능하지 않음
p1x, p1y = newList[0]
TypeError: 'Float' object is not iterable
를 코드입니다 : 그것은이 라인에서 발생
newList = []
for i, val in enumerate(poly):
if poly[i] != True:
newList.append(poly[i][0])
n = len(newList)
inside =False
p1x, p1y = newList[0]
for i in range(n+1):
p2x, p2y = newList[i % n]
if y > min(p1y,p2y):
if y <= max(p1y,p2y):
if x <= max(p1x,p2x):
if p1y != p2y:
xinters = (y-p1y)*(p2x-p1x)/(p2y-p1y)+p1x
if p1x == p2x or x <= xinters:
return True
p1x,p1y = p2x,p2y
return inside
왜이다 내가 주변이
p1x = newList[0]
p1y = newList[0]
작동,하지만 다른 방법을 수행 할 때?