I need a signed distance field (SDF) and corresponding unit normal vector field (acronym unknown) to immerse solid boundaries into my fluid simulator. I’m trying to use “other people’s code” wherever possible on this project, and it seems like JuliaGeometry and JuliaGraphics are the best bet.
It looks like GeometryBasics imports the SignedDistanceField
type from GeometryTypes. but it’s discontinued in favor of GeometryBasics??? Meshing and Descartes both use this type, so I guess it is safe, but I wanted to check.
Looking through all of these and various other attempts at Google haven’t uncovered a function for computing the SDF and normal vector field from a general geometry description, or even from a mesh. For example, something which lets both of these work:
x = # position field in x,y or x,y,z where the SDF should be measured
using MakieGallery
dis2 = SDF(MakieGallery.loadasset("cat.obj"),x)
using GeometryBasics
dis1 = SDF(Sphere(center,radius),x) # could be native or create a mesh first
I would’ve thought this would be pretty normal in a graphics setting. Meshing.jl solves the opposite problem (getting surfaces from SDFs) and SignedDistanceFields seems to be standalone and computes it’s own SDF explicitly, but only for a few analytic shapes. Is there a place where this is done efficiently for meshes?