Home > matutils > mosaic > sphere.m

sphere

PURPOSE ^

Draw a sphere

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 Draw a sphere

 (EML)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % Draw a sphere
0002 %
0003 % (EML)
0004 
0005 p       = 100; % precision
0006 t       = 0:1/(p-1):1; 
0007 [th,ph] = meshgrid( t*pi,t*2*pi ); 
0008 x       = cos(th); 
0009 y       = sin(th).*cos(ph); 
0010 z       = sin(th).*sin(ph); 
0011 
0012 %surf(x,y,z, z.*0);
0013 surf(x,y,z,'FaceColor','green','EdgeColor','none');
0014 
0015 % some pretty rendering options
0016 
0017 % Default view is AZ = -37.5, EL = 30.  This puts my RA=0 line in the
0018 % back, so I flip it by 180 degrees
0019 
0020 view([142.5, 30]);
0021 %shading interp;
0022 lighting gouraud; 
0023 camlight infinite; 
0024 axis square; 
0025 axis off;

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005