-
Notifications
You must be signed in to change notification settings - Fork 27
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
Incorrect parsing of floating point values #18
Comments
Checking the SVG spec, the
So ideally we'd parse them to handle any of these and convert them all to mm |
…Lex#18 Lots of the Y dimensions have moved slightly - from a random sampling of a few dozen of the differing points they have all shifted by less than 0.001mm, so I'm assuming it's down to minor variations in the floating point arithmetic with the additional transformation.
I've added a new function to That hasn't stopped the The update to the Github seems to have added the commits for this to the existing PR automatically, so accepting that will fix this issue too. |
While running the tests for #12 (Yay test code!) the new
viewBox
support was producing slightly different gcode for thehiking.svg
test file.Digging into it a bit I found that it was because the SVG height and width attributes were being truncated - I was getting a height of 791.716 for example, rather than the full 791.71631 in the SVG file. The
viewBox
code ended up scaling things a tiny bit, which threw the test code off.The problem seems to be with the lines like this:
canvas_height = float(height_str) if height_str.isnumeric() else float(height_str[:-2])
Seems that
isnumeric()
returnsFalse
for strings containing decimals, and the code assumes they've got amm
orpx
, etc. at the end and chops off the last two characters - in the case ofhiking.svg
that's the last two decimal places of the number.The text was updated successfully, but these errors were encountered: