Re: Orthographic Projection and Aspect Ratio

New Message Reply Date view Thread view Subject view Author view

Michael T. Jones (mtjones++at++ix.netcom.com)
Fri, 18 Jun 1999 08:10:18 -0700


At 08:51 AM 6/18/99 -0500, Kevin Kronmiller wrote:

>Hi,
>
>I have a 4 degree by 4 degree terrain database built with a Flat Earth
>mapping projection in MultiGen. The resulting database is a rectangle
>significantly larger North to south than East to West. It seems that I
>should be able to maintain the proper aspect ratio in my channel by
>insuring that the left, right and top, bottom parameters to
>chan->makeOrtho(left, right, bottom, top) maintain the same ratio as the
>actual terrain database.
>
>For example:
>
>(right - left) / (top - bottom) = (Bbox.max[0] - Bbox.min[0]) /
>(Bbox.max[1] - Bbox.min[1])
>
>I have implemented this concept in my code and the visual aspect ratio is
>not as it should be. Objects that should be square are stretched along
>the X-axis.
>
>Am I missing something obvious?

What I think you're overlooking is that you need use a "square" projection to
view your database, irrespective of database physical aspect ratio, if you want
to avoid distortion. It makes sense -- you don't change your camera in order
to take a picture of a tall building. If you could adjust a camera's lens
to make
such a building exactly fill a square frame (i.e., an anamorphic lens),
then you
would indeed make things appear wider than they are, just as you observe.

If you want to fill the screen without distortion using an orthographic
projection,
then you'll need to:
  a) compute database aspect ratio (using bounding boxes or whatever).
  b) determine the display surface aspect ratio.
  c1) if the aspect ratios are identical, do what you already do.
  c2) if the database is more vertical than the display, then viewing
     height is unmodified database height and viewing width is database
     height scaled by the display surface X/Y.
   c3) if the database is more horizontal than the display, then viewing
     width is unmodified database width and viewing height is database
     width scaled by the display surface Y/X.

Since your 4 degree by 4 degree tile is more vertical than horizontal,
you must be away from the equator. If you go all the way to the poles,
your 4 degree patch will be very much larger vertically -- using my
palm pilot and rough earth radius info from memory, I compute that
a 4-degree patch touching the pole at the top or bottom will be 240
miles tall and 16.6 miles wide, or about 28 times taller than wide. The
people up there must get a lot of pictures on a roll of film ;-)

Michael

----------
Michael T. Jones - <mailto:mtj++at++intrinsic.com>mtj++at++intrinsic.com -
<http://www.intrinsic.com/>Intrinsic Graphics Inc. - (650) 210-9933x13
A frog in a well says "The sky is as big as the mouth of my well"

At 08:51 AM 6/18/99 -0500, Kevin Kronmiller wrote:

Hi,

I have a 4 degree by 4 degree terrain database built with a Flat Earth mapping projection in MultiGen.  The resulting database is a rectangle significantly larger North to south than East to West.  It seems that I should be able to maintain the proper aspect ratio in my channel by insuring that the left, right and top, bottom parameters to chan->makeOrtho(left, right, bottom, top) maintain the same ratio as the actual terrain database.

For example:

(right - left) / (top - bottom) = (Bbox.max[0] - Bbox.min[0]) / (Bbox.max[1] - Bbox.min[1])

I have implemented this concept in my code and the visual aspect ratio is not as it should be.  Objects that should be square are stretched along the X-axis.

Am I missing something obvious?

What I think you're overlooking is that you need use a "square" projection to
view your database, irrespective of database physical aspect ratio, if you want
to avoid distortion. It makes sense -- you don't change your camera in order
to take a picture of a tall building. If you could adjust a camera's lens to make
such a building exactly fill a square frame (i.e., an anamorphic lens), then you
would indeed make things appear wider than they are, just as you observe.

If you want to fill the screen without distortion using an orthographic projection,
then you'll need to:
 a) compute database aspect ratio (using bounding boxes or whatever).
 b) determine the display surface aspect ratio.
 c1) if the aspect ratios are identical, do what you already do.
 c2) if the database is more vertical than the display, then viewing
    height is unmodified database height and viewing width is database
    height scaled by the display surface X/Y.
  c3) if the database is more horizontal than the display, then viewing
    width is unmodified database width and viewing height is database
    width scaled by the display surface Y/X.

Since your 4 degree by 4 degree tile is more vertical than horizontal,
you must be away from the equator. If you go all the way to the poles,
your 4 degree patch will be very much larger vertically -- using my
palm pilot and rough earth radius info from memory, I compute that
a 4-degree patch touching the pole at the top or bottom will be 240
miles tall and 16.6 miles wide, or about 28 times taller than wide. The
people up there must get a lot of pictures on a roll of film ;-)

Michael

Michael T. Jones - mtj++at++intrinsic.com - Intrinsic Graphics Inc. - (650) 210-9933x13
A frog in a well says "The sky is as big as the mouth of my well"

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Fri Jun 18 1999 - 08:08:37 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.