# Intersection of canal surface with line

A canal surface is the surface formed by sweeping a variable-radius sphere along a path. I'd like to find the intersection points of a line with this surface.

Let $t \in [0,1]$ parameterise the path and $\mathbf{c}(t)$ and $r(t)$ represent the centre and radius of the sphere along the path, then we can define the canal surface as the zeros of the signed field $D$:

$$D(\mathbf{v}) = \inf_{t\in [0,1]} \left( ||\mathbf{v} - \mathbf{c}(t)||^2 - r(t)^2 \right)$$

In my case I can assume that $\mathbf{c}(t)$ and $r(t)$ are at most quadratic polynomials of $t$. As such I can easily evaluate this field for a given $\mathbf{v}$ by finding the zeros of the derivative of the terms in the infemum wrt $t$ (which is just solving a cubic), then just taking the minimum for these $t$ values.

If $\mathbf{v}$ is constrained to a line, I can define some constants $\mathbf{p}$ and $\mathbf{d}$ such that the intersection points are the solution to:

$$D(\mathbf{p} + s\mathbf{d}) = 0$$

I'm a bit stumped how to solve this.

My question is: what numerical methods exist to allow me to solve for $s$? Or is there a simpler way to state the problem?

There is a substitution to solve the equation directly. When the centre and radius are polynomials of degree $d$, this requires solving a polynomial of degree $2(2d - 1)$.