-
My issueI was 3d printing some parts generated using this library (a fantastic combination!) and one of my pieces (a compound object that was a Turns out that JS floating point error is the culprit -- one of my manifolds was .000000001 away from the other, and the Simple reproduction
Results in:
It's not surprising, since in JS,
due to floating point error. DiscussionI've used proper Decimal libraries in the past when I've run into issues like this, such as decimal.js, but I'm not sure I can use that here since it seems internal to the manifold library. For this particular project, what I think I'll do is just use micrometers instead of millimeters and always deal with non-fractional values for the dimensions of my manifolds (or just fatten my manifolds by some tiny amount to ensure they actually overlap), but I'm wondering if there is perhaps some library-level solution to this?
I appreciate this might just be a limitation of using this in JS, but thought I'd at least point this problem out, maybe you have some ideas! Thank you for a wonderful library, it's brought me a lot of joy to work with! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The workaround approach I ended up taking was actually to just scale up everything by 1000, |
Beta Was this translation helpful? Give feedback.
Indeed, this is the correct approach. To avoid surprises, we let our transformations happen according to standard floating point math, rather than trying to "correct" it. You've outlined a good approach to avoiding floating point errors.