Algorithm Search⌘K

Problemcore

Curve surface intersection

Also called curve and surface intersection.

Find all points where a parametric curve meets a parametric or implicit surface, the step that feeds lattice methods, ray tracing of patches and edge splitting.

Curve surface intersection asks for every point where a curve c(τ)c(\tau) meets a surface, given as a parametric patch r(u,v)r(u, v) or as the zero set of a polynomial f(x,y,z)f(x, y, z). In the parametric case the answer is the set of solutions of the three equations c(τ)=r(u,v)c(\tau) = r(u, v) in three unknowns, so the points are isolated except when the curve lies in the surface. The problem is a building block: lattice methods for surface surface intersection intersect many curves with one surface, a ray tracer intersects rays with patches, and a modeler splits the edges of a B-rep where they cross a face. The hard parts are to find every point, including those where the curve only touches the surface, and to tell touching from crossing.

In plain words

A wire passes through a curved sheet. You want every spot where the wire meets the sheet. The wire is drawn by a formula with one number, the sheet by a formula with two numbers, and a meeting point is where both formulas give the same point in space. That is three equations, one for each direction in space, in three unknown numbers, so the answer is usually a few separate points.

Most points are clean crossings, where the wire goes from one side of the sheet to the other. Some are touching points, where the wire just grazes the sheet and stays on one side. Those are hard to find, because a small change in the shape turns one touching point into two crossings or into none. In the worst case the wire lies inside the sheet for a while, and the answer is a piece of curve.

Definition

Input. A regular curve c:[a,b]→R3c : [a, b] \to \mathbb{R}^3, polynomial or rational, such as a Bézier curve, a B-spline or a NURBS curve. A surface, either a regular parametric patch r:Ω→R3r : \Omega \to \mathbb{R}^3 on a box Ω\Omega, or an implicit surface {x:f(x)=0}\{x : f(x) = 0\} for a polynomial ff. A tolerance ε>0\varepsilon > 0 for the numerical case.

Output. All parameter values τ∈[a,b]\tau \in [a, b], with the matching (u,v)∈Ω(u, v) \in \Omega in the parametric case, at which the curve meets the surface:

F(τ,u,v)=c(τ)−r(u,v)=0org(τ)=f(c(τ))=0,F(\tau, u, v) = c(\tau) - r(u, v) = 0 \qquad \text{or} \qquad g(\tau) = f(c(\tau)) = 0,

each point with its type: transversal when the curve crosses the surface there, tangential when the tangent c′(τ)c'(\tau) lies in the tangent plane of the surface. If the curve lies in the surface over an interval, that interval is reported as an overlap. In the numerical version each reported point is within ε\varepsilon of a true point, and the true points and the reported ones are in one to one correspondence.

When a point is regular. At a point of the parametric case the Jacobian of FF is the 3×33 \times 3 matrix with columns c′(τ)c'(\tau), −ru-r_u, −rv-r_v, and

