private void remove_concave_corners_at_close(){
  add_corner_for_snap_angle();
  if (corner_list.size() < 4) {
    return;
  }
  PlaPointInt[] corner_arr=new PlaPointInt[corner_list.size()];
  Iterator<PlaPointInt> it=corner_list.iterator();
  for (int i=0; i < corner_arr.length; ++i) {
    corner_arr[i]=it.next();
  }
  int new_length=corner_arr.length;
  PlaPointInt first_corner=corner_arr[0];
  PlaPointInt second_corner=corner_arr[1];
  while (new_length > 3) {
    PlaPointInt last_corner=corner_arr[new_length - 1];
    if (last_corner.side_of(second_corner,first_corner) != PlaSide.ON_THE_LEFT) {
      break;
    }
    --new_length;
  }
  if (new_length != corner_arr.length) {
    corner_list=new java.util.LinkedList<PlaPointInt>();
    for (int i=0; i < new_length; ++i) {
      corner_list.add(corner_arr[i]);
    }
    add_corner_for_snap_angle();
  }
}

private void remove_concave_corners_at_close ( ) { add_corner_for_snap_angle ( ) ; if ( corner_list . size ( ) < 4 ) { return ; } PlaPointInt [ ] corner_arr = new PlaPointInt [ corner_list . size ( ) ] ; Iterator < PlaPointInt > it = corner_list . iterator ( ) ; for ( int i = 0 ; i < corner_arr . length ; ++ i ) { corner_arr [ i ] = it . next ( ) ; } int new_length = corner_arr . length ; PlaPointInt first_corner = corner_arr [ 0 ] ; PlaPointInt second_corner = corner_arr [ 1 ] ; while ( new_length > 3 ) { PlaPointInt last_corner = corner_arr [ new_length - 1 ] ; if ( last_corner . side_of ( second_corner , first_corner ) != PlaSide . ON_THE_LEFT ) { break ; } -- new_length ; } if ( new_length != corner_arr . length ) { corner_list = new java . util . LinkedList < PlaPointInt > ( ) ; for ( int i = 0 ; i < new_length ; ++ i ) { corner_list . add ( corner_arr [ i ] ) ; } add_corner_for_snap_angle ( ) ; } }
removes as many corners at the end of the corner list , so that closing the polygon will not create a concave corner
