Message Boards Message Boards

Avoid problem while using ViewPoint in a Manipulate?

POSTED BY: Simon Dee
7 months ago

I'm not 100% sure why it does not work as it should, perhaps someone else knows the cause. A solution would be to wrap viewpoint in a Dynamic:

ViewPoint -> Dynamic[viewPoint]

Note that you don't have to change PlotRange; it will be done automatically... Graphics3D always shows all the content unless specified otherwise...

POSTED BY: Sander Huisman
7 months ago

Thanks for your reply, Sander.

Your method changed the behaviour a bit, but it's still not working as expected. I've escalated this to Wolfram - I'll post in here if I find what the issue is.

POSTED BY: Simon Dee
7 months ago

You could use the Graphics3D option PreserveImageOptions. It is by default set to True. Which means that the graphics will "remember" any user interaction, and override further changes in view settings from the code. By setting the option to False, the graphics will respond to new changes in view settings from the code.

  Cylinder[{{0, 0, 0}, {0 + shaftLength, 0, 0}}, shaftRadius],
  ViewPoint -> viewPoint,
  ImageSize -> {500, 500},
  PlotRange -> {{0, shaftLength}, {-0.1, 0.1}, {-0.1, 0.1}},
  Boxed -> False, PreserveImageOptions->False
 {viewPoint, {Right, Front}},
 {{shaftLength, 1}, 0.1, 1},
 {{shaftRadius, 0.01}, 0.001, 0.05}

This will cause the view to be reset at any change in the Manipulate controls. Not only those that are aimed at controlling the view. Which can be seen as a drawback. There are methods to overcome this. But to paraphrase a judge in France, this post is too small.

POSTED BY: Hans Milton
7 months ago

Group Abstract Group Abstract