inkstitch / pyembroidery

libembroidery/EmbroideryFormats converted to python
MIT License
72 stars 28 forks source link

In Python 2 sometimes reads of .pes have long jumps. #26

Closed tatarize closed 6 years ago

tatarize commented 6 years ago

It's odd that they do anything different. I tried to account for things like round() not returning an integer like it does in 3. But, it likely needs to be tracked down.

lexelby commented 6 years ago

Got an example file?

tatarize commented 6 years ago

It's a bug due to simple math, both versions. I only oddly found it after doing the python 2 conversion work.

Apparently 3 bytes of \x31\xff\xf0 + 12 bytes of positional data equals 15 therefore, and in hex we have 16 digits. We need one less than the 16 of hex 0xF so 0xE. Except that that's 14, not 15 and so all the stitch reading broke, because I somehow thought I should do hex math in my head because it was just single digit.