The Klein Bottle

The Klein Bottle is an example of a non-orientable surface. Although it can't be embedded in three dimensional space, the code below gives a reasonable approximation. Note the use of the extra LightSources to illuminate the entire scene.


d = .00000001;
r = If[-Pi/2 <= t && t <= Pi/2, 
     (1 - Sqrt[Cos[t]]/2), (1 + Sqrt[-Cos[t]]/2)];
g = TubePlot[{ 2Cos[t] (1 + Sin[t]), 6 Sin[t], 0}, 
    {t, -Pi/2 + d, 3Pi/2 - d}, r, {0, 0, 1},
    PlotPoints -> {48, 12}, Axes -> False, Boxed -> False,
    LightSources -> {{{1., 0., 1.}, RGBColor[1, 0, 0]},
    {{1., 1., 1.}, RGBColor[0, 1, 0]}, {{0., 1., 1.},
    RGBColor[0, 0, 1]}, {{-1., 0., -1.}, RGBColor[1, 0, 0]},
    {{-1., -1., -1.}, RGBColor[0, 1, 0]}, {{0., -1., -1.},
    RGBColor[0, 0, 1]}}]

[UNCA | Math Dept. | Mark's Home]