geokdtree.kdtree
1from .core import kdtree, closest_point 2 3class KDTree: 4 def __init__(self, points): 5 """ 6 Function: 7 8 - Build a KDTree from a list of n dimensional cartesian points. 9 10 Required Arguments: 11 12 - `points` 13 - Type: list of tuples 14 - What: A list of n dimensional cartesian points to build the KDTree from 15 16 Returns: 17 18 - A KDTree object that can be used to find the closest point to a given point. 19 """ 20 self.tree = kdtree(points, depth=0, axis_count=len(points[0])) 21 22 def closest_point(self, point): 23 """ 24 Function: 25 26 - Find the closest point in the KDTree to a given point. 27 28 Required Arguments: 29 30 - `point` 31 - Type: tuple 32 - What: The point to find the closest point to 33 34 Returns: 35 36 - The closest point found in the KDTree to the given point. 37 """ 38 return closest_point(self.tree, point)[0]
class
KDTree:
4class KDTree: 5 def __init__(self, points): 6 """ 7 Function: 8 9 - Build a KDTree from a list of n dimensional cartesian points. 10 11 Required Arguments: 12 13 - `points` 14 - Type: list of tuples 15 - What: A list of n dimensional cartesian points to build the KDTree from 16 17 Returns: 18 19 - A KDTree object that can be used to find the closest point to a given point. 20 """ 21 self.tree = kdtree(points, depth=0, axis_count=len(points[0])) 22 23 def closest_point(self, point): 24 """ 25 Function: 26 27 - Find the closest point in the KDTree to a given point. 28 29 Required Arguments: 30 31 - `point` 32 - Type: tuple 33 - What: The point to find the closest point to 34 35 Returns: 36 37 - The closest point found in the KDTree to the given point. 38 """ 39 return closest_point(self.tree, point)[0]
KDTree(points)
5 def __init__(self, points): 6 """ 7 Function: 8 9 - Build a KDTree from a list of n dimensional cartesian points. 10 11 Required Arguments: 12 13 - `points` 14 - Type: list of tuples 15 - What: A list of n dimensional cartesian points to build the KDTree from 16 17 Returns: 18 19 - A KDTree object that can be used to find the closest point to a given point. 20 """ 21 self.tree = kdtree(points, depth=0, axis_count=len(points[0]))
Function:
- Build a KDTree from a list of n dimensional cartesian points.
Required Arguments:
points- Type: list of tuples
- What: A list of n dimensional cartesian points to build the KDTree from
Returns:
- A KDTree object that can be used to find the closest point to a given point.
def
closest_point(self, point):
23 def closest_point(self, point): 24 """ 25 Function: 26 27 - Find the closest point in the KDTree to a given point. 28 29 Required Arguments: 30 31 - `point` 32 - Type: tuple 33 - What: The point to find the closest point to 34 35 Returns: 36 37 - The closest point found in the KDTree to the given point. 38 """ 39 return closest_point(self.tree, point)[0]
Function:
- Find the closest point in the KDTree to a given point.
Required Arguments:
point- Type: tuple
- What: The point to find the closest point to
Returns:
- The closest point found in the KDTree to the given point.