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