Happy to announce that we’ve updated and registered ParametricBodies.jl which lets you quickly define 2D and 3D bodies based on any parametrically defined curve. We designed these for use in WaterLily simulations, but the package is purely geometric, generating signed distance functions and corresponding normals and velocities, so perhaps others will find it useful as well.
Here’s a quick example
function whale(s) # adjustable sweep angle
pnts = SA{Float32}[0 40 190 200 190 170 100 0 -10 0
0 0 8s 8s+40 5s+70 5s+50 5s+70 100 80 0]
planform = BSplineCurve(reverse(pnts),degree=3)
return PlanarBody(planform)
end
# defined a query point and time
x,t = SA[10,20,0],0;
# get signed distance, normal, and velocity closest to x,t
measure(whale(10),x,t)
This is an updated example from the WaterLily preprint we submitted last month.