下面code得出了一些点,用线连接起来。我想填 通过选择颜色和α的线包围的区域。我似乎无法看到如何使用RGL做
#打开的情节,并添加坐标轴
open3d()
decorate3d(XLIM = C(0,4),ylim = C(0,4),zlim = C(0,4),
xlab = NULL,ylab = NULL,zlab = NULL,
箱= FALSE,轴= FALSE,
主要=,分= NULL,
顶部= TRUE,纵横= FALSE)
axis3d(边=Z,列=蓝)
axis3d(边=X,列=绿色)
axis3d(边=Y,列=绿色)
#得出一些点,通过连接线
#X Yž
VS =矩阵(C(1,1,1,1,2,1,2,3,1,2,3,2,1,2,2,1,2,2,1,1,2),byrow = TRUE NCOL = 3)
points3d(VS,大小= 4,列=红)
lines3d(rbind(VS,C(1,1,1)))
解决方案
怎么样:
quads3d(VS [C(1:2,5,7)],COL =紫色,阿尔法= 0.5)
quads3d(与并[c(2:5),],列=青色,α-= 0.5)
The following code draws some points and connects them with lines. I want to to fill in the area enclosed by the lines choosing color and alpha. I can't seem to see how to do that using rgl
# Open plot and add axes
open3d()
decorate3d(xlim=c(0,4), ylim=c(0,4), zlim=c(0,4),
xlab = NULL, ylab = NULL, zlab = NULL,
box = FALSE, axes = FALSE,
main = "", sub = NULL,
top = TRUE, aspect = FALSE)
axis3d(edge="z", col="blue")
axis3d(edge="x", col="green")
axis3d(edge="y", col="green")
# Draw some points and connect by lines
# x y z
vs = matrix(c(1,1,1, 1,2,1, 2,3,1, 2,3,2, 1,2,2, 1,2,2, 1,1,2), byrow=TRUE, ncol=3)
points3d(vs, size=4, col="red")
lines3d(rbind(vs, c(1,1,1)))
解决方案
How about:
quads3d(vs[c(1:2,5,7),],col="purple",alpha=0.5)
quads3d(vs[c(2:5),],col="cyan",alpha=0.5)
?