rtree
rtree tcl package
Tcl package to implement an efficient rtree spatial search data structure, wrapping the C implementation of https://github.com/tidwall/rtree.c using swig.
To use it see the higher level procs of rtree.tcl
#to create and delete a rtree NewRtree <dimension> DeleteRtree <rtree>
#to add points to the rtree RtreeInsertPoints2D { rtree points ids } RtreeInsertPoints3D { rtree points ids } RtreeInsertPoint { rtree coordinates id }
#to ask for the points inside the rectangle RtreeSearch { rtree rectangle_corners }
#to create auxiliary rectangle (2D) or box (3D) NewRectangle <x0> <y0> <x1> <y1> SetRectangle { rect x0 y0 x1 y1} DeleteRectangle { rect }
NewBox {x0 y0 z0 x1 y1 z1} SetBox { rect x0 y0 z0 x1 y1 z1}
proc Test3D { } {
set rtree [NewRtree 3]
set points {1.0 1.0 0.8 1.5 2.0 0.8 1.1 0.9 0.8}
set ids {1 2 3}
RtreeInsertPoints3D $rtree $points $ids
set result [RtreeSearch $rtree {0.5 0.5 0.5 1.5 1.5 1.5}] DeleteRtree $rtree
#puts $result return $result
}