How this calculation works
Compute exact union volume and exposed surface area for integer-coordinate axis-aligned boxes using coordinate compression.
V=Σoccupied ΔxΔyΔz; S=Σexposed cell faces ΔaΔb.A worked example
The boxes [0,2]³ and [1,3]³ have union volume 15 and exposed surface area 42; their shared interior is counted once.
Good to know
1–25 boxes with integer bounds within ±1000000 and strict minima below maxima. Axis-aligned only; compressed grid limited to 125000 cells. Exact BigInt volume and surface totals; shared interior faces are excluded, while cavity walls count as exposed to empty cells.
Reference: CGAL authors: Boolean solid geometry conventions (opens in a new tab) ↗
Counting shared material only once
A union contains every location belonging to at least one input box. Overlapping portions are not added repeatedly. Its boundary consists of faces separating occupied space from empty space, so shared internal faces disappear even when they belonged to two original box boundaries.
This calculator handles axis-aligned rectangular boxes, not arbitrary rotated parallelepipeds. The coordinate axes are part of the model. Rotating all vertices without changing the box representation would generally create a different axis-aligned enclosure rather than preserve the original solid union.
Compare this with the Disk union area and exposed perimeter calculator from circles. Integrate a3Dunion of rectangular boxes, including hidden shared faces, rather than a planar union of circular disks.
Integer bounds and exact output
Each row contains the minimum x, y, z coordinates followed by the maximum x, y, z coordinates. Every maximum must be strictly greater than its corresponding minimum. Flat rectangles and zero-volume boxes are rejected rather than being given an ambiguous role as surfaces inside a solid-union calculation.
Bounds must be integers in the stated range. Length differences, cell volumes and face areas can then be multiplied and accumulated with arbitrary-size integer arithmetic. The returned volume and area remain exact integers even when their products exceed the range in which a floating number represents every integer exactly.
Two overlapping cubes by hand
The default boxes are the side-two cubes from zero to two and from one to three along all axes. Each has volume eight and their common part is a unit cube. Inclusion-exclusion therefore gives a union volume of eight plus eight minus one, which equals fifteen.
Their separate surface areas sum to forty-eight. Each cube hides three unit-square patches inside the other, removing six square units from the exposed total and leaving forty-two. This calculation checks why subtracting only the overlap volume cannot also determine the surface area without examining which boundary patches become internal.
Coordinate compression preserves every boundary
All distinct input face coordinates are collected separately for x, y and z. Consecutive coordinates define rectangular grid cells. Within any such cell, no input boundary passes through its interior, so the cell is either fully covered by the union or fully empty.
The implementation marks every cell covered by at least one box. It then sums occupied cell volumes. Compression uses only coordinates already present in the input, so it does not approximate a sloping surface with small voxels; for axis-aligned boxes, the cell decomposition represents the union geometry exactly.
Finding the exposed faces
For each occupied cell, the algorithm examines its neighbor across each of six faces. A face contributes area when that neighbor is empty or outside the compressed grid. A face between two occupied cells contributes nothing, because it lies inside the union even if the cells came from different boxes.
This rule also includes the walls of a completely enclosed cavity: they separate material from empty space. The output's surface area is therefore all exposed union boundary, not only the area visible from infinitely far away. That distinction matters when a collection of boxes forms a hollow arrangement.
Why cell counts are diagnostics
The number of occupied compressed cells depends on how input coordinates subdivide the region. Adding a redundant contained box can introduce coordinate planes and change that count without changing union volume or exposed area. Occupied-cell count is a construction diagnostic, not a physical number of separate solid components.
Likewise, the number of exposed compressed faces is not the number of maximal planar boundary polygons. Adjacent coplanar patches can be split into several grid faces. Their areas sum exactly, but the page does not merge them into a minimal boundary mesh or compute a topological genus from those patch counts.
Checking units and intended geometry
Scaling integer coordinates by a positive integer factor scales volume by its cube and surface area by its square. Duplicating a box should leave both totals unchanged. A strictly contained box should not change the outer solid, while a box touching only along a face can remove that shared face from the exposed union boundary.
Use the calculation for small orthogonal solid arrangements with documented coordinate units. It does not accept uncertain decimal measurements, rotated boxes or curved objects automatically. If decimals are converted to integers by a common scale, remember to divide volume and area by the corresponding cubic and quadratic scale factors.
A few questions, answered
Does overlap count twice?
No. A compressed cell is marked occupied once regardless of how many input boxes cover it.
Are internal shared faces included?
No. Only interfaces from occupied cells to empty space contribute surface area.
Are cavity walls included?
Yes. They are part of the boundary between the union material and empty cells.
Is this a voxel approximation?
No. For integer axis-aligned boxes, coordinate compression places every boundary exactly on cell faces.