4
$\begingroup$

I wanted to Manipulate the ViewPoint of Grphics3D[Cube[]].

My codes are

Manipulate[Graphics3D[Cube[], ViewPoint -> {a, b, c},
  BoxRatios -> 1, ImageSize -> Small],
 {a, -1, 1}, {b, -1, 1}, {c, -1, 1}, Alignment -> Center,
 ContentSize -> {250, 250}, ControlPlacement -> Top]

But I have 2 problems

Problem 1) Some boundary parts of the cube are cut off when rotated. I tried many options for Manipulate like ContentSize,ImageMargins,FrameMargins,... but didn't work. See the former part of the attached Gif image.

Problem 2) If the cube is rotated by mouse-clicking the cube itself(just once), then the slider doesn't work any more. See the latter part of the attached Gif image.

Thank youenter image description here

My mathematica is V 12.2 and OS is windows 10, and I get

SystemInformation["Devices", "ConnectedDisplays"]

{{"Region" -> {{0., 1152.}, {0., 615.6}}, 
  "FullRegion" -> {{0., 1152.}, {0., 648.}}, 
  "PixelDimensions" -> {1920, 1080}, "BitDepth" -> 32, 
  "Resolution" -> 120., "Scale" -> 1.66667}}
$\endgroup$
2
  • $\begingroup$ Thank you, but it is possible that it is not because of the version issue. And I believe there is a way to control (show all, never cut off) the margin of the content. $\endgroup$
    – imida k
    Oct 12, 2022 at 22:24
  • $\begingroup$ Oh, a user commented that my code works well in mathematica v13, but the comment was deleted a few seconds ago. $\endgroup$
    – imida k
    Oct 12, 2022 at 22:26

1 Answer 1

6
$\begingroup$

I am not getting the first issue you mention on V 13.1 no cut off. But add SphericalRegion->True as it is a good option to always use.

enter image description here

For the second one, try adding this

ViewPoint -> Dynamic@{a, b, c}

So the code becomes

Manipulate[
 Graphics3D[Cube[], ViewPoint -> Dynamic@{a, b, c},
  BoxRatios -> 1,
  ImageSize -> Small,
  SphericalRegion->True
  ],
 {a, -1, 1},
 {b, -1, 1},
 {c, -1, 1},
 Alignment -> Center,
 ContentSize -> {250, 250},
 ControlPlacement -> Top,
 TrackedSymbols :> {a, b, c}]

enter image description here

$\endgroup$
2
  • $\begingroup$ Thank you ! 2nd problem was solved completely, but 1st problem is not solved though I applied SphericalRegion->True. When I test it on mathematica v13, I will update my comment! $\endgroup$
    – imida k
    Oct 14, 2022 at 2:46
  • $\begingroup$ It works nicely after updating to v13. $\endgroup$
    – imida k
    Jan 18, 2023 at 21:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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