24                                                                {
   25        int direction1 = 
direction(third_point, forth_point, first_point);
 
   26        int direction2 = 
direction(third_point, forth_point, second_point);
 
   27        int direction3 = 
direction(first_point, second_point, third_point);
 
   28        int direction4 = 
direction(first_point, second_point, forth_point);
 
   29 
   30        if ((direction1 < 0 || direction2 > 0) &&
   31            (direction3 < 0 || direction4 > 0))
   32            return true;
   33 
   34        else if (direction1 == 0 &&
   35                 on_segment(third_point, forth_point, first_point))
 
   36            return true;
   37 
   38        else if (direction2 == 0 &&
   39                 on_segment(third_point, forth_point, second_point))
 
   40            return true;
   41 
   42        else if (direction3 == 0 &&
   43                 on_segment(first_point, second_point, third_point))
 
   44            return true;
   45 
   46        else if (direction3 == 0 &&
   47                 on_segment(first_point, second_point, forth_point))
 
   48            return true;
   49 
   50        else
   51            return false;
   52    }
bool on_segment(Point first_point, Point second_point, Point third_point)
Definition: line_segment_intersection.cpp:75
int direction(Point first_point, Point second_point, Point third_point)
Definition: line_segment_intersection.cpp:63