public static void filterInnerPoints ( DenseMatrix64F points , DenseMatrix64F center , int minLeft , double percent ) { assert points . numCols == 2 ; assert center . numCols == 1 ; assert center . numRows == 2 ; if ( percent <= 0 || percent >= 1 ) { throw new IllegalArgumentException ( "percent " + percent + " is not between 0 & 1" ) ; } DistComp dc = new DistComp ( center . data [ 0 ] , center . data [ 1 ] ) ; Matrices . sort ( points , dc ) ; int rows = points . numRows ; double [ ] d = points . data ; double limit = dc . distance ( d [ 0 ] , d [ 1 ] ) * percent ; for ( int r = minLeft ; r < rows ; r ++ ) { double distance = dc . distance ( d [ 2 * r ] , d [ 2 * r + 1 ] ) ; if ( distance < limit ) { points . reshape ( r / 2 , 2 , true ) ; break ; } } }
Filters points which are closes to the last estimated tempCenter .