Skip to main content

Module surface_surface

Module surface_surface 

Source
Expand description

Where to look for the closed loops two surfaces meet in: points of S_a(u_a, v_a) = S_b(u_b, v_b) at which the curve they meet in turns back along a direction d (turning_points).

§Why turning points

A boolean finds the curves two faces meet in by tracing them from the points where an edge of one pierces the other. A closed loop lying inside both faces is pierced by no edge, and is never found that way: a bump of one face poking through the other, two freeform faces meeting in an oval.

Every closed loop has a point furthest along any direction d, and one least far: there the curve’s tangent, n_a × n_b, is square to d, so

g = (n_a × n_b) · d = 0.

With the three equations of S_a = S_b that is a square system in the four parameters, and every loop gives at least two of its solutions. Where the surfaces cross transversally the solutions are isolated, so a subdivision search finds every one (“Subdivide to isolate, then Newton to refine”, AGENTS.md): pairs of patches whose control-point boxes are apart hold no point of both; pairs over which g, enclosed from the patches’ normals, is definitely not zero hold no turning point. What is left at the handoff is a candidate, for the caller to refine onto the curve.

§What is not searched

Where the two normals could be parallel the curve has no tangent to turn, and g vanishes for every d: tangent contact, a face flush with another, a node where two branches cross. Those pairs are subdivided only down to a coarser handoff and then set aside (TurningPoints::tangent), for refine_node to find the isolated nodes among them: a loop shrinking into a tangency is the one case left to the caller to notice, as a face the boolean cannot classify.

Structs§

Candidate
A candidate turning point (see TurningPoints::candidates).
TurningPoints
What turning_points finds.

Functions§

refine_node
The node near seed where a and b touch at an isolated point — branches of the curve they meet in cross there, or they touch at that point alone — as its parameters (u_a, v_a, u_b, v_b) and the point, or None where Newton finds no such point, or one not isolated: where the surfaces touch along a curve or over an area, the system is singular and no node is claimed.
turning_points
Candidates for every point at which the curves a and b meet in turn back along a direction chosen here — at least two on every closed loop of them (see the module docs). Errors once max_nodes pairs of patches have been searched with pairs left: a search that did not finish proves nothing.