Hi Nathan,

Thank you for the email. I am currently booked right now but I will get back to you some time this week to investigate more on this issue. Just one question: what exactly should I print out? I printed a segment of the curvature path (the 4th segment to be exact) in terms of Kxy, and this segment definitely wiggled, but the output was always the same when I hovered my mouse around:

ix: 4 Kxy[0]:
{281.25, 290.625}s^0 + 
ix: 4 Kxy[1]:
{372.08, 346.521}s^0 + {-28.7083, -45.4316}s^1 + {-8.2712, -12.9363}s^2 + {1.31768, -0.797948}s^3 + {0.739784, 0.184223}s^4 + 

If Kxy is indeed stable, the problem might lie in the method cairo_d2_sb()somewhere.

Regards,
_______________________
Papoj "Hua" Thamjaroenporn
pt2277@...3110...





On Apr 28, 2014, at 8:49 AM, Nathan Hurst <njh@...1927...> wrote:

On Mon, Apr 28, 2014 at 02:36:50AM -0400, Papoj Thamjaroenporn wrote:
Hi Nathan,

Note that the original code of curvature-test.cpp already has this
instability, in case you are wondering if it is my own bug.

No, I recall seeing something like that before.

I?m just wondering: how do you know it is a sign error?

It's a hunch.  It reminds me of other similar bugs I've seen.  Another
similar problem is that it might be being overzealous in truncating
the sbasis form.  When I worked on this code I tended to use the cout
<< sbasisInstance << std::endl; form a lot, perhaps with modern IDEs
this is no longer needed, but in any case you should try and get some
actual numbers out, ideally comparing the correct and wigglified
instability values.

In fact, am not sure what?s happening under the hood when we say expression like

Kxy[1] = Linear(450) - K.segs[ix]*400;

It returns a function (sbasis) which represents the pointwise
difference between the constant 450 and 400* whatever is in segs.
Under the hood it is doing calculations in sbasis space.

where K.segs[ix] is an SBasis object. I looked around in the code
and there didn?t seem to have operator-() defined between Linear and
SBasis object (but the expression worked, and Linear object is not
an SBasis object).

I think it is automatically casting using SBasis(Linear)?

So I don?t know where to look further to see if
there is a degree increase going on anywhere.

Let's get some numbers.  I remember that there was also a bug in
curvature toy where it would introduce a cusp as that was the easier
way to satisfy the constraints.  I think with some thought we could do
better.\ (it might suffice to make the algorithm only consider the two
straight through cases, or it might require some backtrack/DP).  It
would be brilliant if you could add the curvature based editing to
inkscape.  I tried to do it a long time ago but the canvas code was
too much for my puny brain.

njh