title: Algorithm to find diagonals in a set of 6 segments defined by 4 points forming a convex quadrilateral
body: <p>here's a simple problem of 2D computational geometry that I've been unsuccessful to solve:</p>
  
  <pre><code>we have four points A, B, C, D defining a CONVEX QUADRILATERAL 
  
  (not a square or a rectangle!)
  
  we know the (x, y) coordinates of each point.
  </code></pre>
  
  <p>There are 6 segments connecting 2 points:</p>
  
  <pre><code>AB, AC, AD, BC, BD, CD
  </code></pre>
  
  <p>One of the intersections of these segments will form a point inside the figure: the intersection of the two diagonals.</p>
  
  <p>There are 3 possible for couples of diagonals:</p>
  
  <pre><code>[AB] and [CD]
  [AC] and [BD]
  [AD] and [BC]
  </code></pre>
  
  <p>(see the figure below)</p>
  
  <p><img src="https://i.stack.imgur.com/4CYnp.png" alt="illustration"></p>
  
  <p>I am searching for a simple algorithm to find which of the 3 possible cases is happening when I vary the (x, y) coordinates of A, B, C, D</p>