Стилизация 3D-сюжетов в Mathematica 5 - PullRequest
3 голосов
/ 28 апреля 2011

Мне нравится тихая и спокойная цветовая гамма и освещение 3D-сюжетов в Mathematica 5.

Можно ли стилизовать 3D-графики в Mathematica 7 точно так же, как это было в Mathematica 5?

Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, ImageSize -> 360]
<< Version5`Graphics`
Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, ImageSize -> 360]

Screenshot of the Output


Этот код позволяет легко сравнить внешний вид графики версии 5 и версии 7:

v5style = {{"Ambient", RGBColor[{0.356, 0.294, 0.4}]}, {"Directional",
     RGBColor[{0.56, 0., 0.}], 
    ImageScaled[{2, 0, 2}]}, {"Directional", RGBColor[{0., 0.56, 0.}],
     ImageScaled[{2, 2, 2}]}, {"Directional", 
    RGBColor[{0., 0., 0.56}], ImageScaled[{0, 2, 2}]}};

PostScriptGraphics /: MakeBoxes[PostScriptGraphics[str_String], _] := 
 Cell[GraphicsData["PostScript", str], CellAutoOverwrite -> True, 
  CellBaseline -> Center]
v5vsv7[\[Theta]_] := {Developer`LegacyGraphics[];
   v5Graphics = 
    Graphics`Legacy`Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, 
     ImageSize -> 360, 
     ViewPoint -> RotationTransform[\[Theta], {0, 0, 1}][{3, 0, 3}]];
   v5PostScript = ExportString[v5Graphics, "APS"];
   Developer`SymbolicGraphics[];
   PostScriptGraphics[v5PostScript],
   Graphics3D[First@Graphics3D@v5Graphics, 
     FilterRules[Last@Graphics3D@v5Graphics, Options[Graphics3D]], 
     ViewPoint -> RotationTransform[\[Theta], {0, 0, 1}][{3, 0, 3}], 
     PlotRangePadding -> None, 
     ImageSize -> 360] /. (Lighting -> _) -> (Lighting -> v5style)};

Grid@Table[v5vsv7[\[Theta]], {\[Theta], 0, 2 Pi, Pi}]

Ответы [ 2 ]

4 голосов
/ 28 апреля 2011

г. Я уже ответил на ваш вопрос хорошо, я думаю. Вот игрушка, чтобы поиграть с некоторыми возможностями, включая другие палитры. Он начинается со значений, которые использовал г-н В.

Manipulate[
  Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, PlotLabel -> cf, 
  ImageSize -> 360, ColorFunction -> cf, Mesh -> mesh,
  Lighting -> {{"Ambient", cs},
    {"Directional", RGBColor[{s, 0., 0.}], 
     ImageScaled[{2, 0, 2}]}, {"Directional", RGBColor[{0., s, 0.}], 
     ImageScaled[{2, 2, 2}]}, {"Directional", RGBColor[{0., 0., s}], 
     ImageScaled[{0, 2, 2}]}}],
{{cf, None, "color function"}, Prepend[ColorData["Gradients"], None]},
{{cs, RGBColor[{0.356, 0.294, 0.4}]}, ColorSlider},
{{s, .5, "brightness"}, 0, 1, Appearance -> "Labeled"},
{{mesh, 15}, 0, 30, 1, Appearance -> "Labeled"}]

manipulatte

1 голос
/ 28 апреля 2011

Это достаточно близко или все еще далеко от ваших требований?

new = {{"Ambient", RGBColor[{0.356, 0.294, 0.4}]}, {"Directional", 
  RGBColor[{0.56, 0., 0.}], ImageScaled[{2, 0, 2}]}, {"Directional", 
  RGBColor[{0., 0.56, 0.}], ImageScaled[{2, 2, 2}]}, {"Directional", 
  RGBColor[{0., 0., 0.56}], ImageScaled[{0, 2, 2}]}};

Plot3D[Sin[x y], {x, 0, Pi}, {y, 0, Pi}, Lighting -> new, Mesh -> 20]

enter image description here

...