Reputation: 11
I've been given an assigment to create an animation (in Mathematica) of a point moving along a curve created by the common part of an ellipsoid and a plane.
I've made the following as good as I could but I'm stuck.
The formula(?) for the ellipsoid surface and plane:
x^2/4 + y^2/9 + z^2=1
z=-x+2y
Upvotes: 0
Views: 904
Reputation: 13087
you could use ContourPlot
to generate the curve, then extract the points representing the curve and use Manipulate
to generate the animation, i.e.,
P = ContourPlot[x^2/4 + y^2/9 + (-x + 2*y)^2 == 1, {x, -3, 3}, {y, -3, 3}];
(* let's (ab)use the points *)
pnts = P[[1, 1]];
Manipulate[
Show[
P,
ListPlot[pnts[[i ;; i]], PlotStyle -> {PointSize -> Large, Red}]
], {i, 1, Length[pnts], 1}
]
Then the individual frames look like this:
Further, one could continue with a "3D" attempt as
pnts3D = {#[[1]], #[[2]], -#[[1]] + 2*#[[2]]} & /@ pnts;
Animate[
Graphics3D[{Opacity[0.5], Ellipsoid[{0, 0, 0}, {2, 3, 1}],
Opacity[0.75], InfinitePlane[{{1, 0, -1}, {0, 0, 0}, {0, 1, 2}}],
Opacity[1], Red, PointSize[Large], Point[pnts3D[[i ;; i]]]}]
, {i, 1, Length[pnts3D], 1}]
Here, the equation of the plane is used in order to uniquely generate the z
coordinate.
Upvotes: 2