mathandy / svgpathtools

A collection of tools for manipulating and analyzing SVG Path objects and Bezier curves.
MIT License
557 stars 142 forks source link

cubicBezier.intersect does not report intersection with an horizontal line going through start or endpoint #137

Open piscvau opened 3 years ago

piscvau commented 3 years ago

Hello here are the data : from packagesvgpathtools.svgpathtools.path import Line, CubicBezier b1 = CubicBezier(start=(10 + 110j), control1=(56 + 94j), control2=(31 + 132j), end=(15 + 134j)) l1 = Line(start=134j, end=(515 + 134j)) intersect1 = b1.intersect(l1, tol=0.01) print(intersect1)

b2 = CubicBezier(start=(133 + 154j), control1=(87 + 138j), control2=(112 + 176j), end=(128 + 178j)) l2 = Line(start=178j, end=(633 + 178j)) intersect2 = b2.intersect(l2, tol=0.01) print(intersect2)

b3 = CubicBezier(start=(35 + 151j), control1=(50 + 151j), control2=(86 + 169j), end=(64 + 183j)) l3 = Line(start=183j, end=(564 + 183j)) intersect3 = b3.intersect(l3, tol=0.01) print(intersect3)

piscvau commented 3 years ago

Here are some more examples b4 = CubicBezier(start=(750 + 200j), control1=(564.3818884555353 + 321.53223166441614j), control2=(586.3818884555353 + 565.5322316644161j), end=(772 + 444j)), l4 = Line(start=444j, end=(1272 + 444j))

b5 = CubicBezier(start=(400 + 300j), control1=(566.565552661207 + 389.77796685898676j), control2=(588.565552661207 + 633.7779668589867j), end=(422 + 544j)) l5 = Line(start=544j, end=(922 + 544j))

b6 = CubicBezier(start=(750 + 200j), control1=(935.6181115444647 + 78.46776833558383j), control2=(957.6181115444647 + 322.4677683355838j), end=(772 + 444j)) l6 = Line(start=444j, end=(1272 + 444j))

b7 = CubicBezier(start=(750 + 200j), control1=(564.3818884555353 + 321.53223166441614j), control2=(586.3818884555353 + 565.5322316644161j), end=(772 + 444j)) l7 = Line(start=444j, end=(1272 + 444j))

b8 = CubicBezier(start=(400 + 300j), control1=(566.565552661207 + 389.77796685898676j), control2=(588.565552661207 + 633.7779668589867j), end=(422 + 544j)) l8 = Line(start=544j, end=(922 + 544j))

b9 = CubicBezier(start=(750 + 200j), control1=(935.6181115444647 + 78.46776833558383j), control2=(957.6181115444647 + 322.4677683355838j), end=(772 + 444j)) l9 = Line(start=444j, end=(1272 + 444j))