我想知道检查给定点(眼图坐标)是否位于特定区域(本例中为圆圈)内的最有效方法。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个像素的圆内。
感谢, 史蒂夫
除了检查点和中心之间的(平方)距离的直接几何方法吗? –