4

I would like to create a stereogram from a 3d plot; I would like to export two images of a 3d plot at a slightly different angle, so that when each picture is presented to a different eye, one gets the feeling it is actually 3 dimensional.

I have tried to put two plots next to eachother, then turn one plot slightly by hand (mouse), but when I then export, it is as if I hadn't turned the plot at all!

example:

s1 = 
  Plot3D[PDF[MultinormalDistribution[{0, 0}, {{1, 1/2}, {1/2, 1}}], {x, y}],
    {x, -2.3, 2.3}, {y, -2.3, 2.3}]
Show[GraphicsArray[{s1, s1}]]

How can I specify at which angle the 3d plot is exported?

PS: Just to be clear: I don't want to rotate the function which is plotted, I want to rotate the plot, including the edges of the bounding box of the plot.

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Angelorf
  • 141
  • 1
  • 3

1 Answers1

7

Here is a small tool make it easier thanks to that answer:

With[{dplot = 
     Plot3D[PDF[MultinormalDistribution[{0, 0}, {{1, 1/2}, {1/2, 1}}], 
       {x, y}], {x, -2.3, 2.3}, {y, -2.3, 2.3}, ImageSize -> 350, 
       ViewVector -> Dynamic@vp]},
 DynamicModule[{vp, views, plot},
   Panel@Column[{dplot, 
     Button["Record View point", AppendTo[views, vp]], 
     Button["Export", {Export["~/test.pdf", GraphicsRow[plot /@ views]]; 
       extViews = views}]}, Center],

   Initialization :> (
     extViews = 0;
     views = {};
     plot = 
     Plot3D[PDF[MultinormalDistribution[{0, 0}, {{1, 1/2}, {1/2, 1}}], 
       {x, y}], {x, -2.3, 2.3}, {y, -2.3, 2.3}, ImageSize -> 350, 
       ViewVector -> #] &;
    vp = Options[Graphics3D, ViewPoint][[1, 2]];
    )]]

enter image description here

producing:

enter image description here

My problem here is that I have to write twice the Plot3D, one with Dynamic@vp one with #. If anyone can enlighten me.. :)

Öskå
  • 8,587
  • 4
  • 30
  • 49