protected boolean mergeSegments ( ) { // can't merge a single line if ( splits . size <= 2 ) return false ; boolean change = false ; work . reset ( ) ; // first point is always at the start work . add ( splits . data [ 0 ] ) ; for ( int i = 0 ; i < splits . size - 2 ; i ++ ) { if ( selectSplitBetween ( splits . data [ i ] , splits . data [ i + 2 ] ) < 0 ) { // merge the two lines by not adding it change = true ; } else { work . add ( splits . data [ i + 1 ] ) ; } } // and end work . add ( splits . data [ splits . size - 1 ] ) ; // swap the two lists GrowQueue_I32 tmp = work ; work = splits ; splits = tmp ; return change ; }
Merges lines together which have an acute angle less than the threshold .