Method: RTree#update!

Defined in:
lib/rtree.rb

#update! {|id, coords| ... } ⇒ self

Note:

In the C library, the implementation (via a C callback function) is much faster than rebuilding the R-tree; in this Ruby interface the callback must convert C floats to Ruby, yield them to the block and then convert the returned Ruby Floats to C; so we would expect that it loses much of its competitive advantage when compared to an R-tree rebuild.

Update the RTree. Modifies the rectangles in-place without changing the tree structure. Provided that the changes are small, the search efficiency should be close to that of freshly built RTree.

Examples:

Shift all rectangles by ε

rtree.update! { |id, coords| coords.map { |x| x + ε } }

Yield Parameters:

Yield Returns:

  • (Array<Float>)

    the modified rectangle extent

Returns:

  • (self)


371
372
373
# File 'lib/rtree.rb', line 371

def update!
  super
end