Re: How to calculate the aspect ratio for PerspectiveFovLH ?

From: ZMan (news-replies_at_thezbuffer)
Date: 10/30/04


Date: Sat, 30 Oct 2004 15:01:49 -0700

You as a programmer can never guarantee a pixel aspect ratio of 1.0. For a
start take a look at any of the many controls on most modern CRT monitors.
You can change the height, width and many other settings that would affect
the aspect ratio of all or part of the screen without the program having any
clue what is happening.

Now consider the different resolutions of most video cards - here's some
from mine:
 1600x1200 is 4:3, 1280x1024 5:4 1280x960 4:3 1280x768 5:3

So if your circle looks like a circle in 1280x1024 then it won't look like a
circle in 1280x768 and it might not look like a circle in someone elses
1280x1024.

What you can do is assume that most PCs have 4:3 ratio monitors so the 4:3
modes are probably going to have the closest looking circles which is why
things generally work out. If you detect a different ratio for the screen
resolution you could maybe deduce they have a wide scrren monitor if the
ratio look 16:9 or you could apply some scale factor to try to correct for
their strange choice. Or if accuracy is very very important you could
display a circle and ask them to measure and adjust their monitor/resolution
or some parameters in your program until it matches.

ZMan

" Just Me" <newsgroups@a-znet.com> wrote in message
news:exgGpYevEHA.3376@TK2MSFTNGP12.phx.gbl...
> 1. I thought there was (and still might be) a video mode where it was not
> true that the pixel aspect ratio was 1.0. Glad to here that is not true.
>
> 2. FYI, I found "this.Width/this.Height" is used in the book I'm using
> but I think "(float)this.Width/this.Height" is better.
>
> I had something happing that prompted the question. I think I now know
> what the cause is.
>
> Thanks
>
>
>
> "Teis Draiby" <teisREMOVE-THIS@draiby.com> wrote in message
> news:OG4brNHvEHA.2172@TK2MSFTNGP14.phx.gbl...
>>> If I want a circle to display as a circle seems it should be related to
>> how
>>> the display displays.
>>
>> - What do you mean by that? Don't computer monitors by definition have a
>> pixel aspect ratio of 1.0? Correct me if I'm wrong.
>> The width/height ration of the render surface usually works fine, like
>> this:
>>
>> device.Transform.Projection =
>> Matrix.PerspectiveFovLH((float)Math.PI/2.0F,
>> this.Width/this.Height, 1.0F, 10.0F);
>>
>>
>> regards, Teis
>>
>>
>
>



Relevant Pages

  • Re: How can photons be massless
    ... Pi (defined as the ratio of a circle's circumference C to its diameter) ... Pi is defined as the ratio of the circumference of a circle to its ... equator, or 1/8 of the full line of longitude. ...
    (sci.physics)
  • Re: The moment the willing suspension of disbelief died
    ... curvature of space, like most geometric relationships. ... >circle inscribed on the surface will have a diameter inscribed _on the ... giving a ratio of circumference to diameter that is less than pi. ... No number is, because that ratio varies, ...
    (rec.arts.sf.written)
  • Re: How to calculate the aspect ratio for PerspectiveFovLH ?
    ... Monitors are almost always 4:3 though some are 16:9. ... that ratio to 4:3 or ... > You as a programmer can never guarantee a pixel aspect ratio of 1.0. ... > So if your circle looks like a circle in 1280x1024 then it won't look like ...
    (microsoft.public.win32.programmer.directx.managed)
  • Re: [QUIZ] Circle Drawing (#166)
    ... Support Ruby Quiz 2 by submitting ideas as often as you can! ... Given a radius, draw an ASCII circle. ... Note that most fonts do not have a square aspect ratio, ... # * draw the circle on its internal canvas ...
    (comp.lang.ruby)
  • Re: OT...Big Bang?
    ... Pi is a ratio in circles. ... Can't do it in an analog system, ... We can measure the diameter of a circle with a ruler. ... We can't measure with 100% accuracy the circumference of a circle. ...
    (rec.gambling.poker)