Subdivide a 3D Object
Subdivides a shape3d
object or a list of shape3d
objects
into objects of the same shape along a given dimension
according to the proportions or frequencies specified in vector(s).
split3d
is the basic workhorse used in mosaic3d
,
but may be useful in other contexts.
range3d
and center3d
are utility functions, also useful in other contexts.
split3d(obj, ...) ## S3 method for class 'shape3d' split3d(obj, p, dim, space = 0.1, ...) ## S3 method for class 'list' split3d(obj, p, dim, space = 0.1, ...) range3d(obj) center3d(obj)
obj |
A |
... |
Other arguments for split3d methods |
p |
For a single |
dim |
The dimension along which the object is to be subdivided. Either an integer: 1, 2, or 3, or a character: "x", "y", or "z". |
space |
The total space used to separate the copies of the object along
dimension |
The resulting list of shape3d
objects is actually composed of copies
of the input object(s), scaled according to the proportions in p
and then translated to make their range along the splitting dimension
equal to that of the input object(s).
split3d
returns a list of shape3d
objects.
range3d
returns a 2 x 3 matrix, whose first row contains
the minima on dimensions x, y, z, and whose second row contains
the maxima.
center3d
returns a numeric vector containing
the means of the minima and maxima on dimensions x, y, z.
Duncan Murdoch, with refinements by Michael Friendly
shapelist3d
for the plotting of lists of shape3d
objects.
if (require(rgl)) { open3d() cube <- cube3d(alpha=0.4) sl1 <- split3d(cube, c(.2, .3, .5), 1) col <- c("#FF000080", "#E5E5E580", "#0000FF80") shapelist3d(sl1, col=col) open3d() p <- matrix(c(.6, .4, .5, .5, .2, .8), nrow=2) sl2 <- split3d(sl1, p, 2) shapelist3d(sl2, col=col) }
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.