rgl.ball {rglplus}R Documentation

Plot high-resolution sphere or globe

Description

Draws a sphere in custom resolution with custom surface image.

Usage

rgl.ball(
  x = 0,
  y = 0,
  z = 0,
  radius = 1,
  depth = 5,
  png = NULL,
  rotation = NULL,
  normals = "standard",
  ...
)

Arguments

x

x-coordinate of the center of the sphere

y

y-coordinate of the center of the sphere

z

z-coordinate of the center of the sphere

radius

radius of the sphere

depth

integer (1...8) specifying the number of rectangles (=6*4^depth)

png

optional character string specifying the file name of a png-image to be rendered on the sphere. This file must contain the map to be displayed in an equirectangular projection (also known as equidistant cylindrical projection).

rotation

optional 3-by-3 or or 4-by-4 rotation matrix applied to the whole globe; only used of png is specified.

normals

character string specifying the way the normal vectors of the surface are internally passed to surface3d. This argument is available because surface3d (or rather the underlying routine rgl.surface) sometimes handles the sign of normal vectors incorrectly, causing light sources to appear in the wrong direction if a rotation matrix is provided. The argument can take three values: "none" does not pass any normal vectors to rgl.surface, hence avoiding any issues with the direction of light sources, but this can cause glitches at the 180-degree meridian (choose a high depth around 7 in this case); "standard" passes correct normal vectors to rgl.surface, which can cause wrong lighting for certain rotation matrices; "improved" is similar to "standard", but corrects the lighting errors in most cases.

...

additional parameter to refine the material properties (see rgl.material).

Value

None

Author(s)

Danail Obreschkow (thanks to input from Aaron Robotham's sphereplot package)

Examples

# Show Earth with core
rgl::open3d()
rgl.ball(0, 0, 0, 1, png=system.file('earth.png', package='rglplus'), emission='grey', alpha=0.6)
rgl.ball(0, 0, 0, 0.6, col='red')


[Package rglplus version 1.3 Index]