# Plotting a field inside of a shape

I want to plot a field of vectors revolving on the inside of a torus in the positive x-direction. I don't know how to constrain the field on Mathematica. What would be the most efficient way to do this?

ParametricPlot3D[{{Sin[u], Cos[u], u/10}, {Cos[u], Sin[u], u/10}}, {u,
0, 20}]
RevolutionPlot3D[{2 + Cos[t], 2 + Sin[t]}, {t, 0, 2 Pi}]


I want to plot vectors like these inside of my torus.

• Welcome to MSE. Please edit your question and add the code you have tried and the problems you faced. Jan 24 at 0:54
• You need to add some picture to describe your demand. Jan 24 at 0:58
• What is the function about such field? Jan 24 at 1:14

I'm not really sure of what vector field is desired. It might be {1, 0, 0}, but I'll use {-z, x, y}:

VectorPlot3D[{-z, x, y},
{x, -1.4, 1.4}, {y, -1.4, 1.4}, {z, -1.4, 1.4},
RegionFunction ->
Function[{x, y, z},
Evaluate[(Norm[{x, y, z} - Normalize@{x, y, 0}] /.
Abs -> Identity // Simplify) < 1/3]],
VectorPoints -> Fine]


• Yes! This is what I needed, well not exactly of course but the framework! Thank you so much! Jan 24 at 8:12
• SliceVectorPlot3D also can help?
– yode
Jan 24 at 8:51
• @yode I thought about it for showing the v.f. on the surface but only now thought about showing it inside the surface, if that's what you mean. Example: i.stack.imgur.com/TPr9n.png Jan 24 at 16:54