# Cutting bagels into linked halves

I recently came across this video: Mathematically correct breakfast, which shows how a bagel can be neatly sliced into two identical linked halves.

I'd like to try this with Mathematica. Here's a torus bagel and a Möbius strip cut overlaid. How can I slice the bagel along this cut to create the two halves and pry it open?

With[{opts = {Mesh -> False, Boxed -> False, Axes -> False}},
bagel = ParametricPlot3D[{Cos[t] (3 + Cos[u]), Sin[t] (3 + Cos[u]), Sin[u]},
{t, 0, 2 Pi}, {u, 0, 2 Pi}, opts,
PlotStyle -> Directive[Opacity[0.3], FaceForm[Orange], Lighting -> "Neutral"]];
cut = ParametricPlot3D[{Cos[t] (3 + r Cos[t/2]), Sin[t] (3 + r Cos[t/2]), r Sin[t/2]},
{r, -1, 1}, {t, 0, 2 Pi}, opts,
PlotStyle -> Directive[Opacity[0.9], FaceForm[Gray], Lighting -> "Neutral"]];
]
bagel ~Show~ cut


Although I've used a Möbius strip for the cut, I have a feeling it is a 2-twist strip because of the two sides — I haven't been able to fit this correctly inside a torus...

-
I saw the image of the bagel and said to myself, "I bet Professor Hart made that.." –  BlueRaja - Danny Pflughoeft Jun 28 '12 at 4:57

Here's one way to slice the donut. To draw one half of the sliced donut I'm using a parameterisation of a torus similar to the one on wikipedia, but with v replaced with u + v and v running from 0 to Pi instead of 2 Pi. This means that the cut is actually a double twist loop.

pl = ParametricPlot3D[{{Sin[u] (2 + Cos[u + v]), Cos[u] (2 + Cos[u + v]), Sin[u + v]},
{Sin[u] (2 + (2 v/Pi - 1) Cos[u]), Cos[u] (2 + (2 v/Pi - 1) Cos[u]),
(2 v/Pi - 1) Sin[u]}},
{u, 0, 2 Pi}, {v, 0, Pi}, Mesh -> False, Boxed -> False, Axes -> False]


We could plot the other half in a similar way but to show that the two halves are identical, you can take pl and rotate it over 180 degrees around the z-axis:

Graphics3D[{pl[[1]], Rotate[pl[[1]], Pi, {0, 0, 1}]}, Boxed -> False]


To pry the two halves open, we need to simultaneously rotate and translate one of the halves, for example

Manipulate[Graphics3D[{pl[[1]],
Translate[Rotate[Rotate[pl[[1]], 180 Degree, {0, 0, 1}], -a Degree, {1, 0, 0}],
{1.8 a/90, 0, 0}]}, Boxed -> False],
{{a, 0}, 0, 90}]


Here's an animation of the process:

-
As a tiny mathematical note, the derivation of the parametric equations {(c + b Cos[u + v]) Sin[u], (c + b Cos[u + v]) Cos[u], b Sin[u + v]} might be slightly clearer if seen in matrix-vector format: RotationMatrix[-u, {0, 0, 1}].({0, c, 0} + RotationMatrix[u, {1, 0, 0}].{0, b Cos[v], b Sin[v]}) –  Guess who it is. Jun 28 '12 at 15:18

(This was supposed to be a comment, but it got a bit too long.)

Heike depicted the "sliced bagel" as a composite of two surfaces. Here's how to plot it as a single surface:

With[{c = 2, b = 1},
ParametricPlot3D[Evaluate[
RotationMatrix[-u, {0, 0, 1}].({0, c, 0} +
RotationMatrix[u, {1, 0, 0}].{0, b Cos[v], b UnitStep[Pi - v] Sin[v]})],
{u, 0, 2 Pi}, {v, 0, 2 Pi}, Axes -> False, Boxed -> False, Mesh -> False]]


Now if only there was a way to realistically color the "bagel"...

(If you think that last one is sufficiently "realistic", I'll add the Perlin noise routines needed for this coloring.)

-
That's an everything bagel right there! ;) The inside doesn't look like bready texture though :P –  The Toad Jun 29 '12 at 15:09
Yes, that's going to need some more thought on my end; that's why I didn't post code for the colored version for the time being. (Getting Perlin noise to do what you want can be difficult sometimes...) –  Guess who it is. Jun 29 '12 at 15:13
I'll wait patiently for some Perlin goodness :D –  The Toad Jun 29 '12 at 15:14
I could "toast" the bagel a bit more, if you guys want... or did I do okay with the current shade of brown? –  Guess who it is. Jun 30 '12 at 13:09
The appropriately named "Baked Goods" section of my website maths.ed.ac.uk/~aar/baked includes several references to bagel slicing, and in particular a topological analysis of the possible ways of linking/unlinking a bagel, which is related to the Maslov index. –  Andrew Ranicki May 5 at 6:03