public boolean is_intersected_interiour_by(PlaSegmentInt p_line_segment){
  PlaPointFloat float_start_point=p_line_segment.start_point_approx();
  PlaPointFloat float_end_point=p_line_segment.end_point_approx();
  PlaSide[] border_line_side_of_start_point_arr=new PlaSide[border_line_count()];
  PlaSide[] border_line_side_of_end_point_arr=new PlaSide[border_line_side_of_start_point_arr.length];
  for (int index=0; index < border_line_side_of_start_point_arr.length; ++index) {
    PlaLineInt curr_border_line=border_line(index);
    PlaSide border_line_side_of_start_point=curr_border_line.side_of(float_start_point,1);
    if (border_line_side_of_start_point == PlaSide.COLLINEAR) {
      border_line_side_of_start_point=curr_border_line.side_of(p_line_segment.start_point());
    }
    PlaSide border_line_side_of_end_point=curr_border_line.side_of(float_end_point,1);
    if (border_line_side_of_end_point == PlaSide.COLLINEAR) {
      border_line_side_of_end_point=curr_border_line.side_of(p_line_segment.end_point());
    }
    if (border_line_side_of_start_point != PlaSide.ON_THE_RIGHT && border_line_side_of_end_point != PlaSide.ON_THE_RIGHT) {
      return false;
    }
    border_line_side_of_start_point_arr[index]=border_line_side_of_start_point;
    border_line_side_of_end_point_arr[index]=border_line_side_of_end_point;
  }
  boolean start_point_is_inside=true;
  for (int i=0; i < border_line_side_of_start_point_arr.length; ++i) {
    if (border_line_side_of_start_point_arr[i] != PlaSide.ON_THE_RIGHT) {
      start_point_is_inside=false;
      break;
    }
  }
  if (start_point_is_inside) {
    return true;
  }
  boolean end_point_is_inside=true;
  for (int i=0; i < border_line_side_of_end_point_arr.length; ++i) {
    if (border_line_side_of_end_point_arr[i] != PlaSide.ON_THE_RIGHT) {
      end_point_is_inside=false;
      break;
    }
  }
  if (end_point_is_inside) {
    return true;
  }
  PlaLineInt segment_line=p_line_segment.get_line();
  for (int index=0; index < border_line_side_of_start_point_arr.length; ++index) {
    PlaSide border_line_side_of_start_point=border_line_side_of_start_point_arr[index];
    PlaSide border_line_side_of_end_point=border_line_side_of_end_point_arr[index];
    if (border_line_side_of_start_point != border_line_side_of_end_point) {
      if (border_line_side_of_start_point == PlaSide.COLLINEAR && border_line_side_of_end_point == PlaSide.ON_THE_LEFT || border_line_side_of_end_point == PlaSide.COLLINEAR && border_line_side_of_start_point == PlaSide.ON_THE_LEFT) {
        continue;
      }
      PlaSide prev_corner_side=segment_line.side_of(corner_approx(index),1);
      if (prev_corner_side == PlaSide.COLLINEAR) {
        prev_corner_side=segment_line.side_of(corner(index));
      }
      int next_corner_index;
      if (index == border_line_side_of_start_point_arr.length - 1) {
        next_corner_index=0;
      }
 else {
        next_corner_index=index + 1;
      }
      PlaSide next_corner_side=segment_line.side_of(corner_approx(next_corner_index),1);
      if (next_corner_side == PlaSide.COLLINEAR) {
        next_corner_side=segment_line.side_of(corner(next_corner_index));
      }
      if (prev_corner_side == PlaSide.ON_THE_LEFT && next_corner_side == PlaSide.ON_THE_RIGHT || prev_corner_side == PlaSide.ON_THE_RIGHT && next_corner_side == PlaSide.ON_THE_LEFT) {
        return true;
      }
    }
  }
  return false;
}

