我有一组3D坐标(下面-仅用于3D空间中的单个点):
I have a set of 3D coordinates (below - just for a single point, in 3D space):
x <- c(-521.531433, -521.511658, -521.515259, -521.518127, -521.563416, -521.558044, -521.571228, -521.607178, -521.631165, -521.659973) y <- c(154.499557, 154.479568, 154.438705, 154.398682, 154.580688, 154.365189, 154.3564, 154.559189, 154.341309, 154.344223) z <- c(864.379272, 864.354675, 864.365479, 864.363831, 864.495667, 864.35498, 864.358582, 864.50415, 864.35553, 864.359863) xyz <- data.frame(x,y,z)我需要对此进行时间序列图绘制点具有3D渲染(这样我就可以旋转绘图等)。该图将在时间上可视化该点的轨迹(例如,以实线的形式)。我将'rgl'包与 plot3d 方法,但我无法它可以绘制时间序列(下面,只需绘制时间序列中第一帧的单个点):
I need to make a time-series plot of this point with a 3D rendering (so I can rotate the plot, etc.). The plot will visualize a trajectory of the point above in time (for example in the form of solid line). I used 'rgl' package with plot3d method, but I can't make it to plot time-series (below, just plot a single point from first frame in time-series):
require(rgl) plot3d(xyz[1,1],xyz[1,2],xyz[1,3],axes=F,xlab="",ylab="",zlab="")我发现这篇文章,但实际上并没有处理实时渲染的3D图。我将不胜感激任何建议。谢谢。
I found this post, but it doesn't really deal with a real-time rendered 3D plots. I would appreciate any suggestions. Thank you.
推荐答案解决方案比我想象的简单,问题是我没有使用 as.matrix 在我的数据上。当我只是尝试使用 plot3d $绘制整个数据集时,出现错误(list)对象不能被强制键入'double' c $ c>(为此此处)。因此,如果您需要绘制一组坐标的时间序列(在我的情况下是两个演员的运动捕捉数据),这是我的完整解决方案(仅适用于以下数据集!):
The solution was simpler than I thought and the problem was that I didn't use as.matrix on my data. I was getting error (list) object cannot be coerced to type 'double' when I was simply trying to plot my entire dataset using plot3d (found a solution for this here). So, if you need to plot time-series of set of coordinates (in my case motion capture data of two actors) here is my complete solution (only works with the data set below!):
- 下载示例数据集
-
将上述数据读入表中:
- download example data set
read the above data into a table:
提取XYZ坐标成单独的矩阵:
extract XYZ coordinates into a separate matrixes:
x <- as.matrix(subset(data,select=seq(1,88,3))) y <- as.matrix(subset(data,select=seq(2,89,3))) z <- as.matrix(subset(data,select=seq(3,90,3)))
将坐标绘制在漂亮的3D渲染图上使用'rgl'包:
require(rgl) plot3d(x[1:nrow(x),],y[1:nrow(y),],z[1:nrow(z),],axes=F,xlab="",ylab="",zlab="")
您应该在下面的图片中看到类似的东西(但可以旋转它,等等)-希望您能认识到那里有人们的联合中心。我仍然需要对其进行调整,以使其在视觉上更好-将第一个框架作为一个点(以清楚地看到演员的关节),然后将其可视化,然后将其余的框架作为线条。
You should get something like on the image below (but you can rotate it etc.) - hope you can recognise there are joint centers for people there. I still need to tweak it to make it visually better - to have first frame as a points (to clearly see actor's joints), then a visible break, and then the rest of frames as a lines.
更多推荐
制作时间序列的3D渲染图
发布评论