title: Is there a good way to check if segments overlap in a PathFigure in WPF?
body: <p>I'm working on a control in WPF to draw area shapes using the different segment types (arc, bezier, line segment) and want to keep them from creating area shapes that are complex.  That is to say shapes where the edges overlap.</p>
  
  <p>I am working with a <code>PathGeometry</code> generated by a converter, but after the converter is finished the XAML would look like the following XAML.</p>
  
  <p>With no overlaps:
  <code></p>
  
  <pre><code>    &lt;Path x:Name="PolygonPath" Fill="Blue" Opacity="75"&gt;
          &lt;Path.Data&gt;
              &lt;PathGeometry&gt;
                  &lt;PathGeometry.Figures&gt;
                      &lt;PathFigure StartPoint="50,50" IsClosed="True" IsFilled="True"&gt;
                          &lt;PathFigure.Segments&gt;
                              &lt;QuadraticBezierSegment Point1="100,0" Point2="200,50"/&gt;
                              &lt;LineSegment Point="250,50"/&gt;
                              &lt;LineSegment Point="250,200"/&gt;
                              &lt;QuadraticBezierSegment Point1="100,350" Point2="50,50"/&gt;
                          &lt;/PathFigure.Segments&gt;
                      &lt;/PathFigure&gt;
                  &lt;/PathGeometry.Figures&gt;
              &lt;/PathGeometry&gt;
          &lt;/Path.Data&gt;
      &lt;/Path&gt;
  </code></pre>
  
  <p></code></p>
  
  <p>With overlaps (should fail the test):
  <code></p>
  
  <pre><code>    &lt;Path x:Name="PolygonPath" Fill="Blue" Opacity="75"&gt;
          &lt;Path.Data&gt;
              &lt;PathGeometry&gt;
                  &lt;PathGeometry.Figures&gt;
                      &lt;PathFigure StartPoint="50,50" IsClosed="True" IsFilled="True"&gt;
                          &lt;PathFigure.Segments&gt;
                              &lt;QuadraticBezierSegment Point1="100,0" Point2="200,60"/&gt;
                              &lt;LineSegment Point="0,60"/&gt;
                              &lt;LineSegment Point="250,200"/&gt;
                              &lt;QuadraticBezierSegment Point1="100,350" Point2="50,50"/&gt;
                          &lt;/PathFigure.Segments&gt;
                      &lt;/PathFigure&gt;
                  &lt;/PathGeometry.Figures&gt;
              &lt;/PathGeometry&gt;
          &lt;/Path.Data&gt;
      &lt;/Path&gt;
  </code></pre>
  
  <p></code></p>
  
  <p>In the above case, the second  and third line segments <code>&lt;LineSegment Point="0,60"/&gt;</code> and <code>&lt;LineSegment Point="250,200"/&gt;</code> overlap the last segment <code>&lt;QuadraticBezierSegment Point1="100,350" Point2="50,50"/&gt;</code>.</p>
  
  <p>Is there a method I am missing to test if a path intersects with itself at any point in WPF?</p>