private static < T > IntPair findBridgeIndexes ( PSArray < Point2D < T > > earlyHull , PSArray < Point2D < T > > laterHull , int earlyStart , int laterStart , MultipliableNumberSystem < T > ns ) { int early = earlyStart ; int later = laterStart ; while ( true ) { int nextEarly = getPreIndex ( early , earlyHull . size ( ) ) ; int nextLater = getNextIndex ( later , laterHull . size ( ) ) ; if ( LeftTurn . is ( laterHull . get ( later ) , earlyHull . get ( early ) , earlyHull . get ( nextEarly ) , ns ) ) early = nextEarly ; else if ( RightTurn . is ( earlyHull . get ( early ) , laterHull . get ( later ) , laterHull . get ( nextLater ) , ns ) ) later = nextLater ; else break ; } return new IntPair ( early , later ) ; }
early later are ordered by ccw order .