Rhoana / pyrtree

An R-Tree implementation
36 stars 19 forks source link

how can i insert the points? #4

Open mvdream opened 4 years ago

adisuissa commented 4 years ago

Here is a short usage example:

from pyrtree import RTree,Rect

obj = [1, 2, 3] # the object we are going to add to the rtree rtree = RTree() # tree creation

pyrtree uses the (x_min, y_min, x_max, y_max) notation

rtree.insert(obj, Rect(7, 15, 10, 20)) # element insertion with a given box

pyrtree uses the (x_min, y_min, x_max, y_max) notation

rect_res = rtree.query_rect( Rect(0, 2, 8, 17) ) for rtree_node in rect_res: if not rtree_node.is_leaf(): continue t = rtree_node.leaf_obj()

t will point to obj, do something with t...