I have question about animation of vector coordinates in given x
y
z
coordinate with time. So far I stuck at making output for each row if df
and assemble them as a .gif
. rgl vector diagrams: show right angles for orthogonal vectors
What I want to do it is closer to this Spherical Coordinate System video. But I dont need to the coordinate system to be rotated. Only vector rotation with time is enough for now.
Here is the example df
for x
, y
, z
vector
time <- seq(1,30,0.1)
x <- runif(291,-0.14,0.1)
y <- runif(291,-0.14,0.1)
z <-sort(runif(291,-0.9,0.9),decreasing=TRUE)
df <- data.frame(x,y,z,time)
library(matlib)
library(rgl)
vec <- rbind(diag(3), c(0.04,0.09,0.85)) # just for example.
rownames(vec) <- c("X", "Y", "Z", "J")
open3d()
vectors3d(vec, col=c(rep("black",3), "red"), lwd=2)
[[3d vector in space][2]][2]
See the example in ?movie3d
. The function there rotates the coordinate system, but it can do anything you want, including redrawing the whole scene.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.