0

I am trying to work out an isometric projection matrix for a custom angle. In the engine I'm using there's a projection matrix defined like so:

var project:Matrix = new Matrix();
projection.rotate(45 * (Math.PI / 180) );
scale = 1.4142137000082988; // not sure why this magic number is needed- now working on a "real" solution
projection.scale(scale * 1, scale * .5);

(the syntax above is actionscript, but that shouldn't matter much) I'm currently trying to get my head around the wikipedia article. I see the beta angle is 45, like in the matrix above, but I don't understand where does the 'magic' number come from, and the connection between the isometric angle and the scale ratio (1,1/2).

If I want to use a custom angle, how do I work out what angle I use instead of 45 ? , what would the scale value and scale ratio be ?

George Profenza
  • 50,687
  • 19
  • 144
  • 218

2 Answers2

1

Based on the math, it looks like

scale = 1/cos(θ)

or

scale = 1/sin(θ)

where θ is the angle of rotation.

  • 45 * (Math.PI / 180) converts 45° into radians (π/4)
  • cos(π/4) = sin(π/4) = 0.7071067811865476
  • 1/cos(π/4) = 1/sin(π/4) = 1.414213562373095 and there's your magic number.

(Differences in the ten-millionths since I ran these quick calculations in JavaScript)

Matt Ball
  • 354,903
  • 100
  • 647
  • 710
  • That is handy. I can see that should be a dimetric (30,45) isometric projection, which might explain the (1,1/2) scaling `projection.scale(scale * 1, scale * .5);` How can I generalize that for an arbitrary angle instead of 30 ? How do I work out what the ratio should be instead of scale * 1, scale * .5 ? – George Profenza May 08 '12 at 21:41
  • Erm, dimetric and isometric are mutually exclusive — they are both types of axonometric projections... at any rate, I'm not sure. – Matt Ball May 08 '12 at 21:42
1

Simply to preserve perspective and not much else. Scaling is not neccesary to achieve isometric orthography. However, when the first rotational angle (45deg) is applied, the image loses it's original scale. To fix this, the image is usually scaled down.

Isometric projection is a particular type of orthographic projection in which each axis is equally represented and the angle between the axes is 120 degrees. To achieve this: a rotation about the horizontal axis of 45 degrees; followed by a rotation about the vertical axis by the arcsine of cosine 30 degrees. So, no such custom angles. The application is simulating the secondary rotation with a non-uniform scale transformation. The x-axis scale is preserving the initial 45 degree rotation; however the y-axis is being foreshortened by 50%. Basically, the scale transform is achieving the secondary rotational transform (arcsin(cos(30 * (PI/180)))).

The "magic number" you are referring is twice the cosine of 45 degrees.

Thomas Anthony
  • 7,853
  • 1
  • 14
  • 7