I have been using the "draw bezier curves and straight lines" tool
in inkscape, and have the following question.
-Does inskscape have a rasterisation algorithm that can decompose a bezier curve
into it component straight lines, their slope, length, position, and the anchor points?
-Does this also include the rate of movement of each moving rasterisation point?
-Is the algorithm made visible by the program?
-Is the algorithm easy to follow? [I have the construction approach in mind]
Is there somewhere on the internet I can go to follow an example algorithm, say,
in psedocode that is sensible to follow?
Inkscape and Rasterisation.
Re: Inkscape and Rasterisation.
Power User wrote:-Does inskscape have a rasterisation algorithm that can decompose a bezier curve
into it component straight lines, their slope, length, position, and the anchor points?
The rasterization is now done by the Cairo library. However, what you are talking about is actually flattening. The most primitive algorithm would recursively calculate the point in the middle of the current fragment of the curve until the distance between the computed points is lower than some predefined value. (Note that it can break for self-intersecting curves.) A better algorithm would recursively subdivide the curve until the upper bound of its length (the sum of distances between its control points) is lower than some threshold. You can find the subdivision code in the 2Geom library contained in Inkscape source code, file (IIRC) src/2geom/bezier-curve.cpp.
-Does this also include the rate of movement of each moving rasterisation point?
I don't know what this means, but the 2Geom library used by Inkscape has an algorithm to compute the derivative of Bezier curves via conversion to S-basis and back (this generally has the same or higher accuracy and is faster than computing the derivative directly in Bezier basis). You can also compute the derivative at specific points.
-Is the algorithm easy to follow? [I have the construction approach in mind]
Is there somewhere on the internet I can go to follow an example algorithm, say,
in psedocode that is sensible to follow?
The Cairo rasterization code is rather hard to follow, as it is in C and quite complicated. The derivative computation code in 2Geom is also slightly convoluted because the actual computation takes place in S-basis and you need to do a lot of chasing around. There is no "educational" documentation of the kind you have in mind available for those libraries.