Manuel,
Needs["Graphics`Colors`"]
Needs["Graphics`Animation`"]
tri = Line[{{-4, 4}, {-3, 2}, {-2, -4}, {-4, 4}}];
This translation rule will translate a point, pt, from pt to pt + vec as t
goes from 0 to 1.
transrule[vec : {_, _}][t_] := pt : {x_?NumericQ, y_?NumericQ} :> pt + t vec
This produces one frame of an animation. It is important that all frames
have the same plot range, which generally means you have to specify it
explicitly.
frame[t_] :=
Show[
Graphics[
{LightCoral, tri,
LightSkyBlue, tri /. transrule[{6, 6}][1],
Black, tri /. transrule[{6, 6}][t]}],
AspectRatio -> Automatic,
PlotRange -> {{-5, 6}, {-5, 11}},
Frame -> True,
PlotLabel -> "Pure Translation",
Background -> Linen,
ImageSize -> 500]
Finally, this produces and activates the animation.
Animate[frame[t], {t, 0, 1, 1/31}]
SelectionMove[EvaluationNotebook[], All, GeneratedCell]
FrontEndTokenExecute["OpenCloseGroup"]
FrontEndTokenExecute["SelectionAnimate"]
It is even more fun to do the general isometry. First rotate, pause for 5
frames, and then translate.
Often, a good way to view animation is to use the up and down cursor keys to
stop it and advance one frame at a time.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
> From: manuel avalos [mailto:manuel at voicenet.com]
To: mathgroup at smc.vnet.net
>
> Hello
>
> Perhaps if I state my problem you might suggest a method using
> mathematica how it could be accomplished.
> How can I translate a graph, say a triangle, in an R2 coordinate system
> to another given position on the x y plane showing all the various
> stages from the one position to the other?
> The triangle was formed by connecting the points (-4,4),(-3,-2) and
> (-2,-4) by straight lines...and another triangle was formed by
> translating that triangle by (6,6). Suppose you want to move the first
> triangle smoothly to the position of the second triangle using, let's
> say, a total of 31 frames numbered- 0, 1, 2,...30. How would one go
> about generating each frame?
> Thanks for whatever
> Manuel
>