protected boolean clipToInsideHrect ( KDTreeNode node , Instance x ) { boolean inside = true ; for ( int i = 0 ; i < m_Instances . numAttributes ( ) ; i ++ ) { // TODO treat nominals differently!?? if ( x . value ( i ) < node . m_NodeRanges [ i ] [ MIN ] ) { x . setValue ( i , node . m_NodeRanges [ i ] [ MIN ] ) ; inside = false ; } else if ( x . value ( i ) > node . m_NodeRanges [ i ] [ MAX ] ) { x . setValue ( i , node . m_NodeRanges [ i ] [ MAX ] ) ; inside = false ; } } return inside ; }
Finds the closest point in the hyper rectangle to a given point . Change the given point to this closest point by clipping of at all the dimensions to be clipped of . If the point is inside the rectangle it stays unchanged . The return value is true if the point was not changed so the the return value is true if the point was inside the rectangle .