det⁡[ c′,  −ru,  −rv ]=c′⋅(ru×rv).\det \big[\, c', \; -r_u, \; -r_v \,\big] = c' \cdot (r_u \times r_v).

Proof. Negating two columns leaves a determinant unchanged, so the determinant equals det⁡[c′,ru,rv]\det[c', r_u, r_v], which is the triple product c′⋅(ru×rv)c' \cdot (r_u \times r_v). □\square

Since ru×rvr_u \times r_v is a nonzero multiple of the normal NN, the Jacobian is nonsingular exactly when c′⋅N≠0c' \cdot N \ne 0, that is, at a transversal point. So transversal points are regular solutions of the system: they are isolated, they move continuously when the curve and the surface move a little, and Newton's method for systems converges quadratically to them. Tangential points are singular solutions, with none of these properties. In the implicit case the same holds with g′(τ)=∇f⋅c′(τ)g'(\tau) = \nabla f \cdot c'(\tau).

Variants

  • Rational polynomial curve and implicit algebraic surface. Substitute: g(τ)=f(c(τ))g(\tau) = f(c(\tau)) is one polynomial in one unknown, and the problem is the real roots of gg in [a,b][a, b]. This is the easy case, treated by Patrikalakis and Maekawa in Section 5.7.1.
  • Rational polynomial curve and rational polynomial surface. The general CAD case, three equations in three unknowns, Section 5.7.2. It reduces to the first case by implicitization of the patch, at the cost of a high degree.
  • Line and surface. The curve is a line or a ray. This is ray casting of a surface, see ray object intersection. It is also the directional variant of point projection.
  • Isoparametric curve. The curve is a parameter line of a second surface, τ↦r2(τ,v0)\tau \mapsto r_2(\tau, v_0). Lattice methods for surface intersection solve many of these, see lattice evaluation intersection.
  • Plane curves. With a curve and a curve in the plane, the problem is curve intersection, two equations in two unknowns.

Examples

  • A twisted cubic and a plane. The curve c(τ)=(τ,τ2,τ3)c(\tau) = (\tau, \tau^2, \tau^3) meets the plane x+y+z=1x + y + z = 1 where τ3+τ2+τ−1=0\tau^3 + \tau^2 + \tau - 1 = 0. The derivative 3τ2+2τ+13\tau^2 + 2\tau + 1 has no real root, so the cubic is increasing and has exactly one real root, τ≈0.543689\tau \approx 0.543689, at the point (0.543689,0.295598,0.160713)(0.543689, 0.295598, 0.160713). There c′⋅(1,1,1)=3τ2+2τ+1≈2.974≠0c' \cdot (1, 1, 1) = 3\tau^2 + 2\tau + 1 \approx 2.974 \ne 0, so the point is transversal.
  • A line through a bump. Let r(u,v)=(3u,3v,27u(1−u)v(1−v))r(u, v) = (3u, 3v, 27 u (1 - u) v (1 - v)), the bicubic bump with control points (i,j,zij)(i, j, z_{ij}), zij=3z_{ij} = 3 for the four inner points and 00 for the others. The line c(τ)=(τ,1.5,1)c(\tau) = (\tau, 1.5, 1) forces v=12v = \tfrac12 and u=τ/3u = \tau / 3, and then 274u(1−u)=1\tfrac{27}{4} u (1 - u) = 1, so u(1−u)=427u (1 - u) = \tfrac{4}{27} and u=12(1±11/27)u = \tfrac12 (1 \pm \sqrt{11/27}). The two points are at u≈0.180858u \approx 0.180858 and u≈0.819142u \approx 0.819142, so τ≈0.542573\tau \approx 0.542573 and τ≈2.457427\tau \approx 2.457427. Both are transversal: the slope of the bump along the line is 274(1−2u)≈±4.308\tfrac{27}{4}(1 - 2u) \approx \pm 4.308, not 00.
  • A tangential point. The line (τ,1.5,2716)(\tau, 1.5, \tfrac{27}{16}) through the top of the same bump gives u(1−u)=14u (1 - u) = \tfrac14, a double root at u=12u = \tfrac12. The line touches the bump at its top, and raising the line by any amount removes the point, while lowering it splits the point in two.
  • An overlap. The line (τ,0,0)(\tau, 0, 0) lies in the bump along the edge v=0v = 0, where the height is 00. Every τ∈[0,3]\tau \in [0, 3] is a solution.
  • A line and a sphere. The line p+τdp + \tau d with ∣d∣=1|d| = 1 meets the sphere ∣x∣2=R2|x|^2 = R^2 where τ2+2(p⋅d)τ+∣p∣2−R2=0\tau^2 + 2 (p \cdot d) \tau + |p|^2 - R^2 = 0, two points, one tangential point or none by the sign of the discriminant (p⋅d)2−∣p∣2+R2(p \cdot d)^2 - |p|^2 + R^2.

Known algorithms

  • Substitution and root isolation. For an implicit surface, form g=f∘cg = f \circ c and find its real roots with real root isolation, a Sturm sequence, or Bézier clipping on the Bernstein form of gg. With exact rational coefficients this is a certified method, and the multiplicity of each root tells crossings from touchings.
  • Implicitization. Compute the implicit equation of the patch by a resultant, as Sederberg, Anderson and Goldman (1984) proposed, and substitute the curve. The degree is high, up to 1818 for a bicubic patch, and the coefficients grow, so this is used mostly for low degrees.
  • Subdivision. Split the curve and the patch with the de Casteljau algorithm and discard pairs whose convex hulls, or bounding boxes, do not overlap. When the pieces are flat enough, intersect a segment with a pair of triangles and refine with Newton. It is robust for transversal points and slow near tangential ones.
  • Interval projected polyhedron. Write the three equations in Bernstein form over the box of (τ,u,v)(\tau, u, v) and use the interval projected polyhedron method, which finds all roots in the box with outward rounding. Patrikalakis and Maekawa, Section 5.7.2.3.
  • Bézier clipping. The clipping idea of Bézier clipping extends from two curves to a ray and a patch: project the patch onto two planes that contain the ray, which gives two equations in (u,v)(u, v), and clip the parameter box with the convex hulls of the projected control points.
  • Newton. From a start point on each intersection, Newton on F=0F = 0 converges quadratically at transversal points. It is the refinement step of the other methods, and on its own it misses points that have no start.

Bounds

Degree bound, implicit surface. If cc is a polynomial curve of degree dd and ff has degree kk, then g=f∘cg = f \circ c has degree at most kdkd, so the curve meets the surface in at most kdkd points unless gg is the zero polynomial, in which case the whole curve lies in the surface. For a rational curve c=P/wc = P / w of degree dd, the numerator wkf(P/w)w^k f(P / w) of gg, the homogenized ff evaluated at (P,w)(P, w), has degree at most kdkd, with the same conclusion. A line meets a quadric in at most 22 points, and a cubic curve meets a quadric in at most 66.

Proof. Each monomial of ff of degree j≤kj \le k becomes a product of jj coordinates of cc, of degree at most jd≤kdjd \le kd. In the rational case multiply each monomial by wk−jw^{k - j}. A nonzero polynomial of degree at most kdkd has at most kdkd roots. □\square

Degree bound, parametric patch. A rational tensor product patch of bidegree (m,n)(m, n) has an implicit equation of degree at most 2mn2mn, so a rational curve of degree dd meets it in at most 2mnd2mnd points, or lies in its implicit surface. For a bicubic patch and a line this is 1818. The patch bound counts the points where a general line meets the patch, as the solutions in P1×P1\mathbb{P}^1 \times \mathbb{P}^1 of two equations of bidegree (m,n)(m, n), of which there are 2mn2mn by Bézout's theorem for bidegree systems. That theorem is cited here, not proved. Base points lower the degree.

Stability. Transversal points are regular solutions, as proved above, so they persist and move continuously under small changes of the data, by the implicit function theorem. A tangential point of multiplicity 22 can split into two transversal points or vanish under an arbitrarily small change, as the line through the top of the bump shows. So no method that works with a fixed precision can decide whether a tangential point exists, and certified methods report it as a box that may hold zero, one or two points.

Reductions

  • To one polynomial. With an implicit surface, the problem is the real roots of one polynomial in one unknown.
  • To a square system. In the parametric case it is three polynomial equations in three unknowns over a box, a case of systems of nonlinear equations.
  • From curve intersection in the plane. Two plane curves c1(τ)c_1(\tau) and c2(σ)c_2(\sigma) meet where the curve (c1(τ),0)(c_1(\tau), 0) meets the surface (c2(σ),z)(c_2(\sigma), z), a cylinder over c2c_2, so curve surface intersection solves curve intersection.
  • To surface intersection. Lattice methods reduce surface surface intersection to many curve surface problems along the parameter lines of one surface.
  • To distance. The curve meets the surface exactly when the minimum distance between them is 00.

Applications

  • Ray tracing of patches. Each ray is a line, so rendering trimmed NURBS models directly needs a line and patch intersection per ray.
  • Boolean operations. An edge of one solid is split where it crosses a face of the other, and the new vertices of the result are curve surface intersections.
  • Lattice methods. Intersecting the parameter lines of one patch with the other gives points on the intersection curve of two surfaces, see lattice evaluation intersection.
  • Start points for marching. The points where the boundary curves of one patch meet the other surface are the start points of the open branches of an intersection curve, used by marching.
  • Machining and inspection. A probe or a tool moves along a line, and its first contact with the part is a line and surface intersection.

References

  1. Nicholas M. Patrikalakis and Takashi Maekawa, Shape Interrogation for Computer Aided Design and Manufacturing, Springer, 2002, Chapter 5, Section 5.7, Curve/surface intersection, with 5.7.1 (a rational polynomial curve against an implicit algebraic surface, by substitution) and 5.7.2 (against a rational polynomial surface, by implicitization, by subdivision and by the interval projected polyhedron method)
  2. Thomas W. Sederberg, David C. Anderson and Ronald N. Goldman, Implicit representation of parametric curves and surfaces, Computer Vision, Graphics, and Image Processing 28(1), 72 to 84, 1984, the whole paper (implicit equations of rational curves and surfaces by resultants, and their use to turn a parametric intersection into the roots of one polynomial)
  3. Gerald Farin, Curves and Surfaces for CAGD, A Practical Guide, fifth edition, Morgan Kaufmann, 2002, the chapters on Bézier curves and tensor product Bézier patches (the convex hull property and subdivision that the subdivision methods use; general locator)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a known algorithm
  • a contract.yaml