#NEWLINE# def __query_ball_point( self , x , r , p = 2.0 , eps = 0 ) : #NEWLINE# #INDENT# R = Rectangle ( self . maxes , self . mins ) #NEWLINE# def traverse_checking( node , rect ) : #NEWLINE# #INDENT# if ( rect . min_distance_point ( x , p ) > ( r / ( 1.0 + eps ) ) ) : #NEWLINE# #INDENT# return [ ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( rect . max_distance_point ( x , p ) < ( r * ( 1.0 + eps ) ) ) : #NEWLINE# #INDENT# return traverse_no_checking ( node ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( node , KDTree . leafnode ) : #NEWLINE# #INDENT# d = self . data [ node . idx ] #NEWLINE# return node . idx [ ( minkowski_distance ( d , x , p ) <= r ) ] . tolist ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# ( less , greater ) = rect . split ( node . split_dim , node . split ) #NEWLINE# return ( traverse_checking ( node . less , less ) + traverse_checking ( node . greater , greater ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# def traverse_no_checking( node ) : #NEWLINE# #INDENT# if isinstance ( node , KDTree . leafnode ) : #NEWLINE# #INDENT# return node . idx . tolist ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return ( traverse_no_checking ( node . less ) + traverse_no_checking ( node . greater ) ) #NEWLINE# #UNINDENT# #UNINDENT# return traverse_checking ( self . tree , R )