0
$\begingroup$

Consider very simple 3D object: Tube from {0,0,0} to {1,2,3}. I want to see projection to X-Z plane. My first attempt is:

Show[Graphics3D[Tube[{{0, 0, 0}, {1, 2, 3}}]],
  Axes -> {True, False, True}, ViewPoint -> {0, ∞, 0}, Boxed -> False]

And I want Z axis being in horizontal direction, so I have to manually rotate by Pi/2 clockwise. Finally I get this:

enter image description here

You see not ideal alignment of axes, but this is what I want to get.

Another attempt is as follows:

Show[Graphics3D[
  GeometricTransformation[Tube[{{0, 0, 0}, {1, 2, 3}}], 
   Composition[ReflectionTransform[{1, 0, 0}], 
    RotationTransform[ -π/2, {0, 1, 0}]]]], 
 Axes -> {True, False, True}, Boxed -> False, ViewPoint -> Front]

With this I can get desired view, but picture is very different from first one:

enter image description here

So, the question is: how to get X-Z projection and Z axis being horizontal?

Thanks in advance.

$\endgroup$
  • $\begingroup$ Have you seen ViewVertical? $\endgroup$ – J. M. will be back soon Dec 16 '16 at 2:49
  • $\begingroup$ @J.M., yes, I know about ViewVertical. I don't know how to use that in my case. If I replace in first code ViewPoint->{0, \[Infinity], 0} with ViewVertical->{0,1,0} I get the same result: projection to X-Z plane and Z axis is vertical. I need Z axis being horizontal. Please, explain how to use ViewVertical option? $\endgroup$ – Alx Dec 16 '16 at 3:36
  • 2
    $\begingroup$ Try ViewVertical -> {1, 0, 0} ("make $x$ vertical"). $\endgroup$ – J. M. will be back soon Dec 16 '16 at 4:16
  • $\begingroup$ OK, adding ViewVertical->{1,0,0} to my first code solves the problem. Many thanks to @J.M.! My confusion was that if I set ViewPoint I'll have "plane" picture (projection to some plane) and I can't apply ViewVertical (I thought it has sense in 3D only). $\endgroup$ – Alx Dec 16 '16 at 4:24
  • $\begingroup$ Another aside observation of MMA strange behaviour. If in fresh notebook I execute my original first code, this gives me some picture of plane projection. Let's denote this first In[] and Out] cells. Now in the oroginal first input cell I change ViewPoint->{0, \[Infinity], 0} with ViewVertical->{0,1,0} and execute this cell. The picture in output doesn't change. If I delete Out[] cell and run In[] again I'll have 3D view with Y axis being vertical, as it should be. Why MMA doesn't replace Out[] after In[] was edited? $\endgroup$ – Alx Dec 16 '16 at 4:49
2
$\begingroup$

Answer from a comment:

No, as J.M. proposed in his comment this does exctly what I need:

Show[Graphics3D[Tube[{{0, 0, 0}, {1, 2, 3}}]], Axes -> {True, False, True}, 
      ViewPoint -> {0, ∞, 0}, ViewVertical ->{1,0,0}, Boxed -> False]

does what I need and what is shown in my first picture. – Alx Dec 16 '16 at 10:43

$\endgroup$
0
$\begingroup$

Will this do:

     Show[Graphics3D[
  Rotate[Tube[{{0, 0, 0}, {1, 2, 3}}], {{0, 0, 1}, {1, 0, 0}}]], 
 Axes -> {True, False, True}, AxesLabel -> {"z", "y", "x"}, 
 ViewPoint -> {1.5, -100, 0.5}, Boxed -> False]

enter image description here

??

$\endgroup$
  • $\begingroup$ No, as J.M. proposed in his comment this does exctly what I need: Show[Graphics3D[Tube[{{0, 0, 0}, {1, 2, 3}}]], Axes -> {True, False, True}, ViewPoint -> {0, \[Infinity], 0}, ViewVertical ->{1,0,0}, Boxed -> False] does what I need and what is shown in my first picture. $\endgroup$ – Alx Dec 16 '16 at 10:43

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.