我想知道檢查給定點(眼圖座標)是否位於特定區域(本例中爲圓圈)內的最有效方法。Python/Psychopy:檢查某個點是否在圓圈內
代碼:
win = visual.Window([600,600], allowGUI=False)
coordinate = [50,70] #example x and y coordinates
shape = visual.Circle(win, radius=120, units='pix') #shape to check if coordinates are within it
if coordinate in shape:
print "inside"
else:
print "outside"
>>TypeError: argument of type 'Circle' is not iterable
我的X和Y座標對應於一個點的窗口上,我需要檢查,如果該點落在半徑爲120個像素的圓內。
感謝, 史蒂夫
除了檢查點和中心之間的(平方)距離的直接幾何方法嗎? –