The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Trying to simulate 3D Rotation as Office 2007


I’m trying to simulate the 3D rotation feature of Office 2007. I understand X, Y, and Z rotation but I cannot figure out how Perspective Angle works. In Perspective angle box I can enter an angle number from 0 to 120 degrees. My question is what is the math behind it? I mean, suppose you rotate a rectangle at 20 degrees in X axis and then set a perspective angle of 45 degrees. So, how that rectangle is transformed into a trapezoid i.e. what is the math used to translate the original 4 points of the rectangle into the 4 points of the trapezoid?

Thanks in advance,
Wednesday, May 16, 2007
Learn about polar coordinates first and translating to/from cartessian coordinates. It will probably become much clearer.

If you still have questions about how the rotation is done in polar coordinates, re-ask the question.
Wednesday, May 16, 2007
Check out the variable 'w', maybe wikipedia has an article on transformations (I'm too lazy to type in anything).

If you want decent looking changes between orientations, look up 'quaternion'.
Wednesday, May 16, 2007
Wednesday, May 16, 2007
Google "perspective transformations".
A. Nonymous
Wednesday, May 16, 2007
Also google "view matrix" -- you can first concatenate the rotation, translation and projection transformations into one matrix, then multiply that by each vertex in your object to determine the screen coordinate.
Wednesday, May 16, 2007
(Old thread, I know, but I don't check back here that often.)

Never seen that feature, so I can't say for certain, but given the range that you mentioned, I'd guess that it's actually just a field-of-view angle.  In most 3d systems, the field-of-view angle is the size of the angle taken in by the width of the screen or the image.  Usually larger angles give you more perspective distortion and show more of a scene.  Smaller angles give much less perspective distortion and a more telephoto like effect.

For something like rotating a quad, you'll probably just end up with it  controlling a combination of how far back (into the screen) you translate the quad and how much you scale in 2d to compensate. There's typically just a tan() call when I implement it.
Monday, May 28, 2007

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz