18
$\begingroup$

I have a $3$-torus ($\mathbf S^1\times\mathbf S^1\times \mathbf S^1$) embedded in 4D Euclidean space. How can I draw the cross-section of this $3$-torus cut by a 3D Euclidean space in an arbitrary direction? The equations are:

$$\begin{align*} x &= (r + (t + d\cos\,a)\cos\,b)\cos\,c\\ y &= (r + (t + d\cos\,a)\cos\,b)\sin\,c\\ z &= (t + d\cos\,a)\sin\,b\\ w &= d\sin\,a \end{align*}$$

where $x,y,z,w$ are the orthogonal coordinates in 4D space, $r,t,d$ are the radii of three circles, and $a,b,c$ denote the angles of the point with respect to the three circles.

$\endgroup$
3
  • 1
    $\begingroup$ Very interesting first question. $\endgroup$
    – DavidC
    Apr 18, 2013 at 16:08
  • 1
    $\begingroup$ I find very useful to solve this kind of problems by solving first a similar question with one dimension less, for example a 2D circle "floating" in 3D, and find (draw) its intersection with an arbirary plane. The idea is try to solve this other problem with techniques that can be easily extended to more dimensions. Hope that helps for the moment. $\endgroup$ Apr 18, 2013 at 16:52
  • $\begingroup$ See laustep.github.io/stlahblog/posts/slicedHypersurface.html $\endgroup$ Aug 10, 2023 at 11:08

2 Answers 2

19
$\begingroup$

Take $r=1, t=5, d=10$ for example:

r = 1; t = 5; d = 10;

The parametric equation for the 3-torus is given by:

torus3 = {(r + (t + d Cos[a]) Cos[b]) Cos[c],
          (r + (t + d Cos[a]) Cos[b]) Sin[c],
          (t + d Cos[a]) Sin[b], d Sin[a]};

Suppose the plane is determined by its normal $\mathbf n$ and a point $\mathbf o$ on it:

\[DoubleStruckN] = Normalize[RandomReal[{0, 1}, 4]]
\[DoubleStruckO] = RandomReal[{-.5, .5}, 4]
{0.0266919, 0.556735, 0.561821, 0.611302}
{-0.4925, 0.182885, -0.174828, 0.394413}

