# How to achieve a perspective where two axes of a 3D scene coincide with the x and y axes of the 2D projection?

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.

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);
``````

(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);
...
``````

• Oblique projection distorts the image in an unrealistic way. Is it possible to get the axes as shown, but still use an orthographic or perspective projection?
– Jan
Jul 24, 2013 at 21:36
• @Jan, "Oblique projection distorts the image in an unrealistic way", ok, I know, and still is what you want from the example image (maybe without knowing). You can't get that result and use orthographic projection, sorry. If the axis "y" and "z" have the same 3D length in your image and the 2D projection is 90 degree the this has to be `oblique` projection.
– alfC
Jul 24, 2013 at 22:55
• I'm still curious, whether it is possible to find a camera position, which yields the following: The orientation of the axes is as shown with a right angle between z and y and some angle between x and y. I do not require the axes to have a particular length in the projection. They may appear shortened as required by the perspective.
– Jan
Jul 25, 2013 at 8:37
• @Jan, no, it is impossible. Think about it, if you are looking directly at the y-z plane (like in your example), how can you see the x axis "sticking" out to a side? This is not possible in orthogonal projection. I recommend this book amazon.com/Extreme-Perspective-For-Artists-Curvilinear/dp/…
– alfC
Jul 25, 2013 at 9:56
• @alfC: It would be possible to do with a perspective projection, though, by zooming out really far and moving the camera to the left while still looking in the x direction.
– Jake
Jul 26, 2013 at 11:51