5
$\begingroup$

A common problem for me is finding the right perspective for 3D graphics.

This example accepts the default viewpoint and produce this: default

Using the mouse, the image is manipulated to something like this: modified

How do I harvest the perspective information so that it can be added to the graphic? My goal is to avoid having to manual adjustments across many files and to automate my process. This precludes using "Save graphics as...".

And for extra credit, how to get rid of white space? Trim Bounding Box produces this unsatisfactory result.

headless

$\endgroup$
  • $\begingroup$ I typically make a Manipulate and adjust the three parameters to find the best Viewpoint. $\endgroup$ – David G. Stork Apr 26 '17 at 23:06
  • $\begingroup$ @David G. Stork: Are there other parameters, like distance? $\endgroup$ – dantopa Apr 26 '17 at 23:14
  • $\begingroup$ Distance is derived from the three coordinates: {1,1,1} and {10,10,10} are from the same direction, but different distances. $\endgroup$ – David G. Stork Apr 26 '17 at 23:16
  • 1
    $\begingroup$ ... and simply click on the teeny + signs at the right of each slider to read their values. Manipulate[ Graphics3D[{Opacity[0.5], Sphere[], Red, Thickness[0.02], Line[{{0, 0, 0}, {1, 1, 1}}]}, ViewPoint -> {x, y, z}], {{x, 1}, -5, 5}, {{y, 1}, -5, 5}, {{z, 1}, -5, 5 }] $\endgroup$ – David G. Stork Apr 26 '17 at 23:20
  • 2
    $\begingroup$ See this previous question: Extract current viewing parameters from a 3D view? $\endgroup$ – Rahul Apr 27 '17 at 0:49
2
$\begingroup$
Manipulate[
 Graphics3D[
 {Opacity[0.5], Sphere[], 
 Red, Thickness[0.02], Line[{{0, 0, 0}, {1, 1, 1}}]},
  ViewPoint -> {x, y, z}], 
  {{x, 1}, -5, 5, Appearance -> "Open"}, 
  {{y, 1}, -5, 5, Appearance -> "Open"}, 
  {{z, 1}, -5, 5, Appearance -> "Open"}]

or Appearance -> "Labeled"

or...

if you want to copy the viewpoint, go to the teeny + at the upper-right corner of the Manipulate panel and select PasteSnapshot, which will paste the values of the parameters.

$\endgroup$
  • $\begingroup$ A very nice compliment to the answers in helpful link by @Rahul. $\endgroup$ – dantopa Apr 27 '17 at 3:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.