title: Line Segment Intersection (Crossing only, no touching)
body: <p>I try to find "Line Segment Crossings". So I want the below function to return true only if both lines really cross each other, not if they start/end on the same points. From what I read there seems to be a kinda "trivial" mathmatical solution to that, but where ever this was mentioned, it wasnt really explained in a way I could comprehend.</p>
  
  <p>Below is a function that correctly detects Segment Intersection, including "touching" points. Is there an easy way to modify it to my needs?</p>
  
  <p>Would really appreciate your help!</p>
  
  <pre><code>inline double Dot(sf::Vector2f a, sf::Vector2f  b) { return (a.x*b.x) + (a.y*b.y); }
  inline double PerpDot(sf::Vector2f a, sf::Vector2f b) { return (a.y*b.x) - (a.x*b.y); }
  
  static bool LineCollision(const sf::Vector2f A1, const sf::Vector2f A2,
      const sf::Vector2f B1, const sf::Vector2f B2,
      double* out = 0)
  {
      sf::Vector2f a(A2 - A1);
      sf::Vector2f b(B2 - B1);
  
      double f = PerpDot(a, b);
      if (!f)      // lines are parallel
          return false;
  
      sf::Vector2f c(B2 - A2);
      double aa = PerpDot(a, c);
      double bb = PerpDot(b, c);
  
      if (f &lt; 0)
      {
          if (aa &gt; 0)     return false;
          if (bb &gt; 0)     return false;
          if (aa &lt; f)     return false;
          if (bb &lt; f)     return false;
      }
      else
      {
          if (aa &lt; 0)     return false;
          if (bb &lt; 0)     return false;
          if (aa &gt; f)     return false;
          if (bb &gt; f)     return false;
      }
  
      if (out)
          *out = 1.0 - (aa / f);
      return true;
  }
  </code></pre>