I’ve just released elm-geometry 1.0; it is effectively a new major version of the existing opensolid/geometry package, but I’m hoping that the new name more effectively conveys that the package is really intended to be a great general-purpose geometry library for Elm (not tied to any particular product/brand or framework). The new release also comes with several new features and improvements:
Any feedback, questions, comments are welcome either here, in Slack (#geometry or @ianmackenzie), or on GitHub. Many of the recent additions to elm-geometry (polygon triangulation and convex hull, arc length parameterization of curves, improved bounding box overlap/separation checking) were in response to requests from members of the Elm community, so if there’s something missing that’s preventing you from using the package, let me know!
From center point, radius, start angle and swept angle (Arc2d.with)
I was just really pleased with the new Arc2d.from version that takes a start point, end point and swept angle - it’s very convenient in common cases, and is well-defined even for pathological cases like coincident points and zero angle, which means it can return a plain Arc2d instead of a Maybe Arc2d.
It’s particularly handy when you want to make something like a rounded corner joining two lines, where you know the endpoints but it’s an extra hassle to compute the arc center point. In your case, though, it looks like you’ll already have the center point readily available (it’s always just the center of the wheel!), so Arc2d.with might be a better fit.
Thank you Ian, I’m excited about this package! I’ll use it for sure in my graph-editor experiment. Also since I like math in general I’ll definitely find other uses for this
elm-geometry has basically saved my Elm Europe talk. Curve sampling and especially triangulation are very tough problems. I did try to roll my own implementation, and I didn’t succeed. Implementing this from scratch using elm-geometry took me just a couple hours.