mathandy/svgpathtools

QuadraticBezier segment length() function gives 'inf' as result

Opened this issue · 1 comments

for the points:
st = (335.43211 + 69.71516199999999j)
end = (335.27971 + 69.86756199999999j)
ctrl = (335.33051+ 69.816762j)
segment= svgpathtools.QuadraticBezier(st, ctrl, end)
len = segment.length() # len is 'inf' !!!

Note that for the points:
st = (335.43211 + 69.715162j)
end = (335.27971 + 69.867562j)
ctrl = (335.33051 + 69.816762j)
the length of the segment is ok : 0.21552614690565985

[python-3.10]

Sincerely,
XM

I have another test case:

  • svgpathtools = 1.5.1
  • Python 3.11.1
import svgpathtools

from svg.path import path as svgpath


def bad():
    path = svgpathtools.QuadraticBezier(
        start=(46 + 125j), control=(45.8 + 124.6j), end=(45.7 + 124.4j)
    )
    return path.length()


def good():
    path = svgpath.QuadraticBezier(
        start=(46 + 125j), control=(45.8 + 124.6j), end=(45.7 + 124.4j)
    )
    return path.length()


assert bad() == good()

This is parsed from the path "M 46.0 125.0 Q 45.8 124.6, 45.7 124.4"