# Change position of mesh

I'm trying to plot a 3D graphic and I want to highlight the intersection between two graphics: a plane and a surface. I thought that Meshfunction->{#3&} was a good idea, but I realized that I can't change the position of the mesh!

This is my code:

a = 0.5;
J = -3.00;

U[x_,y_,a_] := -(1-a)/Sqrt[(x-a)^2+y^2] - a/Sqrt[(x+1-a)^2+y^2] - 0.5*(x^2+y^2);
t=Table[
Show[
Plot3D[2*U[x,y,a], {x,-1.5,1.5}, {y,-1.5,1.5},
PlotRange -> {-2.7,-4.0}, Mesh -> 1, MeshFunctions -> {#3&},
MeshStyle -> {Orange, Thick}, ClippingStyle->None,
PlotStyle -> Directive[Gray],
AxesLabel -> {Style["x",Italic,20],Style["y",Italic,20],Style["J=2U(x,y,a)",Italic,20]}],
Plot3D[J-t, {x,-1.5,1.5}, {y,-1.5,1.5},
Mesh -> False, PlotStyle -> Directive[Green,Opacity[0.5]]],
ImageSize->700],
{t, 0., .7, .2}]


Someone can help me please?

-

Is this what you want?

a = 0.5;
J = -3.00;

U[x_, y_, a_] := -((1 - a)/Sqrt[(x - a)^2 + y^2]) -
a/Sqrt[(x + 1 - a)^2 + y^2] - 0.5*(x^2 + y^2);
t = Table[
Show[Plot3D[2*U[x, y, a], {x, -1.5, 1.5}, {y, -1.5, 1.5},
PlotRange -> {-2.7, -4.0}, Mesh -> {{0}},
MeshFunctions -> {(#3 - (J - t)) &}, MeshStyle -> {Orange, Thick},
ClippingStyle -> None, PlotStyle -> Directive[Gray],
AxesLabel -> {Style["x", Italic, 20], Style["y", Italic, 20],
Style["J=2U(x,y,a)", Italic, 20]}],
Plot3D[J - t, {x, -1.5, 1.5}, {y, -1.5, 1.5}, Mesh -> False,
PlotStyle -> Directive[Green, Opacity[0.5]]],
ImageSize -> 700], {t, 0., .7, .2}]


You can have a look at Mesh and MeshFunction documentation, it's very helpful I think.

-
Thanks a lot this is what i need !!!! Very good answer ! Yes i see the MeshFunction documentation but i didn't understand how to modify the simple MeshFunction->{#3&} to a dynamic version that change the meshLevel. – federico Apr 20 '13 at 2:54