How does blender calculate intersection?


Hi, I am working on a project where I need to calculate the exact intersection area between a sphere and a 3D rectilinear grid as shown in the attached figures. I realize blender seems to be able to do such intersection really well. I am wondering if there is any literature or library that can be used for such calculation. In particular I need to calculate the intersection area accurately. Thanks!

Ahem… boolean operations are used in 3D… since… forever…
…i do not not the exact algorithm in blender… but there are dozen of libs for example on GitHub: 3D boolean

…but of course you might also go direct into sciene (pun itended :grin: )…

Exact, robust, and efficient regularized Booleans on general 3D meshes (Barki , Guennebaud, Foufou 2015)

…or you might just have alook into:

…there are also some 3D libs mentionsed…

Thanks for the pointers, I will look into them to see if they have the area calculation algorithm . BTW, is there 3D boolean code in the blender src GitHub - blender/blender: Official mirror of Blender? I assume the boolean modifier does that and it’d be great if that part of the code can be built as a library and has APIs available to be called by external code. I haven’t checked the source carefully (not knowing the src code well enough), is that a possibility?

What about using Blender itself as a library? Depending on your needs, it may be easier to use Blender as a module in Python and perform your operations there. The page below may help with that.

https://docs.blender.org/api/current/info_advanced_blender_as_bpy.html

Also not: blender does mesh booleans. So the sphere is approximated with flat triangles. So if you want to do area calculations and you care about the actual area of the sphere, make sure you check how highly subdivided a sphere you need to have enough precision.

Great information. I will need some time to absorb this. I’ll get back after reviewing. Thanks.