A way to fix coloring
- To: mathgroup at smc.vnet.net
- Subject: [mg3201] A way to fix coloring
- From: Matthias Reinsch <reinsch at tops.lbl.gov>
- Date: Sat, 17 Feb 1996 14:15:19 -0500
- Organization: Lawrence Berkeley Laboratory, Berkeley CA
- Sender: owner-wri-mathgroup at wolfram.com
are colored incorrectly (see ProblemPlot below). Enclosed in this message is FastFixColoring, a solution to this problem. I have already notified WRI about this, and they suggested I provide this information to other sites so that users who need correctly colored plots can generate them. ====================================================================== An example of a plot in which the coloring has errors: ====================================================================== f = N @ ComplexExpand @ Expand[SphericalHarmonicY[6, 3, th, ph] - SphericalHarmonicY[6,-3, th, ph] ] ProblemPlot = ParametricPlot3D[ (1+.2 f Sin[6/11 Pi]) * {Sin[th] Cos[ph],Sin[th] Sin[ph],Cos[th]}, {th,0,Pi},{ph,0,2 Pi}] ====================================================================== The corrected plot: ====================================================================== FastFixColoring[gr3D_] := (viewpt = ViewPoint /. gr3D[[2]]; Graphics3D[ Flatten @ Map[ (p4 = #[[1]]; p42=Drop[p4,{2}]; p44=Drop[p4,{4}]; m={viewpt,p4[[1]],p4[[1]]}; If[ Det[m-p44] Det[m-p42] < 0, {Polygon @ p44, Polygon @ p42}, {#}])&, gr3D[[1]] ], gr3D[[2]] ] ) Show @ FastFixColoring @ ProblemPlot ==== [MESSAGE SEPARATOR] ====