Adds a sphere set shape node to the scene

spheres3d(x, y = NULL, z = NULL, radius = 1, fastTransparency = TRUE, ...)

## Arguments

x, y, z Numeric vector of point coordinates corresponding to the center of each sphere. Any reasonable way of defining the coordinates is acceptable. See the function xyz.coords for details. Vector or single value defining the sphere radius/radii logical value indicating whether fast sorting should be used for transparency. See the Details. Material properties. See material3d for details.

## Details

If a non-isometric aspect ratio is chosen, these functions will still draw objects that appear to the viewer to be spheres. Use ellipse3d to draw shapes that are spherical in the data scale.

When the scale is not isometric, the radius is measured in an average scale. In this case the bounding box calculation is iterative, since rescaling the plot changes the shape of the spheres in user-coordinates, which changes the bounding box. Versions of rgl prior to 0.92.802 did not do this iterative adjustment.

If any coordinate or radius is NA, the sphere is not plotted.

If a texture is used, its bitmap is wrapped around the sphere, with the top edge at the maximum y coordinate, and the left-right edges joined at the maximum in the z coordinate, centred in x.

If the alpha material value of the spheres is less than the default 1, they need to be drawn in order from back to front. When fastTransparency is TRUE, this is approximated by sorting the centers and drawing complete spheres in that order. This produces acceptable results in most cases, but artifacts may be visible, especially if the radius values vary, or they intersect other transparent objects. Setting fastTransparency = FALSE will cause the sorting to apply to each of the 480 facets of individual spheres. This is much slower, but may produce better output.

## Value

A shape ID of the spheres object is returned.

material3d, aspect3d for setting non-isometric scales
open3d()
{"x":{"material":{"color":"#000000","alpha":1,"lit":true,"ambient":"#000000","specular":"#FFFFFF","emission":"#000000","shininess":50,"smooth":true,"front":"filled","back":"filled","size":3,"lwd":1,"fog":true,"point_antialias":false,"line_antialias":false,"texture":null,"textype":"rgb","texmipmap":false,"texminfilter":"linear","texmagfilter":"linear","texenvmap":false,"depth_mask":true,"depth_test":"less","isTransparent":false,"polygon_offset":[0,0],"margin":"","floating":false},"rootSubscene":1710,"objects":{"1716":{"id":1716,"type":"spheres","material":{},"vertices":[[-0.693844079971313,-0.147256091237068,1.30466306209564],[2.20065402984619,-1.46564483642578,1.13920426368713],[0.586459219455719,0.496190339326859,0.121433027088642],[0.573443412780762,-0.53089052438736,0.0784271210432053],[1.02807593345642,1.2232813835144,-0.215212002396584],[0.869319498538971,-0.0655986070632935,0.895599663257599],[0.692662119865417,-0.75872403383255,0.195535406470299],[-0.412795513868332,0.697146475315094,-1.17654871940613],[0.262525349855423,0.392330527305603,0.14960016310215],[-0.0260234009474516,-0.42363104224205,0.327659457921982]],"colors":[[1,0,0,1],[1,0.600000023841858,0,1],[0.800000011920929,1,0,1],[0.200000002980232,1,0,1],[0,1,0.400000005960464,1],[0,1,1,1],[0,0.400000005960464,1,1],[0.200000002980232,0,1,1],[0.800000011920929,0,1,1],[1,0,0.600000023841858,1]],"radii":[[0.46924901008606],[0.54559588432312],[0.546861171722412],[0.735440254211426],[0.285214722156525],[0.193982303142548],[0.801669359207153],[0.428970068693161],[0.533446609973907],[0.82699728012085]],"centers":[[-0.693844079971313,-0.147256091237068,1.30466306209564],[2.20065402984619,-1.46564483642578,1.13920426368713],[0.586459219455719,0.496190339326859,0.121433027088642],[0.573443412780762,-0.53089052438736,0.0784271210432053],[1.02807593345642,1.2232813835144,-0.215212002396584],[0.869319498538971,-0.0655986070632935,0.895599663257599],[0.692662119865417,-0.75872403383255,0.195535406470299],[-0.412795513868332,0.697146475315094,-1.17654871940613],[0.262525349855423,0.392330527305603,0.14960016310215],[-0.0260234009474516,-0.42363104224205,0.327659457921982]],"ignoreExtent":false,"fastTransparency":true,"flags":32771},"1714":{"id":1714,"type":"light","vertices":[[0,0,1]],"colors":[[1,1,1,1],[1,1,1,1],[1,1,1,1]],"viewpoint":true,"finite":false},"1713":{"id":1713,"type":"background","material":{},"colors":[[0.298039227724075,0.298039227724075,0.298039227724075,1]],"centers":[[0,0,0]],"sphere":false,"fogtype":"none","fogscale":1,"flags":32768},"1715":{"id":1715,"type":"background","material":{"lit":false,"back":"lines"},"colors":[[1,1,1,1]],"centers":[[0,0,0]],"sphere":false,"fogtype":"none","fogscale":1,"flags":32768},"1710":{"id":1710,"type":"subscene","par3d":{"antialias":8,"FOV":30,"ignoreExtent":false,"listeners":1710,"mouseMode":{"none":"none","left":"trackball","right":"zoom","middle":"fov","wheel":"pull"},"observer":[0,0,12.0786399841309],"modelMatrix":[[1,0,0,-0.791578412055969],[0,0.342020153999329,0.939692616462708,0.00685545057058334],[0,-0.939692616462708,0.342020153999329,-12.3436498641968],[0,0,0,1]],"projMatrix":[[3.73205089569092,0,0,0],[0,3.73205089569092,0,0],[0,0,-3.86370325088501,-43.5420951843262],[0,0,-1,0]],"skipRedraw":false,"userMatrix":[[1,0,0,0],[0,0.342020143325668,0.939692620785909,0],[0,-0.939692620785909,0.342020143325668,0],[0,0,0,1]],"userProjection":[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],"scale":[1,1,1],"viewport":{"x":0,"y":0,"width":1,"height":1},"zoom":1,"bbox":[-1.16309309005737,2.74624991416931,-2.0112407207489,1.50849604606628,-1.60551881790161,1.7739120721817],"windowRect":[0,0,256,256],"family":"sans","font":1,"cex":1,"useFreeType":true,"fontname":"NULL","maxClipPlanes":2147483647,"glVersion":2.1,"activeSubscene":0},"embeddings":{"viewport":"replace","projection":"replace","model":"replace","mouse":"replace"},"objects":[1715,1716,1714],"subscenes":[],"flags":33027}},"crosstalk":{"key":[],"group":[],"id":[],"options":[]},"width":480,"height":480,"context":{"shiny":false,"rmarkdown":null},"players":[],"webGLoptions":{"preserveDrawingBuffer":true}},"evals":[],"jsHooks":[]}