mathandy / svgpathtools

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

Problem in Path's scaled method #148

Open ghost opened 3 years ago

ghost commented 3 years ago

I have converted the following path-d to a Path object using parse_path:

M 0.0,36.0 C 0.0,164.082 96.0,250.0 251.0,250.0 C 404.639,250.0 544.0,213.0 544.0,-14.0 C 544.0,-234.0 385.95,-339.976 290.0,-405.0 C 169.0,-487.0 89.75200000000001,-522.634 -49.0,-576.0 C -54.93907,-578.28437 -60.3166,-579.27496 -64.9795,-579.27496 C -76.9143,-579.27496 -84.1666,-572.78519 -84.1666,-564.88956 C -84.1666,-557.8411199999999 -78.38711,-549.6723599999999 -65.0,-543.99996 C 53.0,-493.99996 160.0,-457.99996 251.0,-343.99996 C 342.0,-230.99996 376.0,-138.08695999999998 376.0,6.000040000000013 C 376.0,141.00004 343.0,230.00004 231.0,230.00004 C 184.385,230.00004 153.548,217.40704000000002 119.0,186.00004 C 110.90765999999999,178.64337 107.6879,172.97044000000002 107.6879,168.59784000000002 C 107.6879,155.13934 138.1906,154.00004 151.0,154.00004 C 220.0,154.00004 274.0,89.11334000000001 274.0,18.000040000000013 C 274.0,-56.99995999999999 226.0,-113.99995999999999 135.0,-113.99995999999999 C 55.841800000000006,-113.99995999999999 0.0,-39.99995999999999 0.0,36.00004000000001 L 0.0,36.0 M 572.0,128.0 C 572.0,163.0 601.0,192.0 636.0,192.0 C 671.0,192.0 699.0,163.0 699.0,128.0 C 699.0,93.0 671.0,65.0 636.0,65.0 C 601.0,65.0 572.0,93.0 572.0,128.0 M 572.0,-131.0 C 572.0,-96.0 601.0,-67.0 636.0,-67.0 C 671.0,-67.0 699.0,-96.0 699.0,-131.0 C 699.0,-166.0 671.0,-194.0 636.0,-194.0 C 601.0,-194.0 572.0,-166.0 572.0,-131.0

Screenshot_2021-04-06_23-02-56

When I get the d of the scaled Path however

parse_path("M 0.0,36.0 C 0.0,164.082 96.0,250.0 251.0,250.0 C 404.639,250.0 544.0,213.0 544.0,-14.0 C 544.0,-234.0 385.95,-339.976 290.0,-405.0 C 169.0,-487.0 89.75200000000001,-522.634 -49.0,-576.0 C -54.93907,-578.28437 -60.3166,-579.27496 -64.9795,-579.27496 C -76.9143,-579.27496 -84.1666,-572.78519 -84.1666,-564.88956 C -84.1666,-557.8411199999999 -78.38711,-549.6723599999999 -65.0,-543.99996 C 53.0,-493.99996 160.0,-457.99996 251.0,-343.99996 C 342.0,-230.99996 376.0,-138.08695999999998 376.0,6.000040000000013 C 376.0,141.00004 343.0,230.00004 231.0,230.00004 C 184.385,230.00004 153.548,217.40704000000002 119.0,186.00004 C 110.90765999999999,178.64337 107.6879,172.97044000000002 107.6879,168.59784000000002 C 107.6879,155.13934 138.1906,154.00004 151.0,154.00004 C 220.0,154.00004 274.0,89.11334000000001 274.0,18.000040000000013 C 274.0,-56.99995999999999 226.0,-113.99995999999999 135.0,-113.99995999999999 C 55.841800000000006,-113.99995999999999 0.0,-39.99995999999999 0.0,36.00004000000001 L 0.0,36.0 M 572.0,128.0 C 572.0,163.0 601.0,192.0 636.0,192.0 C 671.0,192.0 699.0,163.0 699.0,128.0 C 699.0,93.0 671.0,65.0 636.0,65.0 C 601.0,65.0 572.0,93.0 572.0,128.0 M 572.0,-131.0 C 572.0,-96.0 601.0,-67.0 636.0,-67.0 C 671.0,-67.0 699.0,-96.0 699.0,-131.0 C 699.0,-166.0 671.0,-194.0 636.0,-194.0 C 601.0,-194.0 572.0,-166.0 572.0,-131.0").scaled(.4, .4).d()

it looks like this:

Screenshot_2021-04-06_23-04-22

This is however not the case by scaling with numbers like 0.5 or above, but with numbers < 0.45 in my experience! I can not understand why is this happening. Any help is highly appreciated!