Writing:
vp = Options[ParametricPlot3D[{t, t, t}, {t, -5, 5}], ViewPoint][[1, 2]];
ParametricPlot3D[{t, t, t}, {t, -5, 5}, ViewPoint -> Dynamic[vp]]
Dynamic[vp]
I get:
and by rotating the mouse the box changes the vector components in real time.
Unfortunately I can not figure out how to store those vectors in a matrix at each rotation made with the mouse.
Thank you.
Answer
You can use the second argument of Dynamic
to specify a function that is executed every time the value is changed:
hist = {};
vp = Options[ParametricPlot3D[{t, t, t}, {t, -5, 5}], ViewPoint][[1, 2]];
ParametricPlot3D[{t, t, t}, {t, -5, 5},
ViewPoint ->Dynamic[vp, {Automatic, AppendTo[hist, #] &}]]
Dynamic[vp]
Dynamic[hist]
Now you can e.g. make an animation showing the states of the viewpoint:
Animate[ParametricPlot3D[{t, t, t}, {t, -5, 5}, ViewPoint -> hist[[v]]], {v, 1, Length@hist, 1}]
Note that it seems to evaluate the function twice each time you rotate the plot, each time with a slightly different value. (But that should be more or less eay to filter out.)
Comments
Post a Comment