[Tex/LaTex] How to achieve a perspective where two axes of a 3D scene coincide with the x and y axes of the 2D projection

3dasymptote

axes sketch

How should the corresponding camera line look like?

currentprojection = orthographic(camera=(x,y,z),up=Y,target=O);

In particular, I need a formula for the triple (x,y,z) depending on the angle between the x and y axes.

Best Answer

What you want is called "oblique" projection. As explained here http://en.wikipedia.org/wiki/Oblique_projection.

You need to use currentprojection=oblique; to achieve this kind of projection.

First two examples from the gallery:

http://asymptote.sourceforge.net/gallery/planes.asy

http://asymptote.sourceforge.net/gallery/.cache/planes.png

Now the code:

import three;
import graph3;
currentprojection=obliqueX(-45); // angle in degrees for the third axis (e.g. 25)
size(5cm);
xaxis3("$x$",0,1,black);
yaxis3("$y$",0,1,black);
zaxis3("$z$",0,1,black);
viewportsize=(345.0pt,0);

obliquexyz

(BTW, I couldn't make the sign of the angle argument of obliqueZ or obliqueX to make the "x" axis to stick to left-top direction.)

and just to illustrate that is not possible to get this with other projections,

...
currentprojection=orthographic(4,6,3);
...

orthoxyz