8

我在Mathematica 7.0.1Mesh生成的 3D 表面上渲染线条时遇到问题:ContourPlot3D

p=ContourPlot3D[x^4+y^4+z^4-(x^2+y^2+z^2)^2+3(x^2+y^2+z^2)==3,
      {x, -2,2}, {y, -2, 2}, {z,-2,2},
     BoundaryStyle->Directive[Black,Thickness[.003]],
     ContourStyle->Directive[Orange,Opacity[0.5],Specularity[White,300]],
     PlotPoints->90,Ticks->None,
     MeshStyle->Directive[GrayLevel[.7],Thickness[.001]],
     Lighting->{{"Directional",RGBColor[1,1,1],
                           {ImageScaled@{1,0,1},ImageScaled@{0,0,0}}}}];
p=Graphics[Inset[p,{0,0},Center,{1,1}],
                        PlotRange->{{-.5,.5},{-.5,.5}},Frame->True]

截图1

仔细观察它们:

Show[p, PlotRange -> {{-.16, -.05}, {0, .1}}]

截图2

您会看到灰Mesh线在许多地方与表面形成的三角形重叠,甚至看起来像是虚线。有没有办法避免这种情况?

4

2 回答 2

5

John Fultz has answered my question in the official newsgroup. The solution for Mathematica 7 users (and probably for version 8 users who have a graphics card without support for DepthPeeling rendering method) is to use an undocumented form of MeshStyle option:

MeshStyle -> {{GrayLevel[.7], Tube[0.01]}}

For having Mesh lines appear as flat objects one can use Glow:

MeshStyle -> {{Glow[GrayLevel[.7]], Black, Tube[0.005]}}

Now mesh is rendered nicely:

p1 = ContourPlot3D[
   x^4 + y^4 + z^4 - (x^2 + y^2 + z^2)^2 + 3 (x^2 + y^2 + z^2) == 
    3, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, 
   BoundaryStyle -> Directive[Black, Thickness[.003]], 
   ContourStyle -> 
    Directive[Orange, Opacity[0.5], Specularity[White, 300]], 
   Ticks -> None, PlotPoints -> 40, 
   MeshStyle -> {{Glow[GrayLevel[.7]], Black, Tube[0.005]}}, 
   Lighting -> {{"Directional", 
      RGBColor[1, 1, 1], {ImageScaled@{1, 0, 1}, 
       ImageScaled@{0, 0, 0}}}}];
p = Graphics[Inset[p1, {0, 0}, Center, {1, 1}], 
  PlotRange -> {{-.5, .5}, {-.5, .5}}, Frame -> True, 
  GridLines -> Automatic]

screenshot

Show[p, PlotRange -> {{-.16, -.05}, {0, .1}}]

screenshot

于 2011-08-30T08:32:22.060 回答
4

对于它的价值,我在 Mac OS 10.7.1 上的 M8.0.1 中没有看到这个问题:

在此处输入图像描述

于 2011-08-28T13:20:49.483 回答