public boolean is_comvex(){
  if (border_line_count() <= 2)   return true;
  PlaPointInt prev_point=corners.get(border_line_count() - 1);
  PlaPointInt curr_point=corners.get(0);
  PlaPointInt next_point=corners.get(1);
  for (int ind=0; ind < border_line_count(); ++ind) {
    if (next_point.side_of(prev_point,curr_point) == PlaSide.ON_THE_RIGHT)     return false;
    prev_point=curr_point;
    curr_point=next_point;
    if (ind == border_line_count() - 2)     next_point=corners.get(0);
 else     next_point=corners.get(ind + 2);
  }
  PlaLineInt first_line=new PlaLineInt(corners.get(border_line_count() - 1),corners.get(0));
  PlaLineInt curr_line=new PlaLineInt(corners.get(0),corners.get(1));
  PlaDirection first_direction=first_line.direction();
  PlaDirection curr_direction=curr_line.direction();
  long last_det=first_direction.determinant(curr_direction);
  for (int ind2=2; ind2 < border_line_count(); ++ind2) {
    curr_line=new PlaLineInt(curr_line.point_b,corners.get(ind2));
    curr_direction=curr_line.direction();
    long curr_det=first_direction.determinant(curr_direction);
    if (last_det <= 0 && curr_det > 0)     return false;
    last_det=curr_det;
  }
  return true;
}

public boolean is_comvex ( ) { if ( border_line_count ( ) <= 2 ) return true ; PlaPointInt prev_point = corners . get ( border_line_count ( ) - 1 ) ; PlaPointInt curr_point = corners . get ( 0 ) ; PlaPointInt next_point = corners . get ( 1 ) ; for ( int ind = 0 ; ind < border_line_count ( ) ; ++ ind ) { if ( next_point . side_of ( prev_point , curr_point ) == PlaSide . ON_THE_RIGHT ) return false ; prev_point = curr_point ; curr_point = next_point ; if ( ind == border_line_count ( ) - 2 ) next_point = corners . get ( 0 ) ; else next_point = corners . get ( ind + 2 ) ; } PlaLineInt first_line = new PlaLineInt ( corners . get ( border_line_count ( ) - 1 ) , corners . get ( 0 ) ) ; PlaLineInt curr_line = new PlaLineInt ( corners . get ( 0 ) , corners . get ( 1 ) ) ; PlaDirection first_direction = first_line . direction ( ) ; PlaDirection curr_direction = curr_line . direction ( ) ; long last_det = first_direction . determinant ( curr_direction ) ; for ( int ind2 = 2 ; ind2 < border_line_count ( ) ; ++ ind2 ) { curr_line = new PlaLineInt ( curr_line . point_b , corners . get ( ind2 ) ) ; curr_direction = curr_line . direction ( ) ; long curr_det = first_direction . determinant ( curr_direction ) ; if ( last_det <= 0 && curr_det > 0 ) return false ; last_det = curr_det ; } return true ; }
checks , if every line segment between 2 points of the shape is contained completely in the shape .
