fogleman / sdf

Simple SDF mesh generation in Python
MIT License
1.6k stars 130 forks source link

Volume from SDF #36

Open BartBruininks opened 1 year ago

BartBruininks commented 1 year ago

Hello developers,

I would like to calculate the total volume of an arbitrary sphere based SDF object. For now I am casting the SDF to a mesh and then use that to calculate the volume. However, writing the mesh is by far the most expensive step. I guess this is mainly due to the marching cubes. I was wondering if there is a way to get the volume from the voxels generated for the marching cubes directly. Or even better get the 'analytical' volume of the SDF without going to voxels at all?

Cheers and thanks in advance.

Bart

PS If we get this working we will probably write a small algorithm about it and if you are interested you can partake in this publication. We can talk about the details later.

imagirom commented 9 months ago

Hello Bart, are you still interested in this? Have you found another solution?

nobodyinperson commented 9 months ago

In my fork sdfCAD I have implemented a kind of monte-carlo volume calculation with e.g. sphere(1).volume().

BartBruininks commented 7 months ago

Ahh nice :D

yhea I run into thi issue quite often so who knows I might need it again! The complete problem I was trying to solve was to find the mismatch and overlap between 2 3d point cloud densities. For now I am not working on it, but I will keep it in mind.

Cheers,

Bart