I would like to plot my model output in R
It is a triangular mesh in the format
x1 y1 z1 x2 y2 z2 x3 y3 z3 value
Where each row represents a triangle, and I would like to plot these triangles with value
as the scale.
mymesh <- structure(c(0.91, 0.45, 13.93, 14.26, 14.15, 14.36, 14.36, 14.61,
14.58, 14.87, 14.8, 15.13, 15.02, 15.39, 15.24, 15.65, 15.46,
15.9, 15.69, 16.16, 0, 0.79, 12.45, 12.64, 12.34, 12.46, 12.24,
12.38, 12.13, 12.3, 12.03, 12.22, 11.92, 12.13, 11.81, 12.04,
11.69, 11.94, 11.57, 11.84, 0, 0, 208.71, 208.69, 210.7, 210.68,
212.68, 212.66, 214.67, 214.65, 216.66, 216.63, 218.64, 218.61,
220.62, 220.59, 222.61, 222.57, 224.59, 224.56, 0.45, 1.5, 14.15,
14.15, 14.36, 14.36, 14.58, 14.58, 14.8, 14.8, 15.02, 15.02,
15.24, 15.24, 15.46, 15.46, 15.69, 15.69, 15.92, 15.92, 0.79,
0, 12.34, 12.34, 12.24, 12.24, 12.13, 12.13, 12.03, 12.03, 11.92,
11.92, 11.81, 11.81, 11.69, 11.69, 11.57, 11.57, 11.45, 11.45,
0, 131.83, 210.7, 210.7, 212.68, 212.68, 214.67, 214.67, 216.66,
216.66, 218.64, 218.64, 220.62, 220.62, 222.61, 222.61, 224.59,
224.59, 226.58, 226.58, 1.5, 0.75, 14.26, 14.36, 14.36, 14.61,
14.61, 14.87, 14.87, 15.13, 15.13, 15.39, 15.39, 15.65, 15.65,
15.9, 15.9, 16.16, 16.16, 16.42, 0, 1.3, 12.64, 12.46, 12.46,
12.38, 12.38, 12.3, 12.3, 12.22, 12.22, 12.13, 12.13, 12.04,
12.04, 11.94, 11.94, 11.84, 11.84, 11.74, 131.83, 131.83, 208.69,
210.68, 210.68, 212.66, 212.66, 214.65, 214.65, 216.63, 216.63,
218.61, 218.61, 220.59, 220.59, 222.57, 222.57, 224.56, 224.56,
226.54, 375.12, 399.8, 297.84, 497.63, 368.17, 1113.19, 979,
781.41, 1202.21, 1113.94, 1293.77, 1391.94, 1364.52, 1151.37,
1690.98, 913.63, 0, 0, 0, 0), .Dim = c(20L, 10L), .Dimnames = list(
NULL, c("x1", "y1", "z1", "x2", "y2", "z2", "x3", "y3", "z3",
"value")))
I have looked at the rgl
, plot3D
, and misc3d
packages. However, these seem to be dealing with points rather than triangles (for example, the rgl.points
, rgl.linestrips
, and rgl.triangles
functions all take x,y,z
as inputs, rather than a triangle).
How can I use R to plot and color the triangles in this dataset?