Last chance! 50% off unlimited learning
Sale ends in
planes3d
and rgl.planes
add mathematical planes
to a scene. Their intersection with the current
bounding box will be drawn. clipplanes3d
and rgl.clipplanes
add clipping planes to a scene.
planes3d(a, b = NULL, c = NULL, d = 0, ...)
rgl.planes(a, b = NULL, c = NULL, d = 0, ...)
clipplanes3d(a, b = NULL, c = NULL, d = 0)
rgl.clipplanes(a, b = NULL, c = NULL, d = 0)
Coordinates of the normal to the plane. Any reasonable way of defining the
coordinates is acceptable. See the function xyz.coords
for details.
Coordinates of the "offset". See the details.
Material properties. See rgl.material
for details.
A shape ID of the planes or clipplanes object is returned invisibly.
planes3d
and rgl.planes
draw planes using the parametrization
a, b, c, d
; the other
values will be recycled as necessary.
clipplanes3d
and rgl.clipplanes
define clipping planes
using the same equations. Clipping planes suppress the display of
other objects (or parts of them) in the subscene, based on their coordinates.
Points (or parts of lines or surfaces) where the coordinates x, y, z
satisfy
The number of clipping planes
supported by the OpenGL driver is implementation dependent; use
par3d("maxClipPlanes")
to find the limit.
abclines3d
, rgl.abclines
for mathematical lines.
triangles3d
, rgl.triangles
or the corresponding
functions for quadrilaterals may be used to draw sections of planes that
do not adapt to the bounding box.
The example in subscene3d shows how to combine clipping planes to suppress complex shapes.
# NOT RUN {
# Show regression plane with z as dependent variable
open3d()
x <- rnorm(100)
y <- rnorm(100)
z <- 0.2*x - 0.3*y + rnorm(100, sd = 0.3)
fit <- lm(z ~ x + y)
plot3d(x, y, z, type = "s", col = "red", size = 1)
coefs <- coef(fit)
a <- coefs["x"]
b <- coefs["y"]
c <- -1
d <- coefs["(Intercept)"]
planes3d(a, b, c, d, alpha = 0.5)
open3d()
ids <- plot3d(x, y, z, type = "s", col = "red", size = 1, forceClipregion = TRUE)
oldid <- useSubscene3d(ids["clipregion"])
clipplanes3d(a, b, c, d)
useSubscene3d(oldid)
# }
Run the code above in your browser using DataLab