title: Getting End Point in ArcSegment with Start X/Y and Start+Sweep Angles
body: <p>Does anyone have a good algorithm for calculating the end point of <code>ArcSegment</code>? This is not a circular arc - it's an elliptical one.</p>
  
  <p>For example, I have these initial values:</p>
  
  <ul>
  <li>Start Point X = 0.251</li>
  <li>Start Point Y = 0.928</li>
  <li>Width Radius = 0.436</li>
  <li>Height Radius = 0.593</li>
  <li>Start Angle = 169.51</li>
  <li>Sweep Angle = 123.78</li>
  </ul>
  
  <p>I know the location that my arc should end up at is right around X=0.92 and Y=0.33 (through another program), but I need to do this in an <code>ArcSegment</code> with specifying the end point. I just need to know how to calculate the end point so it would look like this:</p>
  
  <pre><code>&lt;ArcSegment Size="0.436,0.593" Point="0.92,0.33" IsLargeArc="False" SweepDirection="Clockwise" /&gt;
  </code></pre>
  
  <p>Does anyone know of a good way to calculate this? (I don't suppose it matters that this is WPF or any other language as the math should be the same).</p>
  
  <p>Here is an image. All values are known in it, except for end point (the orange point).
  <img src="https://i.stack.imgur.com/CbCmZ.png" alt="image depicting arc"></p>
  
  <hr>
  
  <p><strong>EDIT:</strong>
  I've found that there is a routine called <a href="http://msdn.microsoft.com/en-us/library/xxw9hsz1.aspx" rel="nofollow noreferrer"><code>DrawArc</code> with an overload in .NET GDI+</a> that pretty much does what I need (more on the "pretty much" in a sec).</p>
  
  <p>To simplify viewing it, take the following as an example:</p>
  
  <pre><code>Public Sub MyDrawArc(e As PaintEventArgs)
  
      Dim blackPen As New Pen(Color.Black, 2)
      Dim x As Single = 0.0F
      Dim y As Single = 0.0F
      Dim width As Single = 100.0F
      Dim height As Single = 200.0F
  
      Dim startAngle As Single = 180.0F
      Dim sweepAngle As Single = 135.0F
  
      e.Graphics.DrawArc(blackPen, x, y, width, height, startAngle, sweepAngle)
  
      Dim redPen As New Pen(Color.Red, 2)
      e.Graphics.DrawLine(redPen, New Point(0, 55), New Point(95, 55))
  End Sub
  
  Private Sub ImageBox_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles ImageBox.Paint
      MyDrawArc(e)
  End Sub
  </code></pre>
  
  <p>This routine squarely puts the end point at <code>X=95, Y=55</code>. Other routines mentioned for circular ellipses would result in <code>X=85, Y=29</code>. If there was a way to <strong>1)</strong> Not have to draw anything and <strong>2)</strong> have <code>e.Graphics.DrawArc</code> return the end-point coordinates, this is what I would need.</p>
  
  <p>So now the question gains some clarity - does anyone know how <code>e.Graphics.DrawArc</code> is implemented?</p>