Reputation: 96
I would like to use rgl
to draw part of a cone, as on this web page (click "3d cone model")
I would like to specify three parameters (bottom radius, top radius, height) then draw a cone in rgl
-- is this possible/easy? how? I don't see any mention of drawing cones in the rgl
docs.
Upvotes: 3
Views: 269
Reputation: 44897
The cylinder3d
function can do that. You specify two points (the center of the top and bottom), and the two radii. For example,
pts <- cbind(c(0, 0), c(0, 1), c(0, 0)) # the centers
radii <- c(0.2, 0.4)
cone <- cylinder3d(pts, radii, sides = 64)
shade3d(cone, col = "lightblue")
Upvotes: 8