Doubt in creating boolean solids?

Hi can anyone please shed a bit more light on the below statement from the book for application developers? Sorry in advance if its if too obvious a thing.

The constituent solids of a Boolean operation should possibly avoid be composed by sharing all or part of their surfaces.

Does it imply that we should not use boolean operations on solids that just touch the surface? There should be some ‘bulk intersection’ between two solids?

Thanking You

Shared surfaces can lead to unexpected results. For example, you would like to measure an energy deposit in a volume constructed as a union of two boxes placed one on top of the other. And you place a particle gun in a position where all particles are flying along the shared surface.
The energy deposit in such case will be equal to zero. The reason is that if a particle flies along the surface of a solid, then Geant4 considers that there is no intersection with the solid.
In our case, there is no intersection with either the first constituent box or the second. As a consequence, the Boolean operation algorithm concludes that there is no intersection with the volume.

1 Like

That is a great example; thank you. I didn’t realize that intersection with a boolean required intersection with one of the constituents. Something new for me to put in my explanations toolbox!

Thanks a lot for the wonderful explanation.
So, for the union to work properly, the two solids should share some bulk volume with each other, like in case 2 below. Can you please confirm?


Thanks a ton !

I would say that in both cases the union will work properly. The question is how to consider the case when the constituents are touching each other, are they separate or overlapping? Geant4 transportation system consider them as non overlapping, separate parts of the union. Whether this is critical or not for your task, is up to you to decide.

Your second case, where the two constituents are made slightly longer, and overlap in the union, is “safer” to avoid the edge case in transport that @evc described. From a purely “geometric” standpoint, both methods are valid.

Oh I see, thanks gain for the valuable clarification.

Thank You, Mike, for the helpful clarfication.

I assume the same logic applies to replicated volumes, which, per the documentation, must consist of segments that completely fill the mother volume. What would happen to the energy deposit in that case (assuming a particle trajectory along a common surface to two of the segments). Is the energy deposit attrbuted to the mother volume? To me it would be very strange that there would be an energy deposit in a mother volume (of potentially a different material) and no energy deposit in any of the volumes that completely fill the mother.