3
$\begingroup$

How to show orthogonal views for a 3D plot(ParametricPlot3D)?

Please refer to the following picture(top view/front view/side view):

enter image description here

$\endgroup$
1

2 Answers 2

4
$\begingroup$

Sample object:

g=Graphics3D[{Cylinder[],Blue,Cuboid[{-2,-3,-1},{2,3,0}]},Boxed->False]

enter image description here

There are special commands for this:

Show[g,ViewPoint->#]&/@{Back,Bottom,Front,Top,Left,Right}

enter image description here

The usefulness of all projections (Left different from Right etc.) is more clear on a completely asymmetric case:

m=ConvexHullMesh[RandomReal[{-1,1},{30,3}]];
Show[m,ViewPoint->#]&/@{Back,Bottom,Front,Top,Left,Right}

enter image description here

$\endgroup$
1
  • $\begingroup$ This is not quite an orthographic projection though. One needs to add ViewProjection -> "Orthographic", which I also just learned myself by first setting something like ViewPoint -> {Infinity, 0, 0}, then using Options to see what options the resulting Graphcis3D actually contains. (By that time I already wrote the first part of my answer, this is why I ended up mentioning ViewProjection only at the end.) $\endgroup$
    – Szabolcs
    Commented Jun 9, 2021 at 7:31
4
$\begingroup$

What Vitaliy shows is not quite the full solution. Notice that in the Front view, the top of the cylinder still looks curved. With a true orthographic projection, it should look flat, as in the illustration given in the question.

To achieve an accurate orthographic projection, we need to set the view distance to infinity. Using Vitaliy's graphics (g) for illustration, this is what we get with Front:

Show[g, ViewPoint -> Front]

enter image description here

The view distance is not infinite, causing a noticeable curve on the cylinder cap. Now let us set it to infinity:

Show[g, ViewPoint -> {Infinity, 0, 0}]

enter image description here

This is now a true orthographic projection.

This is documented in the doc page of ViewPoint, under "Details".

Here's an isometric view:

Show[g, ViewPoint -> {Infinity, Infinity, Infinity}]

enter image description here

All good so far, but what if we want to view the object under a different angle, and still use orthographic projection? We can't use ViewPoint -> {2 Infinity, Infinity, Infinity} as 2 Infinity is clearly the same as Infinity.

The solution is to use finite numbers in ViewPoint, but set ViewProjection -> "Orthographic". See ViewProjection.

Show[g, ViewPoint -> {2, 1, 1}, ViewProjection -> "Orthographic"]

enter image description here

$\endgroup$

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