Does this support constrained delaunay triangulation?
I've had a quick look into your library, which looks impressive.
I'm wondering about whether it's possible to "constrain" certain vertices so that contours may not cross those lines. This is important when you want to generate contours for real world terrain and ensure that contours don't accidentally cross over a ridgeline or valley.
Is it true that this library uses d3-delaunay for the triangulation? Perhaps if that library doesn't support it, I wonder if cdt-js might be able to swapped in as a replacement triangulation library.
Has anyone had any experience with this?
Yes we use d3-delaunay, which doesn't do CDT. cdt-js seems nice but it's an app, not an API, so it looks like it would be a lot of work to swap it in? But please report any progress you do with that.
Note that an alternative way to generate something similar to tricontours is now available with Observable Plot, using the Plot.contour mark. This mark subsumes both d3-contour (applying marching squares on gridded points) and partially d3-tricontour (by applying a barycentric interpolation on non-gridded points). A lower-level API is available if you need the interpolated values to be returned as a grid: see interpolatorBarycentric. It's not doing meandering triangles though, so not a pure replacement for d3-tricontour.
cdt-js seems nice but it's an app, not an API
Oh yes, you're right. I thought it existed as a standalone library, but apparently not yet. 🤔
And thanks for the tip about Plot.contour. I will keep that in mind as I'm exploring options.
In theory, I might be able to implement constraining by injecting a series of interpolated points along each vertex that needs to be constrained. That might work. I'll have a play when I get available time and see how it goes.