It is known that space curves can either be defined parametrically,
$$\begin{align*}x&=f(t)\\y&=g(t)\\z&=h(t)\end{align*}$$
or as the intersection of two surfaces,
$$\begin{align*}F(x,y,z)&=0\\G(x,y,z)&=0\end{align*}$$
Curves represented parametrically can of course be plotted in Mathematica using ParametricPlot3D[]
. Though implicitly-defined plane curves can be plotted with ContourPlot[]
, and implicitly-defined surfaces can be plotted with ContourPlot3D[]
, no facilities exist for plotting space curves like the intersection of the torus $(x^2+y^2+z^2+8)^2=36(x^2+y^2)$ and the cylinder $y^2+(z-2)^2=4$:
Sometimes, one might be lucky and manage to find a parametrization for the intersection of two algebraic surfaces, but these situations are few and far between, especially if the two surfaces are of sufficiently high degree. The situation is worse if at least one of the surfaces is transcendental.
How might one write a routine that plots space curves defined as the intersection of two implicitly-defined surfaces?
It would be preferable if the routine returns only Line[]
objects representing the space curve. A routine that handles only algebraic surfaces would be an acceptable answer, but it would be nice if your routine can handle transcendental surfaces as well. A bonus feature for the routine might be the ability to determine if the two surfaces given do not have a space curve intersection, or intersect only at a single point, or other such degeneracies.
Answer
I take zero credit for this. It is a method I learned from Maxim Rytin.
ContourPlot3D[{(x^2 + y^2 + z^2 + 8)^2 - 36 (x^2 + y^2),
y^2 + (z - 2)^2 - 4}, {x, -4, 4}, {y, -4, 4}, {z, -2, 2},
Contours -> {0}, ContourStyle -> Opacity[0], Mesh -> None,
BoundaryStyle -> {1 -> None, 2 -> None, {1, 2} -> {{Green, Tube[.03]}}},
Boxed -> False]
Comments
Post a Comment