Split triangulation differently to produce more regular triangles
See original GitHub issueI’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 calling flubber.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, saying Uncaught RangeError: Can't collapse topology into 10 pieces.
. Changing maxSegmentLength
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.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Polygon Triangulation - UCSB Computer Science
Partition polygon P into non-overlapping triangles using diagonals only. • Is this always possible for any simple polygon? If not, which polygons are....
Read more >Triangles and Simplices - The Geometry Junkyard
I am particularly interested in triangulation by which I mean partitioning regions into triangles, tetrahedra, or higher dimensional simplices, for various ...
Read more >Chapter 3. Triangulation Hierarchies
Splitting this type of triangle on all edges partitions high-frequency regions which may then be further refined. This refinement technique strives primarily to ......
Read more >Point-set triangulation
Sometimes it is desirable to have a triangulation with special properties, e.g., in which all triangles have large angles (long and narrow ("splinter") ......
Read more >Decimation
This is because for every cube intersecting the surface, marching cubes must produce a triangulation. These triangulations consist of 1-4 triangles, and thus ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for the detailed post! This is actually on my todo list - basically if you have a multishape with
n
shapes, your single shape currently needs at leastn+2
vertices in order to get triangulated into enough pieces. So in your case, using the defaultmaxSegmentLength
for those circles looks like it gives you a nonagon, so any feature with 8 or more parts would fail.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
maxSegmentLength
, or you could limit the shapes to the eight largest polygons, or simplify the geometry until none of the features have that many.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.