How to draw a shaded shpere?
- To: mathgroup at smc.vnet.net
- Subject: [mg8060] How to draw a shaded shpere?
- From: juana at spcm2.ictp.trieste.it (MORENO JUANA)
- Date: Mon, 4 Aug 1997 01:47:43 -0400
- Organization: ICTP-Trieste-Italy
- Sender: owner-wri-mathgroup at wolfram.com
I want to draw a sphere shaded according to a particular function.
I need a lot of points to appreciate the behavior of that function.
I tried in two ways:
-Using Plot3D and the options Mesh->False and PlotPoints->100.
The quality is good but I can draw only half a sphere and the borders
look bad.
- Using ParametricPlot3D. In this case I can plot the whole sphere,
but in order to get good quality I should increase the number of points.
When I do that the result is that nothing can be seen,
because the "mesh" cover the sphere and hide the features of the function
I want to visualize.
Do you have a good trick to get a whole sphere with a nice shading
and not disturbing "mesh"?
I am including the two macros I have used in order you can better
understand the problem.
Thanks a lot,
Juana Moreno
Using Plot3D:
kz2=1-kx*kx-ky*ky
kz=Sqrt[kz2]
shade=15*(1-kz2)*(1 + 15*kz2)/64
sp= Plot3D[{kz,GrayLevel[shade]},{kx,-one,one},{ky,-one,one},PlotPoints->100,
Mesh-> False,BoxRatios->{1,1,0.5}, Axes->False,Boxed->False,
ViewPoint->{1,-1,2}]
Using ParametricPlot3D:
kx=Sin[theta] Cos[phi]
ky=Sin[theta] Sin[phi]
kz=Cos[theta]
shade=15*(1-kz*kz)*(1+15*kz*kz)/64
sphere=ParametricPlot3D[{kx,ky,kz,GrayLevel[shade]},{theta,0,Pi},
{phi,0 , 2 Pi},PlotPoints->{50,50},Axes->False,Boxed->False,Lighting->False]