X-Git-Url: http://nitlanguage.org diff --git a/lib/geometry/quadtree.nit b/lib/geometry/quadtree.nit index 8c2df3c..0218406 100644 --- a/lib/geometry/quadtree.nit +++ b/lib/geometry/quadtree.nit @@ -55,14 +55,14 @@ abstract class QuadTree[E: Boxed[Numeric]] self.parent_node = parent end - redef fun items_overlapping(region :Boxed[Numeric]): SimpleCollection[E] do - var res = new Array[E] - items_overlapping_in(region,res) - return res - end + redef fun items_overlapping(region): SimpleCollection[E] do + var res = new Array[E] + items_overlapping_in(region,res) + return res + end # add the item to the tree, create children if the limit is reached - redef fun add(item: E) do if self.is_leaf then self.data.add(item) else add_to_children(item) + redef fun add(item) do if self.is_leaf then self.data.add(item) else add_to_children(item) private fun add_to_children(item: Boxed[Numeric]) do @@ -86,14 +86,14 @@ abstract class QuadTree[E: Boxed[Numeric]] else if self.center.y > item.top then self.data.add(item) else if self.center.y < item.bottom then - self.data.add(item) + self.data.add(item) else self.data.add(item) end end end - redef fun is_empty: Bool do return data.is_empty and (self.is_leaf or (child0.is_empty and child1.is_empty and child2.is_empty and child3.is_empty)) + redef fun is_empty do return data.is_empty and (self.is_leaf or (child0.is_empty and child1.is_empty and child2.is_empty and child3.is_empty)) # Return whether or not the Node is a leaf of the tree fun is_leaf: Bool do return child0 == null @@ -209,7 +209,7 @@ end # the center of the parent node class SQuadTree[E: Boxed[Numeric]] super QuadTree[E] - + # the width of the current node of the QuadTree var width: Numeric # the height of the current node of the QuadTree