Tetrahedron-Tetrahedron Intersection and Volume Computation Using Neural Networks
Collisions, overlaps, and contact between 3D objects are at the heart of modern simulation, engineering design, and physics-based animation. Every time a car crash is simulated, a medical implant is modeled, or a complex structure is stress-tested virtually, the underlying computations depend on detecting and measuring intersections between basic building blocks of geometry. Among these, tetrahedron–tetrahedron intersection is one of the most fundamental problems. Traditional algorithms can be exact, but they are often fragile in degenerate cases and too computationally heavy to scale to today's large, real-time workloads. In this work, we reframe the challenge as a learning problem: a neural network trained on millions of synthetic examples predicts both whether two tetrahedra intersect and, if they do, the volume of their overlap.
Method Overview
Our framework combines carefully designed data generation, geometric preprocessing, and a neural inference pipeline. The goal is to produce a dataset rich in intersection diversity, normalize geometry to remove redundant variability, and train a scalable neural network that directly classifies intersection type and regresses intersection volume.
1. Data generation — ensuring intersection diversity
Random sampling inside the unit cube produces mostly trivial cases (disjoint or complete overlap). To guarantee coverage of meaningful geometric relationships, we generate and verify samples across five canonical interaction modes. Each mode uses a targeted generation heuristic and is validated using robust geometric predicates (e.g., CGAL).
| Interaction Mode | Generation Strategy | Verification |
|---|---|---|
| No intersection | Generate random pairs until disjoint (efficient due to sparsity). | CGAL do_intersect returns false |
| Point contact | Place one vertex of T₂ exactly on a face of T₁, sample remaining vertices away using a hemisphere constraint. | Verify single-vertex intersection (intersection cardinality = 1). |
| Edge (segment) intersection | Constrain two vertices of T₂ to lie on a face plane of T₁ to create a shared segment; place other vertices via hemisphere sampling. | Confirm intersection reduces to a shared segment / edge with degenerate volume. |
| Face (polygon) intersection | Make three vertices of T₂ coplanar with a chosen face of T₁, place the fourth vertex on the opposite hemisphere to avoid volumetric overlap. | Validate planar face contact via orientation and coplanarity predicates. |
| Volume (polyhedron) intersection | Rejection sampling for overlapping interiors, stratified to cover a logarithmic range of intersection volumes (log-binning + pruning). | Use robust boolean intersection (e.g., CGAL Nef polyhedron) and measure volume to match target bins. |
2. Preprocessing — normalizing geometry
Raw vertex coordinates include translation, rotation, and scale degrees of freedom that do not help learning. We applied two normalization strategies (both evaluated; PCA worked best empirically) and a volume scaling heuristic to stabilize regression targets.
Unitary tetrahedron transformation
Map reference tetrahedron T₁ to a fixed unitary tetrahedron inside the unit cube via an
affine transform A.
Transform T₂ with the same map and feed the transformed T₂' to the model. Predicted
volumes are rescaled by |det(A)|
to recover physical units.
Principal axis transform (PCA)
Align T₁ to its principal axes by rotating both tetrahedra with the PCA-derived rotation matrix. This reduces rotational variance and yielded the best empirical performance.
Volume scaling: multiply ground-truth volumes by 1000 before training to keep
regression targets numerically stable; invert the scaling at evaluation/inference.
3. Neural architecture
The network is inspired by PointMLP and DeepSets, designed to process small sets of 3D points efficiently and remain invariant to vertex ordering. Building on these principles, we introduce TetrahedronPairNet, a custom architecture tailored for learning intersection properties from one or two tetrahedra.
TetrahedronPairNet
TetrahedronPairNet is explicitly constructed to respect the geometric symmetries of the problem domain. It is permutation-invariant with respect to both vertex ordering and tetrahedron pairing, ensuring that equivalent geometric configurations map to consistent representations. The model can also be extended to integrate additional priors, such as translation invariance or symmetry, through geometric transformation modules.
The architecture operates in three main stages:
- Per-Vertex Encoding: Each of the eight input vertices (2 tetrahedra × 4 vertices) is independently processed by a shared MLP. A residual connection from the raw 3D coordinates to the final MLP layer preserves geometric fidelity and stabilizes gradient flow.
-
Tetrahedral Pooling: Encoded vertex features within each tetrahedron
are aggregated using a symmetric function (
maxby default) to yield a fixed-length, order-invariant representation. A second MLP then refines these pooled features to capture intra-tetrahedron interactions. - Pairwise Refinement & Global Residual: The embeddings of the two tetrahedra are concatenated and passed through another MLP to capture inter-tetrahedron interactions. In parallel, the raw input (12D or 24D) is projected through a shallow residual path and added to the fused representation. This final embedding is shared across layers and branched into classification and regression heads.
TetrahedronPairNet is modular and tunable. Aggregation functions
(max, sum, mean) and MLP widths/depths
can be adapted to balance task complexity and computational constraints.
4. Training, tuning and scale
The scaled-up configuration of TetrahedronPairNet (L) uses deeper task-specific heads while keeping the encoder compact. The overall architecture is summarized below:
| Component | Layer Sizes |
|---|---|
| Shared Encoder | [128] |
| Classification Head | [128, 128, 1] |
| Regression Head | [128, 128, 1] |
| Activation Function | ReLU (except final layers) |
| Total Parameters | ≈70,000 |
Training Parameters
- Number of Samples: 1–2 million
- Transformation: Principal Axis Transformation
- Optimizer: AdamW
- Learning rate: 0.001
- Batch size: 2048
- Epochs: 50
- Dropout: 0.4
To achieve the best performance, we found that balancing the dataset across intersection modes was crucial. After experimenting with different mixtures, the most effective distribution was:
| Interaction Mode | Proportion (%) |
|---|---|
| No intersection | 50% |
| Point intersection | 5% |
| Segment intersection | 7% |
| Polygon (face) intersection | 20% |
| Polyhedron (volume) intersection | 18% |
This mix ensured the model was exposed to a balanced spectrum of easy and hard cases—avoiding bias toward trivial disjoint pairs, while still learning from rare but critical geometric edge cases. Empirically, this distribution gave the strongest classification and regression performance.
Results
For classification and regression accuracy, we generated 100,000 samples for each intersection type to ensure statistical significance. For speed evaluation, we simulated a tetrahedron pair moving through space while monitoring intersection status and volume estimation at each timestep.
Classification Performance
| Dataset Subset | Samples | Accuracy |
|---|---|---|
| No Intersection | 100,000 | 97.40% |
| Point Intersection | 100,000 | 98.07% |
| Segment Intersection | 100,000 | 99.20% |
| Polygon Intersection | 100,000 | 98.61% |
| Polyhedron Intersection | 100,000 | 99.63% |
| Overall Accuracy | 500,000 | 98.58% |
| Mean Accuracy | — | 98.58% |
| AUC | — | 0.9813 |
Regression Performance
| Dataset Subset | Samples | MAE | R² | κ | Mean Bin Accuracy |
|---|---|---|---|---|---|
| No Intersection | 100,000 | 6.22×10⁻⁷ | 0 | 0 | 0.9992 |
| Point Intersection | 100,000 | 2.34×10⁻⁸ | 0 | 0 | 1.00000 |
| Segment Intersection | 100,000 | 3.81×10⁻⁷ | 0 | 0 | 0.99993 |
| Polygon Intersection | 100,000 | 2.99×10⁻⁶ | 0 | 0 | 0.99962 |
| Polyhedron Intersection | 100,000 | 1.19×10⁻³ | 0.683 | 0.415 | 0.348 |
Runtime Performance (On 100k samples)
| Component | Value |
|---|---|
| Preprocessing | 19.13 ms |
| Inference | 249.20 ms |
| Total | 268.32 ms |
| Per sample | 0.027 ms |
| Throughput | 37,269 samples/s |
These results show strong classification fidelity across all intersection types and highly reliable regression performance for zero-volume cases, with moderate accuracy on polyhedron volume estimation as expected for a continuous regression task.
Files and Code
- Full version of the Master's Thesis (English only)
- Configurations, Model and Weights
- Open Tetrahedron Pair Dataset Generator
- Open Tetrahedron Pair ML Pipeline
References
- Liu, Y., Fokoue, E., & Krutz, D. (2024). Towards Predicate-powered Learning. OpenReview. View Paper
- Ma, X., Qin, C., You, H., Ran, H., & Fu, Y. (2022). Rethinking Network Design and Local Geometry in Point Cloud: A Simple Residual MLP Framework. arXiv preprint arXiv:2202.07123. View Paper
- Zaheer, M., Kottur, S., Ravanbakhsh, S., Poczos, B., Salakhutdinov, R., & Smola, A. (2017). Deep Sets. arXiv preprint arXiv:1703.06114. View Paper
If you made it all the way here, wow—you must really like geometry (or you’re just very patient). Either way, I hope this little blog gave you something useful and maybe even sparked a bit more curiosity. If you’ve got questions, ideas, or just want to nerd out about shapes, feel free to reach out: erendiropedro@gmail.com

