title: import elliptical arc from dxf
body: <p>I have a problem that made me pull my last hair of my head. 
  I'm struggling to reproduce an angled elliptical arc in 
  my c# winform application using data extracted from DXF.   </p>
  
  <p>Data as follows: </p>
  
  <pre><code>Centerpoint at X                                  : 597,5; 
  Centerpoint at Y                                  : 185; 
  Endpoint of major axis, relative to the center (X): 35,9651502358374;
  Endpoint of major axis, relative to the center (Y): 60,0542085828599; 
  Ratio of minor axis to major axis                 : 0,35714285714286; 
  Start parameter                                   : 4,78575772944812;
  End parameter                                     : 7,78061288491105; 
  </code></pre>
  
  <p>The code:</p>
  
  <pre><code>float ex = 597,5;                              //Centerpoint at X
  float ey = 185;                                //Centerpoint at Y                                
  float exb = 35,9651502358374;                  //Endpoint of major axis (X)                         
  float eyb = 60,0542085828599;                  //Endpoint of major axis (Y)                              
  float EllipseRatio = 0,35714285714286;                            
  double sa = 4,78575772944812;                  //Start parameter                              
  double ea = 7,78061288491105;                  //End parameter
  sa = double.Parse(exb.ToString()) * Math.Cos(sa) +     //Now it's a Start angle
       double.Parse(eyb.ToString()) * Math.Sin(sa);
  ea = 2 * double.Parse(exb.ToString()) * Math.Cos(ea) + //Now it's a sweep angle
       double.Parse(eyb.ToString()) * Math.Sin(ea);
  double angle = Math.Atan(exb / eyb);                   //Rotation angle 
  Graphics ellipse = this.CreateGraphics();
  ellipse.TranslateTransform(ex, ey);                    //So I can rotate at center
  ellipse.RotateTransform(float.Parse(angle.ToString()));
  
  ellipse.DrawArc(PreviewPen, (0 - exb), eyb, 2 * exb, 2 * eyb * EllipseRatio, 
                              float.Parse(sa.ToString()), float.Parse(ea.ToString()));
  </code></pre>
  
  <p>It should look like this;
  <img src="https://i.stack.imgur.com/aRpoL.png" alt="enter image description here"></p>
  
  <p>Instead it looks like this:
  <img src="https://i.stack.imgur.com/5xp7G.png" alt="enter image description here"></p>
  
  <p>As You can see, all the shapes are ok, except the ellipse.</p>
  
  <p>I just can't get it right. Eider the position is wrong, or the 
  orientation is wrong, size, shape, angle... </p>
  
  <p>At some point i got close, but then my thinking engine just blew up. </p>
  
  <p>I'm not using e.graphics. </p>
  
  <p>Please help in details if you can. </p>