Best way to union polygons "almost" in contact #352
Unanswered
bellwether-softworks
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Frequently, due to losses in floating-point math after several operations, I find myself with polygons that are for all practical purposes "pretty much in contact" that can't be unified due to precision issues.
For instance, consider the following, which has a pair of rectangles whose Y values are -23.587493896484176 and -23.587506792615844 (creating a gap of 0.00001289613167):
In this particular instance, I know from experimentation that dialing down the precision factor to 4 gets me a merged shape (normally I use a factor of 5). However, I occasionally find that the same trick doesn't always work, as I assume the values being rounded or truncated end up diverging. Going too low on the precision has the potential for a loss of enough fidelity, so I hope to use this approach sparingly.
What are my options for dealing with these kinds of scenarios? I've considered having multiple passes with translation or inflation operations, but was wondering if there's any kind of "slop" or tolerance factor that might help me out as well.
If this has come up before, I apologize in advance for failing to find the related discussion or documentation.
Beta Was this translation helpful? Give feedback.
All reactions