bulia byak wrote:
On 11/1/05, Aaron and Sarah Spike <spike@...476...> wrote:
I haven't started looking at this yet. Since I don't know or understand the complex math is trying to guess at the best approximation, I had planned to sample the two curve segments adjacent to the node in a configureable number of places and send that list of points to the bezier fitting functions in bezier-utils.cpp to have it find the best fitting single segment approximation (I think that it has the ability to do this with end tangent constraints). Does this sound like a reasonable idea to the people in the know?
Yes - initially I was doubtful about this approach, but after some thinking I now consider it the only practical mehtod, easily working for any number of deleted nodes.
I have no idea how good it is, but a friend of mine implemented a relatively straightforward way of deleting a node from a bezier curve in the following program (license is GPL): http://magicseteditor.sourceforge.net/ As far as I understand he uses de Casteljau's subdivision algorithm backwards to obtain a reasonably approximation.
For convenience, the relevant file can be viewed here: http://cvs.sourceforge.net/viewcvs.py/magicseteditor/mse/src/Action/SymbolAc...
The relevant method is the "construct" method in the ControlPointAddAction class. (It's in a custom language btw, but it's very much like C++, so it shouldn't be too hard to understand.)