Reference Guide > S Routines > SPHERE Function
  

SPHERE Function
Defines a spherical object that can be used by the RENDER function.
Usage
result = SPHERE( )
Parameters
None.
Returned Value
resultA structure that defines an ellipsoidal object.
Keywords
ColorA 256-element double-precision floating-point vector containing the color (intensity) coefficients of the object. (Default: Color(*)=1.0) .
DecalA 2D array of bytes whose elements correspond to indices into the arrays of material properties. .
KambA 256-element double-precision floating-point vector containing the ambient (flat shaded) coefficients. (Default: Kamb(*)=0.0) .
KdiffA 256-element double-precision floating-point vector containing the diffuse reflectance coefficients. (Default: Kdiff(*)=1.0) .
KtranA 256-element double-precision floating-point vector containing the specular transmission coefficients. (Default: Ktran(*)=0.0) .
TransformA 4-by-4 double-precision floating-point array containing the local transformation matrix whose default is the identity matrix. .
Discussion
A SPHERE is used by the RENDER function to render ellipsoid objects, such as for spherical inverse mapping or molecular modeling (atoms). It is centered at the origin, with a radius of 0.5.
You can alter its diameter and orientation with the Transform keyword.
Example
ds = 6
; Create a 6-by-6 checkerboard image.
checks = BYTARR(ds, ds)
checks(*) = 255
FOR x=0L, ds - 1 DO $
   FOR y=0L, ds - 1 DO $
      IF ((x mod 2) EQ (y mod 2)) THEN $
         checks(x, y) = 128
; Set checks to be full and one-half intensity.
two = FLTARR(256)
two(128) = 0.5 & two(255) = 1.0
s = SPHERE(Decal=checks, Color=two)
TV, RENDER(s)
See Also
CONE, CYLINDER, MESH, RENDER, VOLUME
For more information, see the PV‑WAVE User’s Guide.

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.