shape3js {r3js} | R Documentation |
Add a generic shape to an 3js plot
Description
Add a generic shape to an 3js plot
Usage
shape3js(
data3js,
vertices,
faces,
normals = NULL,
col = "black",
highlight,
...
)
Arguments
data3js |
The data3js object |
vertices |
An nx3 matrix of 3d vertex coordinates |
faces |
An nx3 matrix of indices relating to vertices that make up each triangular face |
normals |
Optional nx3 matrix of normals to each vertex |
col |
Shape color |
highlight |
highlight attributes (see |
... |
Additional attributes to pass to |
Value
Returns an updated data3js object
See Also
Other plot components:
arrows3js()
,
axis3js()
,
box3js()
,
grid3js()
,
legend3js()
,
light3js()
,
lines3js()
,
mtext3js()
,
points3js()
,
segments3js()
,
sphere3js()
,
surface3js()
,
text3js()
,
triangle3js()
Examples
# Draw a teapot
data(teapot)
p <- plot3js(
xlim = range(teapot$vertices[,1]),
ylim = range(teapot$vertices[,2]),
zlim = range(teapot$vertices[,3]),
label_axes = FALSE,
aspect = c(1, 1, 1)
)
p <- shape3js(
p,
vertices = teapot$vertices,
faces = teapot$edges,
col = "lightblue"
)
r3js(p, rotation = c(-2.8, 0, 3.14), zoom = 1.2)
[Package r3js version 0.0.2 Index]