public boolean is_intersected_interiour_by ( PlaSegmentInt p_line_segment ) { PlaPointFloat float_start_point = p_line_segment . start_point_approx ( ) ; PlaPointFloat float_end_point = p_line_segment . end_point_approx ( ) ; PlaSide [ ] border_line_side_of_start_point_arr = new PlaSide [ border_line_count ( ) ] ; PlaSide [ ] border_line_side_of_end_point_arr = new PlaSide [ border_line_side_of_start_point_arr . length ] ; for ( int index = 0 ; index < border_line_side_of_start_point_arr . length ; ++ index ) { PlaLineInt curr_border_line = border_line ( index ) ; PlaSide border_line_side_of_start_point = curr_border_line . side_of ( float_start_point , 1 ) ; if ( border_line_side_of_start_point == PlaSide . COLLINEAR ) { border_line_side_of_start_point = curr_border_line . side_of ( p_line_segment . start_point ( ) ) ; } PlaSide border_line_side_of_end_point = curr_border_line . side_of ( float_end_point , 1 ) ; if ( border_line_side_of_end_point == PlaSide . COLLINEAR ) { border_line_side_of_end_point = curr_border_line . side_of ( p_line_segment . end_point ( ) ) ; } if ( border_line_side_of_start_point != PlaSide . ON_THE_RIGHT && border_line_side_of_end_point != PlaSide . ON_THE_RIGHT ) { return false ; } border_line_side_of_start_point_arr [ index ] = border_line_side_of_start_point ; border_line_side_of_end_point_arr [ index ] = border_line_side_of_end_point ; } boolean start_point_is_inside = true ; for ( int i = 0 ; i < border_line_side_of_start_point_arr . length ; ++ i ) { if ( border_line_side_of_start_point_arr [ i ] != PlaSide . ON_THE_RIGHT ) { start_point_is_inside = false ; break ; } } if ( start_point_is_inside ) { return true ; } boolean end_point_is_inside = true ; for ( int i = 0 ; i < border_line_side_of_end_point_arr . length ; ++ i ) { if ( border_line_side_of_end_point_arr [ i ] != PlaSide . ON_THE_RIGHT ) { end_point_is_inside = false ; break ; } } if ( end_point_is_inside ) { return true ; } PlaLineInt segment_line = p_line_segment . get_line ( ) ; for ( int index = 0 ; index < border_line_side_of_start_point_arr . length ; ++ index ) { PlaSide border_line_side_of_start_point = border_line_side_of_start_point_arr [ index ] ; PlaSide border_line_side_of_end_point = border_line_side_of_end_point_arr [ index ] ; if ( border_line_side_of_start_point != border_line_side_of_end_point ) { if ( border_line_side_of_start_point == PlaSide . COLLINEAR && border_line_side_of_end_point == PlaSide . ON_THE_LEFT || border_line_side_of_end_point == PlaSide . COLLINEAR && border_line_side_of_start_point == PlaSide . ON_THE_LEFT ) { continue ; } PlaSide prev_corner_side = segment_line . side_of ( corner_approx ( index ) , 1 ) ; if ( prev_corner_side == PlaSide . COLLINEAR ) { prev_corner_side = segment_line . side_of ( corner ( index ) ) ; } int next_corner_index ; if ( index == border_line_side_of_start_point_arr . length - 1 ) { next_corner_index = 0 ; } else { next_corner_index = index + 1 ; } PlaSide next_corner_side = segment_line . side_of ( corner_approx ( next_corner_index ) , 1 ) ; if ( next_corner_side == PlaSide . COLLINEAR ) { next_corner_side = segment_line . side_of ( corner ( next_corner_index ) ) ; } if ( prev_corner_side == PlaSide . ON_THE_LEFT && next_corner_side == PlaSide . ON_THE_RIGHT || prev_corner_side == PlaSide . ON_THE_RIGHT && next_corner_side == PlaSide . ON_THE_LEFT ) { return true ; } } } return false ; }
checks , if p_line_segment has a common point with the interiour of this shape .
