2
$\begingroup$

Now,ordinary animate is the obeject moing in fix the coordinate(remote perspective).

But,can we use first person perspective,fix the moving object at the center and just moving(change) the coordinate?

For example,a basketball rotation towards to the basket,can we make this animate just focus on the basketball in the gif center,and change the coordinate?

I think this is a funny question,anyone can give some advice to dynamic change coordinate?


Code example(from Plotting a moving ball for projectile motion with animate)

Clear["Global`"];
dt = .01;
velInit = {0, 1.2};
posInit = {1.0, 0};
f[pos_] := -pos/(pos.pos)^(3/2);
vel[{velP_, posP_}] := velP + f[posP] dt
pos[{velP_, posP_}] := posP + vel[{velP, posP}] dt

orbit = NestList[{vel@#, pos@#} &, {velInit, posInit}, 1500][[All, 2]];

Animate[ListPlot[orbit, Joined -> True, 
                Epilog -> {[email protected], Purple, Point[orbit[[j]]]}], 
{j, 1, 1500, 1}]

As we can see,the ball is moving in the fix coordinate.Why not try to fix the ball in the center and then just change the coordinate. i knew in matlab can use 'Set' handle function to dynamic control the coordinates.Well maybe this example isn't benifit to use first-person perspective animate.Just for the question! Aha.


ViewPoint/ViewVector and related options maybe works,i'am doing.Thank you,@Kuba. enter image description here

$\endgroup$
5
  • $\begingroup$ Ps.In matlab,you can use 'set' function to dynamic change the coordinate,and export the animate. $\endgroup$
    – lumw
    Aug 21, 2018 at 3:51
  • $\begingroup$ you will find Vitaliy Kaurov - Mastering Dynamic Visualizations with Mathematica very useful. $\endgroup$
    – kglr
    Aug 21, 2018 at 5:24
  • $\begingroup$ Take a look at ViewPoint/ViewVector and related options, come up with simple example and let us know where are you stuck. $\endgroup$
    – Kuba
    Aug 21, 2018 at 5:27
  • $\begingroup$ This one can help too: 3538 $\endgroup$
    – Kuba
    Aug 21, 2018 at 5:28
  • 1
    $\begingroup$ I assumed you have 3D case in mind, try with PlotRange for 2D. $\endgroup$
    – Kuba
    Aug 21, 2018 at 5:59

1 Answer 1

6
$\begingroup$
Module[{
  dt = .01,
  velInit = {0, 1.2},
  posInit = {1.0, 0},
  f, vel, pos, orbit
  },
 f[pos_] := -pos/(pos.pos)^(3/2);
 vel[{velP_, posP_}] := velP + f[posP] dt;
 pos[{velP_, posP_}] := posP + vel[{velP, posP}] dt;
 orbit = NestList[{vel@#, pos@#} &, {velInit, posInit}, 1500][[All, 
    2]];
 Animate[
  ListPlot[
   orbit
   , Joined -> True
   , AspectRatio -> 2/3
   , PlotRange -> {{-3, 3}, {-2, 2}} + orbit[[j]]
   , Epilog -> {[email protected], Purple, Point[orbit[[j]]]}
   , PlotTheme -> "Scientific"

   ]
  , {j, 1, 1500, 1}
  ]
 ]

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.