KAHIBARO
Discord Login Register

7.4. Boolean Geometry

Union

Boolean geometry lets you build complex shapes by combining simpler volumes. In GATE, these operations are built on top of the Geant4 boolean solids, so they follow exactly the same geometric logic and constraints. You typically start from basic primitives that you already know from earlier chapters, such as boxes, cylinders, or spheres, and then use boolean operations to create a new solid. This new solid is what you will finally place as a volume inside a parent volume.

Union is the operation that combines two overlapping or touching solids into a single bigger solid. Conceptually, the union of solids $A$ and $B$ contains every point that belongs to at least one of the two solids. In mathematical notation, the union solid $U$ is
$$
U = A \cup B.
$$

In practice in GATE, you do not place both original solids separately. Instead, you define a new boolean solid that uses one solid as a base and adds the second one with a relative position and rotation. This boolean solid becomes the shape of a new logical volume, and you place that volume in the geometry tree as usual. The original solids stay as definitions only, they are not visible unless you also place them elsewhere.

To build a detector module as a single piece, you may for example start from a rectangular crystal and then add a small cylindrical light guide at one end using a union. Without boolean geometry, you would need to manage several separate volumes and their boundaries, which is harder to maintain. With a union volume, transport through the combined module is smooth and there is no internal boundary inside that module.

::danger
A union volume includes all parts of both input solids. Any overlapping region is kept only once in the final solid.

When setting up a union in GATE, there are a few details that matter for a robust simulation. First, remember that the boolean operation is defined in the coordinate system of the base solid. If you specify that solid A is the base, all positions and rotations for solid B are given relative to A. Small mistakes in translation or rotation can easily create very thin overlaps or gaps that are hard to see but can cause navigation errors or tracking problems. Using simple fractions of the underlying shape sizes and keeping coordinates aligned with main axes helps to avoid such issues.

Second, boolean operations can become computationally expensive when solids are very complex or when you chain many boolean steps. In a real PET or SPECT scanner with thousands of crystals it is usually better to use repeated volumes and parameterized geometry instead of building every crystal from several boolean combinations. Reserve unions for shapes that cannot be described conveniently with simple primitives, such as beveled edges, cut corners, or combined housings and supports.

Within a union, material is defined at the volume level, not at the primitive level. When you create a volume based on a union solid, you assign one material to the entire resulting object. If in your design you need different materials for different regions, you cannot combine them with a single union volume. Instead you must keep separate volumes so that each volume can have its own material. For example, a crystal and a metal housing with different materials cannot be merged into a single union volume if you want to preserve the material difference for physics.

Finally, pay attention to the world and parent volumes. Boolean solids are purely geometrical shapes. The union result must still fit entirely inside its parent volume, and the parent volume must be large enough to contain the extreme points of the combined solid. If you underestimate the size, you will create overlaps with neighboring volumes or even with the parent boundary.

Intersection

Intersection is the boolean operation that keeps only the region that two solids share. All points that lie outside at least one of the solids are removed. In mathematical form, the intersection of solids $A$ and $B$ is
$$
I = A \cap B.
$$

In GATE, an intersection solid is again defined from two base solids together with a relative transformation. You do not place the original solids, you place the intersection result as a new volume. The position and rotation of the second solid relative to the first define which part of space is inside the overlap.

Intersection is particularly useful when you want a complex shape that can be described as the common region of a simple bounding volume and another constraint. A typical example is a cylindrical detector ring that should exist only within a limited axial field of view. Instead of manually cutting the ring with specialized shapes, you can build a long cylindrical ring and intersect it with an axial box that represents the allowed axial region. The resulting solid is exactly the ring section inside the axial box.

Another example is the creation of non trivial collimator shapes. You might start from a box representing the overall collimator envelope and intersect it with a set of tubes or cones that limit the allowed particle trajectories. The intersection will keep only the parts of the tubes that are inside the envelope and remove material outside the intended region.

::danger
An intersection volume contains only the space that belongs simultaneously to both input solids. If the two solids do not overlap, the intersection is empty and the resulting volume is invalid.

Because intersection discards so much space, geometric accuracy is important. Small misalignments or numerical tolerances can easily shrink the overlap to a very thin region, which is difficult to track and can cause step size problems or navigation warnings. It is good practice to design intersections with clear, robust overlaps, such as aligned shapes with generous shared regions.

