-
Notifications
You must be signed in to change notification settings - Fork 169
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
Split triangulation differently to produce more regular triangles #1
Comments
My fallback for now is to return If you'd like me to integrate that directly into flubber and submit a PR let me know. I just figured it's probably best to avoid silent errors and instead have users handle them explicitly. |
Thanks for the detailed post! This is actually on my todo list - basically if you have a multishape with This fix has been delayed a little because rather than add colinear points on the original shape, which can result in weird slivers, I think the right approach is to still triangulate normally first, but then to split those triangles in half if needed, and that's a bit more involved to implement. But hopefully I should have it in there in the next few days. In the meantime, as you mention you could decrease |
Nice, I was thinking something along the same lines (recursively splitting up the triangles until there are enough pieces) but don't know my way around the code quite well enough yet to know the best place to implement. |
I pushed v0.2.5 which should fix this error - I'll look into other splitting strategies later this week to see whether the results are any better. |
flubber.combine
: Can't collapse topology into x pieces.
Thought about this a bit more and I think the way to go is probably to split any triangle that's more than x% of the total area from the midpoint of its longest side to the opposite vertex before the merge step. That ought to result in fewer sliver triangles that span the whole width/height of the shape, and it would never result in more than a handful of extra ops. |
I'm trying to do some transitions on the
topojson/world-atlas
110m map and finding that some of the more complicated geographies break a lot of the time when callingflubber.combine
.I've got a reproducible block up here [gist].
If you add e.g. the United States back in (by no longer filtering out
id=840
in line 46) it'll break, sayingUncaught RangeError: Can't collapse topology into 10 pieces.
. ChangingmaxSegmentLength
can make things better or worse, causing more or fewer countries to break (but I've yet to find a value that works for all of them).Also, thanks for the awesome library! I've been eagerly watching your
bl.ocks
for a while and wanting to give these transitions a try, and this makes it so easy to do.The text was updated successfully, but these errors were encountered: