def query(self,qx2,qy1,qy2):
rv=[]
nsplit,rn=self._findSplittingNode(qy1,qy2)
for n in rn:
if n.p[0]<=qx2 and isInRange(qy1,n.p[1],qy2): rv.append(n.p)
if nsplit is None: return rv
if nsplit.leftChild is None and nsplit.rightChild is None:
rv=rv+self._queryPrioritySubtree(nsplit,qx2)
else:
if nsplit.p[0]<=qx2 and isInRange(qy1,nsplit.p[1],qy2): rv.append(nsplit.p)
n=nsplit.leftChild
while n is not None and n.p[0]<=qx2:
if isInRange(qy1,n.p[1],qy2): rv.append(n.p)
if isInRange(qy1,n.y,qy2):
rv=rv+self._queryPrioritySubtree(n.rightChild,qx2)
n=n.leftChild
else: n=n.rightChild
n=nsplit.rightChild
while n is not None and n.p[0]<=qx2:
if isInRange(qy1,n.p[1],qy2): rv.append(n.p)
if isInRange(qy1,n.y,qy2):
rv=rv+self._queryPrioritySubtree(n.leftChild,qx2)
n=n.rightChild
else: n=n.leftChild
return rv
oni u svojim primjerima daju implementirano za x, a nama treba y