So the cross section gives a constraint on $a, b, c$, which is $(\text{torus3}-\mathbf{o})\cdot\mathbf{n}=0$, which then defines a contour surface paraRegion in 3D Euclidean space (didn't take the full $[0, 2\pi]$ ranges, so later we can see some inner structure of the cross section surface):

paraRegion = 
 ContourPlot3D[
  Evaluate[(torus3 - \[DoubleStruckO]).\[DoubleStruckN] == 0],
  {a, .4 π, 2π - .93 π}, {b, 0, 2 π-.1 π}, {c, 0, 2 π - .2 π},
  PlotRange -> All,
  ColorFunction -> Function[{a, b, c, f}, Hue[b, c, a]],
  PlotPoints -> 6, MaxRecursion -> 2,
  BoundaryStyle -> Directive[{Thickness[.01], GrayLevel[.7]}],
  MeshFunctions -> {#1 &, #2 &, #3 &},
  MeshStyle -> {RGBColor[1, .5, .5], RGBColor[.5, 1, .5], RGBColor[.5, .5, 1]},
  Lighting -> "Neutral",
  AxesLabel -> (Style[#, 20, Bold] & /@ {a, b, c})]

initial contour surface

Thanks to the plane, we can reduce the cross section into 3D Euclidean space:

crossEq = RotationMatrix[{\[DoubleStruckN], {0, 0, 0, 1}}].torus3 // Most

So we can further transform the feasible $(a,b,c)$ set paraRegion to the cross section surface we want:

Cases[paraRegion,
   GraphicsComplex[pts_, others_,
     opts1___, VertexNormals -> vn_, opts2___] :>
    GraphicsComplex[
     Function[{a, b, c}, Evaluate[crossEq]] @@ # & /@ pts,
     others, opts1, opts2], ∞][[1]] // Graphics3D[#,
   Axes -> True, PlotRange -> All, Lighting -> "Neutral"] &

3-torus with cut-away

Remark

Please beware that there are disadvantages of the above method, because Polygons in the cross section surface are directly inherited from the feasible parameter surface. To make sure this is correct, an assumption has to be made that the cross section surface must be continuous over the whole of paraRegion.

$\endgroup$
3
  • $\begingroup$ Wow,thanks very much! It is really beautiful! $\endgroup$ Apr 18, 2013 at 20:31
  • $\begingroup$ @ShenghanJiang You're welcome! Good first question! $\endgroup$
    – Silvia
    Apr 19, 2013 at 2:22
  • $\begingroup$ * brain explodes * $\endgroup$
    – amr
    Apr 19, 2013 at 3:19
14
$\begingroup$

We can use the result of

gb = FullSimplify[
         GroebnerBasis[{x == (r + (t + d Cos[a]) Cos[b]) Cos[c], 
                        y == (r + (t + d Cos[a]) Cos[b]) Sin[c], 
                        z == (t + d Cos[a]) Sin[b], w == d Sin[a], 
                        Cos[c]^2 + Sin[c]^2 == 1, Cos[b]^2 + Sin[b]^2 == 1, 
                        Cos[a]^2 + Sin[a]^2 == 1}, {x, y, z, w},
                       {Cos[c], Sin[c], Cos[b], Sin[b], Cos[a], Sin[a]}]]

to yield the implicit Cartesian equation for the $3$-torus:

t4[d_, r_, t_][x_, y_, z_, w_] = First[gb];

(Some people seem intimidated by the use of GroebnerBasis[], but here its only purpose is for eliminating parameters. Here's a simpler example of its use: First[GroebnerBasis[{x == Cos[t], y == Sin[t], Cos[t]^2 + Sin[t]^2 == 1}, {x, y}, {Cos[t], Sin[t]}]] == 0, which yields the equation of a circle.)

We can then slice this torus with a hyperplane parametrized by its normal and its distance from the origin, like so:

With[{d = 10, t = 5, r = 1, (* radii *)
      nrm = Normalize[{1, -1, 1, -1}], h = 4 (* hyperplane parameters *)}, 
 ContourPlot3D[(t4[d, r, t][\[FormalX], \[FormalY], \[FormalZ], \[FormalW]] /. 
                Thread[{\[FormalX], \[FormalY], \[FormalZ], \[FormalW]} -> 
                RotationTransform[{nrm, {0, 0, 0, 1}}][{x, y, z, h}]]) == 0 // Evaluate,
               {x, -15, 0}, {y, -15, 15}, {z, -15, 15}, 
               BoundaryStyle -> Opacity[1/2, Gray], BoxRatios -> Automatic, 
               ContourStyle -> Opacity[3/4, ColorData["Legacy", "Mint"]], 
               Lighting -> "Neutral", MeshStyle -> {Red, Green, Blue}, PlotPoints -> 20]]

slice of 3-torus

To appreciate this approach, contrast this with a low-dimensional version:

t3[p_, q_][x_, y_, z_] := (x^2 + y^2 + z^2 + p^2 - q^2)^2 - 4 p^2 (x^2 + y^2)

With[{p = 3, q = 1, nrm = Normalize[{1, -2, 3}], h = 1},
     {ContourPlot[(t3[p, q][\[FormalX], \[FormalY], \[FormalZ]] /. 
                  Thread[{\[FormalX], \[FormalY], \[FormalZ]} -> 
                  RotationTransform[{nrm, {0, 0, 1}}][{x, y, h}]]) == 0 // Evaluate,
                  {x, -5, 5}, {y, -5, 5}, AspectRatio -> Automatic, 
                  ContourStyle -> Directive[AbsoluteThickness[2], ColorData[1, 1]]],
      ContourPlot3D[t3[p, q][x, y, z] == 0, {x, -5, 5}, {y, -5, 5}, {z, -5, 5}, 
                    BoundaryStyle -> Directive[AbsoluteThickness[2], ColorData[1, 1]],
                    Mesh -> None, RegionFunction -> Function[{x, y, z}, nrm.{x, y, z} < h]]}
            // GraphicsRow]

toric sections


Here's a less spherical-looking cross-section of a different $3$-torus, with a convenient cut-away to display the inner structure:

With[{d = 9, t = 6, r = 3, nrm = Normalize[{1, 3, 1, 3}], h = 2}, 
  ContourPlot3D[(t4[d, r, t][\[FormalX], \[FormalY], \[FormalZ], \[FormalW]] /. 
                Thread[{\[FormalX], \[FormalY], \[FormalZ], \[FormalW]} -> 
                RotationTransform[{nrm, {0, 0, 0, 1}}][{x, y, z, h}]]) == 0 // Evaluate,
                {x, -16, 16}, {y, -16, 16}, {z, -16, 16}, 
                BoundaryStyle -> None, BoxRatios -> Automatic, 
                ContourStyle -> Directive[ColorData["Legacy", "PowderBlue"],
                                          Specularity[2/3, 20]],
                Lighting -> "Neutral", MaxRecursion -> 1, 
                MeshStyle -> Map[Directive[GrayLevel[1/10], Glow[#], Specularity[1, 15]] &,
                                 {Magenta, Orange, Cyan}], 
                Method -> {"TubePoints" -> 20}, PlotPoints -> 15, 
                RegionFunction -> Function[{x, y, z}, x < 0 || y > 0 || z < 0]]] /.
  Line[pts_, rest___] :> Tube[pts, 0.1, rest]

another 3-torus cross-section

$\endgroup$
5
  • $\begingroup$ +1 never used GroebnerBasis before. $\endgroup$
    – Silvia
    Apr 19, 2013 at 4:25
  • $\begingroup$ @Silvia, it's a very useful thing. If you know in advance that your parametrized (hyper)surface is algebraic, you can then use GroebnerBasis[] for eliminating the parameters and get an implicit Cartesian equation. $\endgroup$ Apr 19, 2013 at 4:37
  • $\begingroup$ I have heard of it from some automated theorem proving topics, but not really understand it. (Not really understand any algebra things anyway O__O"…) $\endgroup$
    – Silvia
    Apr 19, 2013 at 4:58
  • $\begingroup$ Thanks, this is very useful, although the concept of Groebner Basis is hard for me to understand $\endgroup$ Apr 19, 2013 at 10:47
  • $\begingroup$ @Shenghan, as I said to Silvia, just think of it as a way to eliminate the parameters in your parametric equations. $\endgroup$ Apr 19, 2013 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.