# Plot a graph in a plane

I have a 3D graphics and i must plot a trajectory on a costant plane but i don't understand how to do this. With a simple Show[] command i can't do this.

This is the code to plot the graphics:

PMotion[mu1_,{x0_,y0_,vx0_,vy0_},tmax_,step_:10000]:=
Module[{rrule,Urule,eqMotion,r1,r2,mu,U},
rrule={r1->Sqrt[(mu+x[t])^2+y[t]^2],
r2->Sqrt[(-1+mu+x[t])^2+y[t]^2]};
Urule={U->(1-mu)/r1+mu/r2+0.5(x[t]^2+y[t]^2)};

eqMotion=
{x''[t]-2y'[t]==D[U/.Urule/.rrule,x[t]],
y''[t]+2x'[t]==D[U/.Urule/.rrule,y[t]]};
NDSolve[{eqMotion/.mu->mu1,x[0]==x0,
y[0]==y0,x'[0]==vx0,y'[0]==vy0}//
Flatten,{x,y},{t,0,tmax},
MaxSteps->step]//Flatten]

Mgraph[fx_,fy_,t_,tfinal_,Opts___]:=
ParametricPlot[{fx[t],fy[t]}//Evaluate,
{t,0,tfinal},
Opts,
AspectRatio->Automatic,
DisplayFunction->Identity];
Protect[PMotion,Mgraph];

Clear["Global*"];

u=0.000954;
x0= 0.93902099; (*0.1;*)
y0= 0.34177569; (*0.21;*)
vx0= 0.;        (*0.133;*)
vy0= 0.;        (*0.231;*)
tfin=200.;

sol=PMotion[u,{x0,y0,vx0,vy0},tfin,50000];
fx[t_]:=x[t]/.sol;
fy[t_]:=y[t]/.sol;

pt1=Mgraph[fx,fy,t,tfin,
PlotPoints->100,
PlotStyle->Black,
Epilog->{
{
AbsolutePointSize[7], Hue[0.7],
Text["\!$$\*SubscriptBox[\(M$$, $$1$$]\)",{0.000954,-0.05}],
Text["\!$$\*SubscriptBox[\(M$$, $$2$$]\)",{1-0.000954,-0.05}],
{Point[{0.000954,0}],Point[{1-0.000954,0}]}
}
,
{
AbsolutePointSize[7],Hue[0.3],
Point[{x0,y0}]},
Text["\!$$\*SubscriptBox[\(x$$, $$0$$]\),\!$$\*SubscriptBox[\(y$$, $$0$$]\)",{x0,y0+0.06}]
}
,
DisplayFunction->$DisplayFunction, ImageSize->700]  This is the surface and the plane: 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= Show[ Plot3D[2*U[x,y,a],{x,-1.5,1.5},{y,-1.5,1.5},PlotRange->{-2.6,-4.0},Mesh->False, PlotStyle->Directive[Gray],AxesLabel->{Style["x",Italic,20],Style["y",Italic,20],Style["J=2U(x,y,a)",Italic,20]}], Plot3D[J,{x,-1.5,1.5},{y,-1.5,1.5},Mesh->False,PlotStyle->Directive[Green,Opacity[0.5]]], ImageSize->700]  I must plot the trajectory ON the green plan. Someone can help me please? - ## 1 Answer Is this what you want? z0=-3; Mgraph[fx_, fy_, t_, tfinal_, Opts___] := ParametricPlot3D[{fx[t], fy[t], z0} // Evaluate, {t, 0, tfinal}, Opts, AspectRatio -> Automatic, DisplayFunction -> Identity]; Protect[PMotion, Mgraph]; pt1 = Show[ Mgraph[fx, fy, t, tfin, PlotPoints -> 100, PlotStyle -> Black, DisplayFunction ->$DisplayFunction],
Graphics3D[{{AbsolutePointSize[7], Hue[0.7],
Text["\!$$\*SubscriptBox[\(M$$, $$1$$]\)", {0.000954, -0.05,
z0}], Text[
"\!$$\*SubscriptBox[\(M$$, $$2$$]\)", {1 - 0.000954, -0.05,
z0}], {Point[{0.000954, 0, z0}],
Point[{1 - 0.000954, 0, z0}]}}, {AbsolutePointSize[7], Hue[0.3],
Point[{x0, y0, z0}]},
Text["\!$$\*SubscriptBox[\(x$$, \
$$0$$]\),\!$$\*SubscriptBox[\(y$$, $$0$$]\)", {x0, y0 + 0.06, z0}]}]]

Show[Plot3D[2*U[x, y, a], {x, -1.5, 1.5}, {y, -1.5, 1.5},
PlotRange -> {-2.6, -4.0}, Mesh -> False,
PlotStyle -> Directive[Gray],
AxesLabel -> {Style["x", Italic, 20], Style["y", Italic, 20],
Style["J=2U(x,y,a)", Italic, 20]}],
Plot3D[J, {x, -1.5, 1.5}, {y, -1.5, 1.5}, Mesh -> False,
PlotStyle -> Directive[Green, Opacity[0.5]]], pt1, ImageSize -> 700]
`

-
Yes this is the right solution!!!!!!!!!!!!!!!! Thanks a lot ! – federico Apr 19 '13 at 17:34