Method: RTree#search

Defined in:
lib/rtree.rb

#search(coords) ⇒ Array<Integer>

Search the RTree

Parameters:

  • coords (Array<Float>)

    the search rectangle, as #add_rect

Returns:

  • (Array<Integer>)

    the ids of all rectangles which intersect the search rectangle. If a block is given then these values will be yielded to the block (one at a time).



345
346
347
348
349
350
351
352
353
# File 'lib/rtree.rb', line 345

def search(coords)
  if block_given? then
    super
  else
    ids = []
    super(coords) { |id| ids << id }
    ids
  end
end