# ---- Simple usage
# vertices only
dodecahedron_vert <- matrix(
ncol = 3, byrow = TRUE,
c(-0.62, -0.62, -0.62, 0.62, -0.62, -0.62, -0.62, 0.62, -0.62,
0.62, 0.62, -0.62, -0.62, -0.62, 0.62, 0.62, -0.62, 0.62,
-0.62, 0.62, 0.62, 0.62, 0.62, 0.62, 0.00, -0.38, 1.00,
0.00, 0.38, 1.00, 0.00, -0.38, -1.00, 0.00, 0.38, -1.00,
-0.38, 1.00, 0.00, 0.38, 1.00, 0.00, -0.38, -1.00, 0.00,
0.38, -1.00, 0.00, 1.00, 0.00, -0.38, 1.00, 0.00, 0.38,
-1.00, 0.00, -0.38, -1.00, 0.00, 0.38)
)
point_cloud <- as_ieegio_surface(dodecahedron_vert)
plot(point_cloud, col = "red")
# with face index
dodecahedron_face <- matrix(
ncol = 3L, byrow = TRUE,
c(1, 11, 2, 1, 2, 16, 1, 16, 15, 1, 15, 5, 1, 5, 20, 1, 20, 19,
1, 19, 3, 1, 3, 12, 1, 12, 11, 2, 11, 12, 2, 12, 4, 2, 4, 17,
2, 17, 18, 2, 18, 6, 2, 6, 16, 3, 13, 14, 3, 14, 4, 3, 4, 12,
3, 19, 20, 3, 20, 7, 3, 7, 13, 4, 14, 8, 4, 8, 18, 4, 18, 17,
5, 9, 10, 5, 10, 7, 5, 7, 20, 5, 15, 16, 5, 16, 6, 5, 6, 9,
6, 18, 8, 6, 8, 10, 6, 10, 9, 7, 10, 8, 7, 8, 14, 7, 14, 13)
)
mesh <- as_ieegio_surface(dodecahedron_vert,
faces = dodecahedron_face)
plot(mesh)
# with vertex colors
mesh <- as_ieegio_surface(dodecahedron_vert,
faces = dodecahedron_face,
vertex_colors = sample(20))
plot(mesh, name = "color")
# with annotations
mesh <- as_ieegio_surface(
dodecahedron_vert,
faces = dodecahedron_face,
annotation_labels = data.frame(
Key = 1:3,
Label = c("A", "B", "C"),
Color = c("red", "green", "blue")
),
annotation_values = data.frame(
MyVariable = c(rep(1, 7), rep(2, 7), rep(3, 6))
)
)
plot(mesh, name = "annotations")
# with measurements
mesh <- as_ieegio_surface(
dodecahedron_vert,
faces = dodecahedron_face,
measurements = data.frame(
MyVariable = dodecahedron_vert[, 1]
)
)
plot(mesh, name = "measurements",
col = c("blue", "gray", "red"))
Run the code above in your browser using DataLab