public class QuadTreeXys<V extends Xy> extends QuadTree<Collection<V>>
QuadTreeObjects
, but sacrificing generality for search speed.
Values inserted into a QuadTreeXys
must be instances of the Xy
interface.
HotSpot does a better job optimizing v.x()
than this.x(v)
.
This can improve search speed by 10% or more.QuadTree.Accumulator<B>, QuadTree.Node<B>
Constructor and Description |
---|
QuadTreeXys(int maxBucketSize) |
Modifier and Type | Method and Description |
---|---|
void |
add(V v)
If
v.x() or v.y() returns NaN , this method returns
immediately without adding v to the tree. |
void |
remove(V v) |
Collection<V> |
search(float xMin,
float xMax,
float yMin,
float yMax) |
int |
search(float xMin,
float xMax,
float yMin,
float yMax,
Collection<V> results) |
Collection<V> |
search(float xMin,
float xMax,
float yMin,
float yMax,
FilterObject<V> vFilter) |
int |
search(float xMin,
float xMax,
float yMin,
float yMax,
FilterObject<V> vFilter,
Collection<V> results) |
accumulate, leaf, quadrant, truncInf
public Collection<V> search(float xMin, float xMax, float yMin, float yMax)
public int search(float xMin, float xMax, float yMin, float yMax, Collection<V> results)
results
.public Collection<V> search(float xMin, float xMax, float yMin, float yMax, FilterObject<V> vFilter)
public int search(float xMin, float xMax, float yMin, float yMax, FilterObject<V> vFilter, Collection<V> results)
results
.public void add(V v)
v.x()
or v.y()
returns NaN
, this method returns
immediately without adding v
to the tree.public void remove(V v)
Copyright © 2020 Metron, Inc.. All rights reserved.