private boolean initializeScore ( List < Point2D_I32 > contour , boolean loops ) { // Score each side Element < Corner > e = list . getHead ( ) ; Element < Corner > end = loops ? null : list . getTail ( ) ; while ( e != end ) { if ( convex && ! isSideConvex ( contour , e ) ) return false ; Element < Corner > n = e . next ; double error ; if ( n == null ) { error = computeSideError ( contour , e . object . index , list . getHead ( ) . object . index ) ; } else { error = computeSideError ( contour , e . object . index , n . object . index ) ; } e . object . sideError = error ; e = n ; } // Compute what would happen if a side was split e = list . getHead ( ) ; while ( e != end ) { computePotentialSplitScore ( contour , e , list . size ( ) < minSides ) ; e = e . next ; } return true ; }
Computes the score and potential split for each side