Like other boolean operations, intersection assigns a single material to the final volume. The internal structure of the two input solids does not matter for material assignment. This means that you cannot use intersection to create a multi material graded object from a uniform one. All physics in the resulting volume will use the one material you specify for that volume.

Performance considerations also apply. Intersections create internal surfaces that are more complex than those of the primitive shapes. Particle transport must frequently test whether a step crosses these internal boundaries. A few intersections usually cause no noticeable slowdown, but heavily nested or deeply chained boolean constructions can degrade performance. It is often better to simplify shapes or use a mix of primitives and a small number of boolean operations rather than building every detail through intersections.

In many medical imaging simulations, intersection helps to align abstract geometrical definitions with real scanner limits. For instance, you might start from a mathematically complete layer of shielding around a detector head and then intersect it with a box that approximates the real housing outline. That way you impose realistic boundaries without reinventing the basic shielding geometry.

Always test intersection volumes visually before running long simulations. Visualization lets you verify that the overlap is present and correctly shaped. If a volume created by intersection appears missing or strangely thin, it often indicates that the two input solids do not overlap in the intended region or that a sign error in a translation has moved one of them away.

Subtraction

Subtraction is the boolean operation that removes one solid from another. You start from a base solid $A$ and a second solid $B$, and you define a new solid $S$ as
$$
S = A \setminus B,
$$
which means all points that belong to $A$ but not to $B$.

In GATE, subtraction is especially powerful for creating holes, grooves, and complex cutouts inside a simple base object. You use it when you want to start from a full block of material and remove parts of it. For example, to create a shielding block with a beam aperture, you might begin with a rectangular lead block and subtract a cylinder that represents the beam channel. The result is a block with a clean cylindrical hole.

Subtraction is also a common way to form more realistic detector housings. Suppose you want a hollow metal casing around a crystal. You can create a large box representing the outer envelope and a slightly smaller inner box that represents the space for the crystal. If you subtract the inner box from the outer one, the result is a shell that you can fill with the crystal volume. Compared to building the shell from several thin boxes, a boolean subtraction gives a single coherent volume with correct internal boundaries.

::danger
In a subtraction $A \setminus B$, any region where the subtracted solid $B$ overlaps the base solid $A$ will be removed from $A$. Parts of $B$ that lie outside $A$ have no effect.

As with union and intersection, subtraction uses one solid as the reference for translations and rotations. The second solid is placed relative to the first, so you must carefully compute the position to align the cutout correctly. Small mistakes lead to off center holes or incomplete cuts. If the subtracted solid extends only partly into the base, you will get a partial cut, which might or might not be what you intend.

Using subtraction affects material transitions significantly. After subtraction, one volume will have a missing region that is filled by whatever volume you place there, or by the parent material if you leave it empty. This defines where material boundaries occur. In the shielding block example, after subtracting a cylindrical tunnel, the tunnel is filled by air or vacuum from the parent volume. If you later place a beam pipe volume into that tunnel, the pipe material will replace the parent material in that region.

Be careful not to rely on boolean subtraction to separate materials inside the same volume. The subtraction only affects the shape. Each volume still has exactly one material. To have a different material in the removed region, you must place an additional volume there. In the hollow housing example, you subtract the inner volume from the housing to create space, then you place a separate crystal volume inside the cavity.

Subtraction can introduce narrow features such as thin walls or sharp edges. While these are sometimes necessary for realistic modeling, they may increase the number of tracking steps and make the simulation slower. Extremely thin structures can also lead to numerical issues when step sizes approach the geometry tolerance. In medical physics simulations it is often acceptable to approximate very thin parts with slightly thicker or simplified shapes, especially when they have a minor impact on dose or detection efficiency.

Before finalizing a subtraction based design, it is important to check for overlaps. If the cavity created by subtraction does not exactly match the volume you place inside it, you may accidentally create overlaps or gaps between the inner volume and the surrounding material. Such errors can be subtle, for example a crystal that slightly protrudes from its housing due to a small offset. Use visualization and, if available, geometry overlap checking tools to detect and correct these problems.

By using union, intersection, and subtraction together, you can create detailed scanner components, phantoms, and shielding structures that closely resemble real devices while still keeping the geometry manageable. The key is to apply boolean geometry only where primitives are insufficient, to maintain clear parent child relationships, and to verify shapes visually before committing to large Monte Carlo runs.

Views: 10

Comments

Please login to add a comment.

Don't have an account? Register now!