public class KDTreeC
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
KDTreeC.Item
Item, for moving data around.
|
Constructor and Description |
---|
KDTreeC(int dimensions)
Constructor with value for dimensions.
|
KDTreeC(int dimensions,
int bucket)
Constructor with value for dimensions and bucket size.
|
Modifier and Type | Method and Description |
---|---|
void |
add(double[] key,
java.lang.Object val)
Add a key and its associated value to the tree.
|
double |
distance(double[] a,
double[] b)
Compares arrays of double and returns the euclidean distance between
them.
|
double |
distanceSq(double[] a,
double[] b)
Compares arrays of double and returns the squared euclidean distance
between them.
|
KDTreeC.Item[] |
getNearestNeighbor(double[] key,
int num)
Gets the N nearest neighbors to the given key.
|
KDTreeC.Item[] |
getRange(double[] low,
double[] high)
Returns all PointKD within a certain range defined by an upper and lower
PointKD.
|
void |
setScale(double[] sc) |
void |
setScale3(double rx,
double ry,
double rz) |
public KDTreeC(int dimensions)
dimensions
- - Number of dimensionspublic KDTreeC(int dimensions, int bucket)
dimensions
- - Number of dimensionsbucket
- - Size of the buckets.public void setScale(double[] sc)
public void setScale3(double rx, double ry, double rz)
public void add(double[] key, java.lang.Object val)
key
- - Key to addval
- - object to addpublic KDTreeC.Item[] getRange(double[] low, double[] high)
low
- - lower bounds of areahigh
- - upper bounds of areapublic KDTreeC.Item[] getNearestNeighbor(double[] key, int num)
key
- - Keynum
- - Number of resultspublic double distance(double[] a, double[] b)
a
- - The first set of numbersb
- - The second set of numberspublic double distanceSq(double[] a, double[] b)
a
- - The first set of numbersb
- - The second set of numbers