Closed raphaelschaad closed 5 years ago
The concave hull is not as easy to define as the convex hull and comes in many flavors (alpha-shape, etc) — a very nice and ultra fast solution is given by @mourner in https://github.com/mapbox/concaveman
Also see https://observablehq.com/@mourner/adaptive-concave-hull for an alternative.
These are great, thanks. Would it make sense for d3-polygon to implement one of these (being aware there isn't a single solution as there is for convex hull)?
Since the approaches we know all have heavy dependencies, I don't think it would make sense to add any of them to this lightweight module.
d3-polygon currently has d3.polygonHull(points) that returns the convex hull of the specified points. For some applications, it would be handy to calculate the concave hull of a set of points.
Either, the existing method could add a second parameter type (with currently supported values being convex and concave, or, the existing method could be renamed to d3.polygonHullConvex(points) and a new method d3.polygonHullConcave(points) could be added.