Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading in dpaths introduces a lot of floating point approximation noise #223

Open
ohnorobo opened this issue Jul 2, 2024 · 0 comments · May be fixed by ohnorobo/svgpathtools#2 or #225
Open

Reading in dpaths introduces a lot of floating point approximation noise #223

ohnorobo opened this issue Jul 2, 2024 · 0 comments · May be fixed by ohnorobo/svgpathtools#2 or #225

Comments

@ohnorobo
Copy link

ohnorobo commented Jul 2, 2024

Example

import svgpathtools
d = "M70.63,10.42c0.11,0.33-0.89,2.09-1.54,2.45c-4.95,2.73-17.52,7.24-39.46,11.04"  # path from KanjiVG
p = svgpathtools.parse_path(d)
# some kind of simple path modification not yet implemented
print(p.d())

outputs

M 70.63,10.42 C 70.74,10.75 69.74,12.51 69.08999999999999,12.870000000000001 C 64.13999999999999,15.600000000000001 51.56999999999999,20.11 29.62999999999999,23.91

I understand the performance gain from using floats, and I don't mind a bit of jitter, but I would like to keep my svg files somewhat clean if possible, also it really increases the text size.

Is it possible to allow something like rounding to n decimal places in .d()? (I would be happy to take a crack at implementing this.) Or maybe there's another good way to solve this I haven't understood?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant