Lesson 3.15 · III Modelling
What research knows about intersections
What it's about: Lesson 3.6 shows how knotflow finds the curve where two surfaces intersect, and Lesson 3.7 shows how Booleans are made from it. Both honestly state their limits at the end: tiny loops, touches, tolerances that "hold in one's head". Research has worked on exactly these points for forty years. This lesson presents six ideas from research papers that knotflow intends to adopt, and three that it deliberately does not. Formulas are only provided where they are helpful. Each section states where knotflow stands today.
Prerequisite: Lesson 3.6 (start points, tracing, touching). The sections are independent of each other; you can jump around.
Status: The methods in this lesson are planned in knotflow, not yet built. If one is implemented, its section will move to the lesson describing that method (3.6, 3.7, or 3.8).
1. What it's actually about: the first point
Tracing an intersection curve (Lesson 3.6, Section 3) is reliable: if you have one point on the curve, you can find the rest. The difficult part is the first point on each branch. To handle this, knotflow breaks both surfaces into coarse triangles and looks for where triangles come close to each other. It finds an astonishing amount: a torus just below a plane (distance 0.00001 mm) yields both rings; a sphere whose cap rises above a plane by 0.000001 mm yields its tiny circle.
However, there is no proof that nothing is missing. The method is called subdivision in the literature: decompose, compare coarsely, refine. It fails exactly where a loop is smaller than the deviation of the triangles from the surface, or where the surfaces almost touch along an entire line. A comparison in a recent article (Yang & Jia 2026) sent 1000 pairs of surfaces through common CAD kernels: the best found the correct shape of the intersection curves in 99.2 %, a widespread free kernel in 90.6 % of cases. What was missing was almost always small loops and touching points.
2. Finding small loops across the distance landscape
Idea (Yang & Jia 2026): Instead of searching for places where the surfaces meet, search for places where the distance between them has a peak or a valley.
Imagine the first surface as a map with coordinates (u, v). For every point, record how far away the second surface is, with a sign: positive on one side, negative on the other. This creates a landscape φ(u, v). The intersection curve is the contour line 0 of this landscape, the "coastline."
Now the crucial thought: A closed coastline always encloses a peak or a valley. An island has a highest point, a lake a lowest. Whoever finds all peaks and valleys finds every loop, no matter how small. At a peak, the landscape is flat: the gradient (the arrow pointing uphill) is zero. Such places are called critical points. Geometrically, these are places where the two surface normals are parallel.
How do you find critical points without scanning the landscape finely everywhere? Via the winding number:
- Place a coarse grid over the map and calculate the gradient at each grid point. This is cheap.
- Only remember which quadrant the arrow points to: top right (1), top left (2), bottom left (3), or bottom right (4).
- For each grid cell, traverse the four corners counter-clockwise. If the arrow rotates all the way around (1, 2, 3, 4), the winding number is +1. If it just wobbles back and forth, it is 0.
- A cell with a winding number not equal to 0 must contain a critical point. This is a theorem of topology, not a rule of thumb.
In such a cell, Newton's method (Lesson 3.5) finds the critical point precisely. If it lies at height 0, the surfaces touch there in a point. If it lies above or below, draw two lines from it across the surface and intersect them with the other surface. This yields start points on the loop, and tracing from Lesson 3.6 takes over.
Two subtleties:
- A saddle (a pass between two peaks) is also a critical point, with a winding number of −1. If a peak and a saddle lie in the same cell, they cancel each other out. To prevent this, a cell is split if the arrows jump by more than one quadrant at an edge.
- If the surfaces touch along an entire line (a cylinder lying on a plane), every point of this line is critical, and the winding number fails. Then grid edges remain where the arrow jumps. Their midpoints become start values for the same Newton search.
A neighbouring article from the same group (Yang et al. 2025) provides a guaranteed bound for how far the coarse triangles deviate from the surface at most. Currently, knotflow uses a flat five-hundredth of the surface's size for this. With the bound, it would know for each triangle how close "close enough" is.
For knotflow: The search for start points gets the winding number as a second method alongside the coarse triangles. The procedure breaks down into small, individually verifiable steps and only needs building blocks that already exist (nearest point on a surface, Newton with four unknowns). The authors have filed a patent application on the winding-number search (see Literature).
3. What lies at the end of a branch
Lesson 3.6 traces a curve along t = n₁ × n₂. Where the normals are parallel, t is zero, and tracing stops. Today, knotflow guesses what is there: a branch shorter than ten times the tolerance counts as a touching point. This usually works well. Two spheres with radius 10 that overlap by 0.0000001 mm correctly yield a tiny ring. At 0.00000001 mm they still overlap, in a circle of about 0.0003 mm radius, but knotflow reports "the surfaces touch along a line". This is incorrect: they do not touch along a line.
Idea (after Ye & Maekawa 1999, summarised in the overview by Patrikalakis et al.): Instead of guessing, look more closely at the neighbourhood of the point. Where the normals are parallel, both surfaces look like curved shells touching at the point. Their difference in the next approximation is a simple second-degree polynomial in the two directions x and y:
b₁₁·x² + 2·b₁₂·x·y + b₂₂·y²
The numbers b come from the curvature of both surfaces. Experts call this the second fundamental form, which is curvature written as a formula. Where the polynomial is zero, the intersection curve lies. And a single value, the discriminant d = b₁₂² − b₁₁·b₂₂, tells which of three cases applies. It is the same calculation as the question of whether a quadratic equation has two, one, or no solutions:
- d < 0: The surfaces touch only at this point (a sphere on a table). No branch.
- d > 0: Two curves intersect here. Four branches go out, and the polynomial provides their directions. Tracing starts four times anew.
- d = 0: The surfaces touch along a curve. Their direction follows from another formula, and you continue tracing them.
- If all b are zero, the surfaces touch even more closely. This will result in a message with a note.
The same curvature provides a second benefit: the step size. Lesson 3.6 halves the step until the segment fits, and then lengthens it again. If the curvature κ of the intersection curve is known, the correct length is immediately clear: approximately √(8·tolerance/κ). On a circular arc with radius 10 mm and a tolerance of 0.0001 mm, this is about 0.09 mm.
For knotflow: replaces the rule "shorter than ten times the tolerance" with a calculation, and tracing goes through intersections instead of ending at them.
4. When are two points "the same"?
Every Boolean operation constantly asks: Is this corner the same as that one? Does this point lie on that edge? knotflow answers this today at many places with its own factors: four times the tolerance here, ten times there, one millionth of the size at a third place. Every factor is correct for the examples it was made for.
Idea (Jackson 1995): Every part carries its own tolerance. A corner is a small sphere, an edge a thin tube, a face a thin layer. The tolerance measures how precisely the part was actually calculated. A corner where three faces almost meet tangentially is less certain than one where they meet at a right angle, and gets a larger sphere. A comparison then always checks against the sum of the two involved tolerances.
In addition, there are three rules from Jackson and two other articles (Huang et al. 2023, Benouamer et al. 1993, Tsuzuki & Shimada 2003):
- From small to large. First compare corners with corners, then corners with edges, then edges with edges, finally faces. What has already been recognised as common is not re-cut.
- Common pieces. If two edges partially overlap, split each at the ends of the other. The common piece becomes an edge. This is exactly what is missing today when three surfaces pass through the same line, and with two cuts on a surface that lie on top of each other (Lesson 3.7, Section 4).
- Ask symmetrically. "Is a at b?" must give the same answer as "is b at a?". Otherwise, the result depends on which solid came first.
Deliberately not adopted: Jackson lets tolerances grow. If something does not fit, the sphere gets larger until it fits, and corners are merged. This contradicts the principle of knotflow to build exactly (Lesson 1.4). A violation should be a finding, not a repair.
For knotflow: a single function for all "the same?" questions, with measured tolerances instead of scattered factors. This is a large rebuild, and its scope will be settled first.
5. Does a surface cut itself?
An offset surface (Lesson 3.8) can run into itself if the distance is greater than the radius of curvature. A loft or sweep can swing beyond its end cross section. knotflow only checks this today for the offset surface, using a mesh and a tolerance. Small, almost tangential self-intersections slip through. It does not check lofts and sweeps at all.
Idea (Li et al. 2025): a cheap certificate, i.e., a proof that only says yes when it is certainly correct. One takes the normal in the middle of the surface as a reference and asks: Does every other normal of the surface point into the same half of space? If yes, the surface cannot cut itself. It would have to fold over, and in doing so, a normal would reverse.
The beauty of this: The question "does every normal point into the same half?" can be answered without scanning. The dot product of the normal and the reference is itself a spline function. Its coefficients follow directly from the control points of the surface. If all are ≥ 0, the whole function is ≥ 0: A spline function only mixes its coefficients (like de Casteljau in Lesson 1.2) and therefore always stays between the smallest and the largest. If a coefficient is negative, the surface is split and the parts are checked. Only where this no longer helps is precise calculation performed.
For knotflow: a fast pre-test before today's check of the offset surface and for the first time a check for loft and sweep. Self-intersections found are reported, not silently trimmed.
6. Crossing or just touching, in the plane
Even in 2D, in outlines for extrude and regions, curves
intersect. There is a trap there that knotflow probably
has, judging from its code, though no example has shown it yet: If two
curves run almost parallel at an intersection point, the place is
discarded as a "touch". But there are places where they run parallel and
still cross.
Idea (Yap 2006): Divide each curve into elementary pieces: each is only convex or only concave, without an inflection point. Inflection points can be recognised at the control points. For two such pieces, a sign then decides: If the ends of one piece lie on different sides of the other, they cross. If they lie on the same side, they touch at most. An angle is not used as a bound for this.
For knotflow: first a test case that shows whether the trap really springs. Only after that is the procedure built.
7. An independent cross-check
How do you check Booleans? Lesson 3.7 compares volumes: A ∪ B and A ∩ B together must be as large as A and B together. This finds a lot, but not everything. If a piece is missing in one place and there is one too many in another, the errors cancel out in the balance.
Idea (EMBER, Trettner et al. 2022, and as a predecessor Benouamer et al. 1993): Booleans on triangle meshes can be computed exactly, without rounding errors, using integers and fractions. This is slow and unsuitable for output because the curve of intersection then consists of triangle edges instead of the real curve. But it is suitable as a referee: You decompose both inputs into triangles, compute the Boolean exactly, and compare the result piece by piece with that of knotflow. Any deviation above the tolerance of the decomposition is a finding.
For knotflow: an additional check in the fuzzer, offline, with a free library. Not as a replacement in the program.
8. What knotflow deliberately does not adopt
- Booleans on triangle meshes as the main path. Several recent articles compute Booleans on meshes and then put the exact surfaces back (Yang et al. 2025). This is robust, but the method described there only handles two solids at a time and no points where three surfaces meet. knotflow can already do both.
- Methods with provably correct shape. One can turn a surface into an equation and algebraically prove that no loop is missing (Yang et al. 2023). This takes seconds per pair of surfaces instead of milliseconds. For a tool that recalculates while a slider is dragged, this is too slow. As a referee in testing, it would be conceivable.
- Growing tolerances (Section 4): convenient, but not exact.
9. What we learn from this
All six ideas have the same pattern: A general method replaces a rule of thumb. "Branch shorter than ten times the tolerance" becomes the discriminant, "four times the tolerance" becomes the sum of two measured tolerances, "angle smaller than one millionth" becomes a sign. The rules of thumb were not stupid. Each was correct for the cases that one had in mind while writing it, as Lesson 3.6 says at the end. The methods from research also hold for cases that no one thought of. That is why reading is worth it.
Literature
The articles are retold in our own words; the pictures of this lesson are drawn for it.
The authors' research group has filed patent applications on several methods in this lesson: on the winding-number search from section 2 (CN 122289376 A), on a Boolean with a mesh and exact surfaces as in section 8 (CN 121033327 A) and on surface intersection (EP 4752778 A1). Anyone who rebuilds one of these methods should read the claims first. This lesson describes ideas and is not legal advice.
- J. Yang, X. Jia et al.: A Robust and Efficient Intersection Algorithm for NURBS Surfaces: Handling Small Loops and Tangent Intersections. ACM Transactions on Graphics 45(5), 2026. doi:10.1145/3807948 (section 2)
- Y. Yang et al.: Boolean Operation for CAD Models Using a Hybrid Representation. ACM Transactions on Graphics 44(4), 2025. doi:10.1145/3730908 (sections 2 and 8)
- N. M. Patrikalakis, T. Maekawa, K. H. Ko, H. Mukundan: Surface to Surface Intersections. Computer-Aided Design and Applications 1, 2004, p. 449 ff. Summarises X. Ye, T. Maekawa: Differential geometry of intersection curves of two surfaces, Computer Aided Geometric Design 16(8), 1999. (section 3)
- D. J. Jackson: Boundary Representation Modelling with Local Tolerances. 3rd ACM Symposium on Solid Modeling and Applications, 1995. doi:10.1145/218013.218067 (section 4)
- Huang, Chen, Shen, Wang: B-rep Boolean Resulting Model Repair by Correcting Intersection Edges Based on Inference Procedure. 2023, arXiv:2310.10351 (section 4)
- M. O. Benouamer, D. Michelucci, B. Péroche: Error-Free Boundary Evaluation Using Lazy Rational Arithmetic. 2nd ACM Symposium on Solid Modeling and Applications, 1993. doi:10.1145/164360.164403 (sections 4 and 7)
- M. de S. G. Tsuzuki, M. Shimada: Geometric Classification Tests Using Interval Arithmetic in B-rep Solid Modeling. J. of the Brazilian Society of Mechanical Sciences and Engineering 25(4), 2003 (section 4)
- K. Li et al.: Fast Determination and Computation of Self-intersections for NURBS Surfaces. ACM Transactions on Graphics, 2025. doi:10.1145/3727620 (section 5)
- C. Yap: Complete Subdivision Algorithms, I: Intersection of Bezier Curves. 22nd ACM Symposium on Computational Geometry, 2006. doi:10.1145/1137856.1137890 (section 6)
- P. Trettner, J. Nehring-Wirxel, L. Kobbelt: EMBER: Exact Mesh Booleans via Efficient & Robust Local Arrangements. ACM Transactions on Graphics 41(4), 2022. doi:10.1145/3528223.3530181 (section 7)
- J. Yang, X. Jia, D.-M. Yan: Topology Guaranteed B-Spline Surface/Surface Intersection. ACM Transactions on Graphics 42(6), 2023. doi:10.1145/3618349 (section 8)
Try it yourself
mkdir -p out
python3 tools/research-figures.py out # the pictures of this lesson
- Two balls that barely overlap: compute
len(intersect(sphere(10), sphere(10) |> move(x: 20 - d)))for d = 0.1, 0.001, 0.00001 and 0.00000001. How large is the ring each time (r ≈ √(10·d))? From when on is it smaller than the tolerance of 0.0001 mm, and what shouldintersectsay then? - For a landscape with a peak and a saddle side by side, draw the arrows at the corners of a cell that holds both. Why is the winding number 0?
- For b₁₁ = 1, b₁₂ = 0, b₂₂ = −1, d > 0. In which directions do the four branches run? And for b₁₁ = 1, b₁₂ = 1, b₂₂ = 1?
- To think about: why is the certificate of section 5 only sufficient? Find a surface that does not cut itself but whose normals still do not all point into the same half.