2015-12-07 21:32 GMT-08:00 Papoj Thamjaroenporn <pt2277@...3110...>:
Dear Inkscape-devel,
I attempted to create a line segment using appendNew with 2 arguments (as suggested in the wiki):
line1.appendNew<Geom::LineSegment>(p1.pointAt(0.), p2.pointAt(0.));
This is wrong, appendNew will automatically pass the path's final point as the first parameter to the curve constructor.
but I got the error message:
../../src/2geom/bezier-curve.h:218:7: error: no matching function for call to 'assert_degree' assert_degree<2>(this); ^~~~~~~~~~~~~~~~ ../../src/2geom/path.h:740:23: note: in instantiation of member function 'Geom::BezierCurveN<1>::BezierCurveN' requested here do_append(new CurveType(finalPoint(), a, b));
I am not sure why this would be a problem here. The following line creation would work without this error message:
line1.start(p1.pointAt(0.)); line1.appendNew<Geom::LineSegment>(p2.pointAt(0.));
which puzzles me because this leads to a call of assert_degree() as well, although the degree check appears to be the expected 1 instead of 2.
This code is correct. Degree is *not* the number of control points, it is the highest exponent in the Bernstein polynomials, so it is actually equal to the number of points minus 1; a cubic curve has 4 control points and degree 3. The code you found on the wiki is completely wrong and should be changed.
Best regards, Krzysztof