Skip to main content
added 1015 characters in body
Source Link

Edit: Just in case somebody comes looking for something like this here is the code I ended up using. I used it as an example in paper to illustrate the concept of tangent spaces.

Manipulate[
 Show[ParametricPlot3D[F[u, t], {t, 0, 2 Pi}, {u, 0, 2 Pi}, 
   AxesEdge -> {{-10, 10}, {-10, 10}, {-10, 10}}], 
  ContourPlot3D[
   normal[px, py][[1]] (x - F[px, py][[1]]) + 
     normal[px, py][[2]] (y - F[px, py][[2]]) + 
     normal[px, py][[3]] (z - F[px, py][[3]]) == 0, {x, xmin, 
    xmax}, {y, ymin, ymax}, {z, zmin, zmax}, 
   ContourStyle -> {Opacity[0.5], Blue}], 
  Graphics3D[{Arrow[{F[px, py], F[px, py] + dxF[px, py]}], 
    Arrow[{F[px, py], F[px, py] + dyF[px, py]}]}], Boxed -> False, 
  Axes -> False, PlotRange -> {{-5, 5}, {-5, 5}, {-5, 5}}], {px, 0, 
  Pi}, {{py, 0.5}, 0.2, Pi/2 - 0.1}, {{xmin, -5}, -10, 
  0}, {{ymin, -5}, -10, 0}, {{zmin, -5}, -10, 0}, {{zmax, 3}, 0, 
  10}, {{ymax, 3}, 0, 10}, {{xmax, 5}, 0, 10}]

Edit: Just in case somebody comes looking for something like this here is the code I ended up using. I used it as an example in paper to illustrate the concept of tangent spaces.

Manipulate[
 Show[ParametricPlot3D[F[u, t], {t, 0, 2 Pi}, {u, 0, 2 Pi}, 
   AxesEdge -> {{-10, 10}, {-10, 10}, {-10, 10}}], 
  ContourPlot3D[
   normal[px, py][[1]] (x - F[px, py][[1]]) + 
     normal[px, py][[2]] (y - F[px, py][[2]]) + 
     normal[px, py][[3]] (z - F[px, py][[3]]) == 0, {x, xmin, 
    xmax}, {y, ymin, ymax}, {z, zmin, zmax}, 
   ContourStyle -> {Opacity[0.5], Blue}], 
  Graphics3D[{Arrow[{F[px, py], F[px, py] + dxF[px, py]}], 
    Arrow[{F[px, py], F[px, py] + dyF[px, py]}]}], Boxed -> False, 
  Axes -> False, PlotRange -> {{-5, 5}, {-5, 5}, {-5, 5}}], {px, 0, 
  Pi}, {{py, 0.5}, 0.2, Pi/2 - 0.1}, {{xmin, -5}, -10, 
  0}, {{ymin, -5}, -10, 0}, {{zmin, -5}, -10, 0}, {{zmax, 3}, 0, 
  10}, {{ymax, 3}, 0, 10}, {{xmax, 5}, 0, 10}]
edited tags
Link
Source Link

Drawing a tangent plane to the torus

I'm trying to draw a torus and a plane tangent to it. Here is my code so far:

F[x_, y_] := {Cos[x] (3 + Cos[y]), Sin[x] (3 + Cos[y]), Sin[y]}
dxF[x_, y_] := D[F[a, b], a] /. {a -> x, b -> y}
dyF[x_, y_] := D[F[a, b], b] /. {a -> x, b -> y}
normal[x_, y_] := Cross[dxF[x, y], dyF[x, y]]
Manipulate[
 Show[Plot3D[(normal[px, py][[1]] (x - F[px, py][[1]]) + 
       normal[px, py][[2]] (y - F[px, py][[2]]))/normal[px, py][[3]] +
     F[px, py][[3]], {x, -4, 4}, {y, -4, 4}], 
  ParametricPlot3D[F[u, t], {t, 0, 2 Pi}, {u, 0, 2 Pi}]], {px, 0, 
  Pi}, {py, 0.1, Pi/2 - 0.1}]

Not sure how to include the output here. This basically draws a torus and a plane but the plane intersects the torus. For some reason the order of the the arguments of SHOW also makes a big difference in output.

Mathematically this should be pretty simple. I find the normal vector to the torus by taking directional derivatives. Then their cross product is the normal vector $(a,b,c)$ to the tangent plane and the equation $z=\frac{1}{c}(a(x-x_0)+b(y-y_0))+z_0$ defines the plane. What am I doing wrong?