Group Abstract Group Abstract

Message Boards Message Boards

Universal stereo plotter

Posted 10 years ago
POSTED BY: Eric Johnstone
5 Replies

This is exactly what I wanted to enable me to see particle trajectories in 3D. Thanks.

Attachment

Attachments:
POSTED BY: Richard Baartman

Dynamic has a second argument that gives the behaviour I'm looking for. Since the left-hand plot is too slow to move with the right-hand one, it can be disabled until the right-hand plot is in the desired position. When the mouse button is released, the Dynamic variable is broadcast and the left-hand plot is updated.

The second argument can also disable interaction, so that the left-hand plot cannot be moved by the mouse. It shouldn't be moved anyway, because that generates and error.

So here is the finished code:

    stereo[expr_] := 
     DynamicModule[{vp = {1.3, -2.4, 2.0}, vv = {0., 0., 2.0}, plot}, 
      plot = expr; 
      GraphicsRow[{Show[plot, ViewPoint -> Dynamic[vp + {.2, 0, 0}, None],
          ViewVertical -> Dynamic[vv, None]], 
        Show[plot, ViewPoint -> Dynamic[vp, Temporary], 
          ViewVertical -> Dynamic[vv, Temporary]]}, 
        ImageSize -> Large]]

You might want to play around with the 0.2 offset.

Note that this can turn any 3D graphic into a stereoscopic image. Just append //stereo to the 3D graphic expression.

Edit:

That annoying jump when you release the mouse button can be fixed by adding the Option RotationAction -> "Clip". It only applies to functions that recognize this option, but that includes most of the Plot3D functions:

stereo[expr_] := 
 DynamicModule[{vp = {1.3, -2.4, 2.0}, vv = {0., 0., 2.0}, plot}, 
  plot = expr; 
  GraphicsRow[{Show[plot, ViewPoint -> Dynamic[vp + {.3, 0, 0}, None],
      ViewVertical -> Dynamic[vv, None], RotationAction -> "Clip"], 
    Show[plot, ViewPoint -> Dynamic[vp, Temporary], 
     ViewVertical -> Dynamic[vv, Temporary], 
     RotationAction -> "Clip"]}, ImageSize -> 600]]

The ImageSize can be set to your liking, too.

Eric

POSTED BY: Eric Johnstone

Hi Sam,

Yes, I made a little Manipulate tester to find the offset. However, I was using the wrong axis. On further testing, a value of 0.2 works better.

My approach is to have a function that can be used in normal MMA explorations. I'm working on using the event handler to detect a mouseup event, at which point the left-hand image will be drawn. That should allow fast image rotations, although it isn't what I'd really like: to see the stereoscopic movement similar to the flat movement.

Eric

POSTED BY: Eric Johnstone

Hi Sam,

Yes, I made a little Manipulate tester to find the offset. My approach is to have a function that can be used in normal MMA explorations. I'm working on using the event handler to detect a mouseup event, at which point the left-hand image will be drawn. That should allow fast image rotations, although it isn't what I'd really like: to see the stereoscopic movement similar to the flat movement.

Eric

POSTED BY: Eric Johnstone

Nicely done, Eric. I wonder if finding $0.4$ in ViewPoint -> Dynamic[vp + {0.4, 0, 0}] was trial and error sort process. Such things were tried already. Take a look at Herbert W. Franke's demos, fro example Stereo View without Glasses and at @Kay Herbert's 3D Anaglyph Graphics. WL code is available for free download at those links.

enter image description here

enter image description here

POSTED BY: Sam Carrettie
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard