I am seeking to visualize the tetrahedron with vertices at
(0,0,0)
(2,sqrt(2),0)
(2,0,2)
(2,-sqrt(2),0)
Is there a built in (or packaged) way in R to visualize this without having to draw the edges/faces manually?
I am seeking to visualize the tetrahedron with vertices at
(0,0,0)
(2,sqrt(2),0)
(2,0,2)
(2,-sqrt(2),0)
Is there a built in (or packaged) way in R to visualize this without having to draw the edges/faces manually?
You could use qmesh3d:
library(rgl)
vertices <- cbind(
c(0,0,0),
c(2,sqrt(2),0),
c(2,0,2),
c(2,-sqrt(2),0)
)
# Define the faces : in case of tetrahedron, all combinations of 3 vertices
indices <- combn(1:4,m = 3)
tetrahedron <- qmesh3d(
vertices = vertices,
indices = indices,
homogeneous = FALSE
)
shade3d(tetrahedron, color = "grey", alpha = 0.1)
wire3d(tetrahedron, color = "blue")