VRML_SPHERE Procedure

Creates a sphere in a VRML world.

Usage

VRML_SPHERE

Input Parameters

None.

Keywords

Use these keywords to set the object properties and material properties.

Object Properties

The following keywords describe or define the VRML sphere object.

Center—A 3-element array specifying the center of the sphere object. (Default: [0, 0, 0])

Radius—Specifies the sphere radius from the center. (Default: 1.0)

Transform—A 4-by-4 matrix containing the transformation to be applied to the object.

Material Properties

The following properties, when set, are applied to the object.

AmbientColor—A 3-element array of RGB color with each element ranging between 0 and 255. Scalar values are interpreted as grayscale.

DiffuseColor—A 3-element array of RGB color with each element ranging between 0 and 255. Scalar values are interpreted as grayscale.

EmissiveColor—A 3-element array of RGB color with each element ranging between 0 and 255. Scalar values are interpreted as grayscale.

Shininess—A scalar shininess factor, in the range of 0 to 255.

SpecularColor—A 3-element array of RGB color with each element ranging between 0 and 255. Scalar values are interpreted as grayscale.

Texture_Image—A texture image to apply to the object. The texture image is wrapped completely around object (CLAMPed). Image values and transparencies lie in range of 0 to 255. There are four options:

(w, h) or (1, w, h)—Grayscale image

(2, w, h)—Grayscale in (0, *, *) plus transparency in (1, *, *)

(3, w, h)—True color image (red, green, blue)

(4, w, h)—True color plus transparency in (3, *, *)

Transparency—A scalar transparency factor, in the range of 0 to 255.

Discussion

The VRML_SPHERE procedure supports the sphere node in VRML.

Example

The 'wavelogo.dat' file used in this example is found in the following directory:

<wavedir>/demo/web/vrml
<wavedir>\demo\web\vrml

where <wavedir> is the main PV‑WAVE directory.

VRML_OPEN, 'vrml_sphere.wrl'
RESTORE, 'wavelogo.dat' ; img, r, g, b
sz = SIZE(img)
col = TRANSPOSE([[r], [g], [b]])
; Create the texture, using the PV-WAVE logo.
texture = REFORM(col(*, img), 3, sz(1), sz(2))
; Create a base sphere and textured sphere.
VRML_SPHERE
VRML_SPHERE, Center = [-2, -1, 0], Radius =.5, Texture = texture
; Create a somewhat transparent, reflective sphere.
VRML_SPHERE, Center = [2, 0, 2], Radius = 1.5, $
   Shininess = 202, Transparency = 170
VRML_CLOSE

See Also

POLY_SPHERE, SPHERE, VRML_CUBE, VRML_CYLINDER, VRML_OPEN, VRML_TEXT

For a discussion of spheres and other VRML primitives, see The VRML Sourcebook, by Andrea L. Ames, et al., John Wiley & Sons, Inc., 1996.