With the 'rgl' package:
library(rgl)
vertices <- rbind(
c(0, 0, 0),
c(1, 0, 0),
c(0, 1, 0),
c(0, 0, 1)
)
faces <- combn(4,3)
for(f in 1:4){
triangles3d(rbind(
vertices[faces[1,f],],
vertices[faces[2,f],],
vertices[faces[3,f],]
), color="red", alpha=0.4)
}
You can add the edges and the vertices:
# add edges as thin cylinders
edges <- combn(4, 2)
for(e in 1:6){
shade3d(cylinder3d(rbind(vertices[edges[1,e],],vertices[edges[2,e],]),
radius = 0.02, sides = 30), col="yellow")
}
# add vertices as small spheres
spheres3d(vertices, radius= 0.03, color = "yellow")
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…