pro VertexSphere, nSphere, Vertex, Polygon ;+ ; NAME: ; VertexSphere ; PURPOSE: ; Calulate the vertices for shading a sphere. ; CATEGORY: ; CALLING SEQUENCE: ; INPUTS: ; nSphere scalar determines the resolution of the sphere ; 25 is a reasonable value ; OPTIONAL INPUT PARAMETERS: ; OUTPUTS: ; Vertex, Polygon ; arrays determined by IDL shade_volume procedure ; the vertices are points on the unit sphere, ; relative to the origin of the sphere. ; OPTIONAL OUTPUT PARAMETERS: ; CALLS: ; COMMON BLOCKS: ; SIDE EFFECTS: ; RESTRICTIONS: ; PROCEDURE: ; Set up a 3D volume data array containing the distance ; to the sphere center. Then calculate the vertex and polygon arrays ; The vertices can be scaled later to the appropriate size ; MODIFICATION HISTORY: ; FEB-1998, Paul Hick (UCSD/CASS, pphick@ucsd.edu) ;- on_error, 2 message, /info, 'calculating vertex array' nS = float(nSphere) dS = 2*nS+1 S = fltarr(dS,dS,dS) x = -nS+findgen(dS) x = x*x x = x#replicate(1.,dS) ; x^2 x = x+transpose(x) ; x^2+y^2 for z=-nS,nS do S(*,*,nS+z) = z*z+x ; x^2+y^2+z^2 x = .9*nS shade_volume, S, x*x, Vertex, Polygon Vertex = (Vertex-nS)/x ; Vertex coord of unit sphere ; .. relative to sphere center return & end