Hi Tav,
  As you are working on elliptical arc code, I hope you can find the time to look into the following issue (lib2geom maillist 7-11-2013):

Is there a bug perhaps in this piece of code:
elliptical-arc.cpp, lines 608-632

     double dsq1 = distanceSq(p, pointAt(from));
     double dsq2 = distanceSq(p, pointAt(to));
     if ( second_sol )
     {
         if ( mindistsq2 > dsq1 )
         {
             result.clear();
             result.push_back(from);
             mindistsq2 = dsq1;
         }
         else if ( are_near(mindistsq2, dsq) )    <--------- BUG ?
         {
             result.push_back(from);
         }
         if ( mindistsq2 > dsq2 )
         {
             result.clear();
             result.push_back(to);
         }
         else if ( are_near(mindistsq2, dsq2) )
         {
             result.push_back(to);
         }

     }

 From symmetry of the code, shouldn't "dsq" be "dsq1" in that line? The 
code compiles because earlier, "dsq" was defined. If this is not a bug, 
please add a comment in the code, saying that it is indeed correct.
If it *is* a bug, please correct it, and also reduce the scope of the 
"dsq" variable defined earlier.

Thanks a lot,
  Johan


On 29-11-2013 14:50, Tavmjong Bah wrote:
Hi,

The current Inkscape code converts an elliptical arc to a Bezier curve
via converting it first to an SBasic curve. This leads to some loss of
accuracy to the curve (noticeable now that we are using SVG <circle> and
<ellipse> elements where possible) and control over where the resulting
nodes will be placed. lib2geom has been patched (r2122) to fix the
accuracy problem. Is there a reason this patch hasn't been applied to
the copy of lib2geom in Inkscape? (If no, I can apply the patch.)

Even with this patch, it might be better to provide a direct route to go
from an elliptical arc to a Bezier curve bypassing the SBasic step to
have better control over where nodes are placed. I have made a first
pass at providing a direct route. At the moment, one Bezier curve is
created if the arc is less than pi/2 in length. If it is longer, extra
nodes are placed on the major and minor ellipse axes. Can the lib2geom
experts have a look? I am sure I have not done things in a lib2geom
sanctioned way. The branch is available at:

lp:~inkscape.dev/inkscape/elliptical_arc

I've attached a test file where the red ellipses/arcs are drawn using an
"ideal" conversion to Bezier curves (with four per circle/ellipse) and
the blue curves are test arcs. (The Cairo routines convert the arcs to
Beziers for display as Cairo/PostScript/PDF do not have a native
elliptical arc path segment so just rendering arcs on screen tests the
code.)

One obvious bug is that the flash path when using the node tool is
wrong.

Thanks,

Tav





------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Inkscape-devel mailing list
Inkscape-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/inkscape-devel