Add a triangle to a data3js object
triangle3js(data3js, vertices, col = "black", highlight, ...)
Arguments
- data3js
The data3js object
- vertices
An nx3 matrix of triangle vertices
- col
Single color for the triangles or vector of vertex colors
- highlight
highlight attributes (see highlight3js())
- ...
Additional attributes to pass to material3js()
Value
Returns an updated data3js object
See also
Other plot components:
arrows3js(),
axis3js(),
box3js(),
grid3js(),
legend3js(),
light3js(),
lines3js(),
mtext3js(),
points3js(),
segments3js(),
shape3js(),
sphere3js(),
surface3js(),
text3js()
Examples
# Draw some random triangles
M <- matrix(
data = rnorm(36),
ncol = 3,
nrow = 12
)
p <- plot3js(
xlim = range(M[,1]),
ylim = range(M[,2]),
zlim = range(M[,3]),
label_axes = FALSE
)
p <- triangle3js(
p,
vertices = M,
col = rainbow(nrow(M))
)
r3js(p, zoom = 2)