You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first of all, thank you so much for your work! My project would not have been possible without it. I gave the due credits in multiple places.
My project involved implementing a variant of your offsetting algorithm in LaTeX (you can check it out at https://github.com/jonschz/tikz-nfold if you are interested). While implementing the code I discovered some improvements which I explain here, p. 6 ff in detail. A quick summary:
// TODO: add special handling for degenerate (=linear) curves.
It is possible to get around computing the origin altogether, as I explained here, pp. 7–8. Essentially, using a bit of geometry and trigonometry one can find a closed formula for the intersection points that does not have a singularity when the origin approaches infinity (i.e. when the control points approach a straight line). The clockwise/anticlockwise checks are also no longer needed, and most (or all) trigonometric function calls can be removed.
As far as I can tell, computing the normal in t=0 and t=1 will not work if the first two or the last two control points are equal. I computed the tangent (and hence the normal) in t=0 as follows (pseudocode):
if(points[0]!=points[1]){tangent=normalize(points[1]-points[0]);}elseif(points[0]!=points[2]){tangent=normalize(points[2]-points[0]);}elseif(points[0]!=points[3]){tangent=normalize(points[3]-points[0]);}else{error("Curve is degenerate to a point");tangent=(1,0[,0]);}
Don't feel obligated to implement any of these improvements, I merely wanted to share what I found out.
The text was updated successfully, but these errors were encountered:
Dear Pomax,
first of all, thank you so much for your work! My project would not have been possible without it. I gave the due credits in multiple places.
My project involved implementing a variant of your offsetting algorithm in LaTeX (you can check it out at https://github.com/jonschz/tikz-nfold if you are interested). While implementing the code I discovered some improvements which I explain here, p. 6 ff in detail. A quick summary:
BezierInfo-2/docs/js/graphics-element/lib/bezierjs/bezier.js
Line 1748 in 40607a4
s > 1/2
; furthermore, theabs()
is redundant becauseacos()
never returns a negative value.BezierInfo-2/docs/js/graphics-element/lib/bezierjs/bezier.js
Line 1820 in 40607a4
BezierInfo-2/docs/js/graphics-element/lib/bezierjs/bezier.js
Line 1715 in 40607a4
BezierInfo-2/docs/js/graphics-element/lib/bezierjs/bezier.js
Lines 1557 to 1561 in 40607a4
t=0
andt=1
will not work if the first two or the last two control points are equal. I computed the tangent (and hence the normal) int=0
as follows (pseudocode):Don't feel obligated to implement any of these improvements, I merely wanted to share what I found out.
The text was updated successfully, but these errors were encountered: