|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.yobotics.simulationconstructionset.util.KDTree
public class KDTree
Use this class to efficiently search for closest points to various test points of interest. The dimensionality of the points is arbitrary (D > 0), and the tree's splitting is binary (K = 2).
Constructor Summary | |
---|---|
KDTree(double[][] points,
int maxPointsInLeaves)
Creates a KDTree from an array of points and an equally sized array of objects. |
|
KDTree(double[][] points,
java.lang.Object[] objects,
int maxPointsInLeaves)
Creates a KDTree from an array of points and an equally sized array of objects. |
|
KDTree(java.lang.String BDITerrainFilePath,
int maxPointsInLeaves)
Creates a KDTree from an array of (X, Y) terrain points and an equally sized array of (Z) terrain heights. |
Method Summary | |
---|---|
java.lang.Object |
closestObject(double[] testPoint)
|
java.lang.Object |
closestObject(double[] testPoint,
double maxDistance)
|
java.util.ArrayList<java.lang.Object> |
closestObjects(double[] testPoint,
int numObjects,
double maxDistance)
|
double[] |
closestPoint(double[] testPoint)
closestPoint |
double[] |
closestPoint(double[] testPoint,
double maxDistance)
|
double[] |
closestPointBruteForceSearch(double[] testPoint)
|
java.util.ArrayList<double[]> |
closestPoints(double[] testPoint,
int numPoints,
double maxDistance)
|
static double |
distanceSquared(double[] point1,
double[] point2)
This is a fast Euclidean distance metric. |
java.lang.Object |
getClosestNovelObject(double[] testPoint,
double maxDistance,
boolean preserveAsNovel)
|
java.util.ArrayList<java.lang.Object> |
getClosestNovelObjects(double[] testPoint,
double maxDistance,
boolean preserveAsNovel)
|
void |
getExtents(double[] min,
double[] max)
|
double[][] |
getPoints()
Returns the list of points. |
static double[][] |
loadPoints3D(java.io.BufferedReader bufferedReader)
Loads terrain data from a BufferedReader and returns the Terrain object represented by the data. |
static double[][] |
loadPoints3D(java.lang.String filename)
Loads an ASCII file of 3D points. |
static void |
main(java.lang.String[] args)
This method tests the KD Tree using a BDI terrain file containing an unordered collection of 3D points. |
KDTree |
prunePointsCopy(double minDistanceBetweenPoints)
|
static void |
testLookupSamePointOnGrid(KDTree kdTree)
Test a KDTree to make sure it returns the same point if you query for each point |
static void |
testLookupSamePointPlusDeltaOnGrid(KDTree kdTree,
double maxDelta,
int skipPoints,
double maxDistance)
Test a KDTree to make sure it gives you back the same point or a closer point if you query for each point plus a small delta |
static void |
testLookupTimingOnGrid(KDTree kdTree,
boolean checkWithBruteForce)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public KDTree(double[][] points, java.lang.Object[] objects, int maxPointsInLeaves)
points
- double[][]objects
- Object[]maxPointsInLeaves
- intpublic KDTree(double[][] points, int maxPointsInLeaves)
points
- double[][]maxPointsInLeaves
- intpublic KDTree(java.lang.String BDITerrainFilePath, int maxPointsInLeaves)
points
- double[][]maxPointsInLeaves
- intMethod Detail |
---|
public double[][] getPoints()
public void getExtents(double[] min, double[] max)
public KDTree prunePointsCopy(double minDistanceBetweenPoints)
public double[] closestPoint(double[] testPoint)
testPoint
- double[]
public double[] closestPoint(double[] testPoint, double maxDistance)
public double[] closestPointBruteForceSearch(double[] testPoint)
public java.lang.Object closestObject(double[] testPoint)
public java.lang.Object closestObject(double[] testPoint, double maxDistance)
public java.util.ArrayList<java.lang.Object> closestObjects(double[] testPoint, int numObjects, double maxDistance)
public java.util.ArrayList<double[]> closestPoints(double[] testPoint, int numPoints, double maxDistance)
public java.lang.Object getClosestNovelObject(double[] testPoint, double maxDistance, boolean preserveAsNovel)
public java.util.ArrayList<java.lang.Object> getClosestNovelObjects(double[] testPoint, double maxDistance, boolean preserveAsNovel)
public static double[][] loadPoints3D(java.lang.String filename)
filename
- String
public static double[][] loadPoints3D(java.io.BufferedReader bufferedReader)
bufferedReader
- BufferedReader
public static double distanceSquared(double[] point1, double[] point2)
point1
- double[]point2
- double[]
public static void main(java.lang.String[] args)
args
- String[]public static void testLookupTimingOnGrid(KDTree kdTree, boolean checkWithBruteForce)
public static void testLookupSamePointOnGrid(KDTree kdTree)
kdTree
- KDTreepublic static void testLookupSamePointPlusDeltaOnGrid(KDTree kdTree, double maxDelta, int skipPoints, double maxDistance)
kdTree
- KDTree
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |