Re: Light and surface colors
- To: mathgroup at smc.vnet.net
- Subject: [mg58734] Re: [mg58688] Light and surface colors
- From: "Jose Luis Gomez" <jose.luis.gomez at itesm.mx>
- Date: Sat, 16 Jul 2005 01:03:42 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
These commands produce a beautiful ellipsoid, with user-defined color in the surface, with 3D "shadows" from the lighting, and WITHOUT having to use parametric representation (it takes more than 30 seconds to evaluate): <<Graphics`; pressure[x_,y_,z_]:=x^2+y^2+Sin[4z]; myColorFunction[x_,y_,z_]=SurfaceColor[Hue[pressure[x,y,z]]]; mySphere=ContourPlot3D[x^2+4y^2+4z^2-1,{x,-1,1},{y,-1,1},{z,-1,1}, PlotPoints->{9,7},DisplayFunction->Identity]; myColoredSphere=Graphics3D[Table[ myPolygon=mySphere[[1,j]]; myPolygonFirstPoint=myPolygon[[1,1]]; myX=myPolygonFirstPoint[[1]]; myY=myPolygonFirstPoint[[2]]; myZ=myPolygonFirstPoint[[3]]; {myColorFunction[myX,myY,myZ],myPolygon},{j,Length[mySphere[[1]]]}]]; Show[Graphics3D[EdgeForm[]],myColoredSphere,Background->GrayLevel[0], DisplayFunction->$DisplayFunction] Bye! Jose Luis http://homepage.cem.itesm.mx/lgomez/