public class QuadTreeFloat extends Object implements Pool.Poolable
| Modifier and Type | Field and Description |
|---|---|
int |
count
The number of elements stored in
values (3 values per quad tree entry). |
int |
depth |
static int |
DISTSQR |
float |
height |
int |
maxDepth |
int |
maxValues |
QuadTreeFloat |
ne |
QuadTreeFloat |
nw |
QuadTreeFloat |
se |
QuadTreeFloat |
sw |
static int |
VALUE |
float[] |
values
For each entry, stores the value, x, and y.
|
float |
width |
float |
x |
static int |
X |
float |
y |
static int |
Y |
| Constructor and Description |
|---|
QuadTreeFloat()
Creates a quad tree with 16 for maxValues and 8 for maxDepth.
|
QuadTreeFloat(int maxValues,
int maxDepth) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(float value,
float valueX,
float valueY) |
boolean |
nearest(float x,
float y,
FloatArray result) |
void |
query(float centerX,
float centerY,
float radius,
FloatArray results) |
void |
reset()
Resets the object for reuse.
|
void |
setBounds(float x,
float y,
float width,
float height) |
public static final int VALUE
public static final int X
public static final int Y
public static final int DISTSQR
public final int maxValues
public final int maxDepth
public float x
public float y
public float width
public float height
public int depth
@Null public QuadTreeFloat nw
@Null public QuadTreeFloat ne
@Null public QuadTreeFloat sw
@Null public QuadTreeFloat se
public float[] values
public int count
values (3 values per quad tree entry).public QuadTreeFloat()
public QuadTreeFloat(int maxValues,
int maxDepth)
maxValues - The maximum number of values stored in each quad tree node. When exceeded, the node is split into 4 child
nodes. If the maxDepth has been reached, more than maxValues may be stored.maxDepth - The maximum depth of the tree nodes. Nodes at the maxDepth will not be split and may store more than
maxValues number of entries.public void setBounds(float x,
float y,
float width,
float height)
public void add(float value,
float valueX,
float valueY)
public void query(float centerX,
float centerY,
float radius,
FloatArray results)
public boolean nearest(float x,
float y,
FloatArray result)
result - For the entry nearest to the specified point, the value, x, y, and square of the distance to the value are
added to this array after it is cleared. See VALUE, X, Y, and DISTSQR.public void reset()
Pool.Poolablereset in interface Pool.PoolableCopyright © 2021. All rights reserved.