Saturday, June 11, 2005

Viewing Distance Calculator

Here is the viewing distance calculator I mentioned in More on Viewing Distance, in which I extolled the riveting, electrifying, immersive experience of watching HDTV from a position close enough to the screen to produce a "viewing angle" of somewhere around 30°:

Enter screen diagonal size in inches:inches
Enter viewing angle in degrees:degrees
Recommended viewing distance:feet
Recommended viewing distance:screen heights
The calculator's purpose is to let you enter the diagonal screen size in inches of a 16:9 HDTV display along with a desired viewing angle, the angle in degrees subtended at your eyes by the two sides of the screen. Various experts recommend viewing angles such as 26° or 30° or 33° or 36° for full-fledged 1080i or 720p HDTV.

If you are lucky enough to have a TV that offers true 1080i resolution, with 1,920 pixels worth of detail across the screen, you may want to use 31 degrees as your viewing angle. It's the angle that makes each pixel subtend an arc of 1 minute on your retina — the smallest angle discernable by the eye. It requires a TV-to-you viewing distance of 3.2 screen heights.

For those of you with 720p resolution — 1,280 pixels horizontally — the equivalent viewing angle is 21.5 degrees, and the number of screen heights of distance from you to the screen will be 4.7. In other words, you will need to sit further back from the screen than with 1080i, if you don't want to be looking at pixels bigger that the smallest dot your eye can distinguish. (When I'm watching actual hi-def material, I personally do not find sitting closer to my own 720p monitor than 4.7 screen heights bothersome. So I recommend pretending you have true 1080i resolution, even if you don't.)

So enter your screen size and a desired angle, and when you click on the "Calculate Now" button, the calculator will tell you what viewing distance, expressed in feet and also in multiples of the screen's height, will produce that angle.

For my own future reference, here is how I managed to incorporate the calculator in this Blogger post. ("{" and "}" replace "<" and ">" in what follows.) First of all, Blogger does not permit the text of JavaScript scripts to appear right in the HTML of a post. But JavaScripts can appear between the {HEAD} and {/HEAD} tags in a Blogger template. So I put this there, just before {/HEAD}:

{!-- This is where JavaScript scripts go: --}
{div id="scripts"}

{script type="text/javascript" src=""}

{!-- This ends where JavaScript scripts go --}
I put the actual JavaScript code in the external file (Actually, I created it locally on my Mac using TextEdit, then I uploaded it to my Comcast Personal WebPages using Fetch.)

Finally, I created a {TABLE}, within a {FORM}, within a {CENTER}'ed block. {TD} details in the table were specified in such a way as to interact with the (external) JavaScript function which I named, without much originality, compute(form).

For example, one of my table rows said:
{TR align=center}
{TD colSpan=2}{INPUT onclick="compute(this.form)" type=button value="Calculate Now"}{/TD}

It created the "Calculate Now" button in such a way as to cause it, when clicked on, to invoke the compute(form) JavaScript function.

Other table rows contained JavaScript-compatible language to either obtain as input or report as output the appropriate numeric values. These values matched variables defined in compute(form) in

Note that I actually had to edit my table HTML to remove all line breaks. Though unsightly, it prevents browsers from adding spurious blank lines above the table as displayed, one for each line break embedded in the table.

I set things up this way so I could, if I want, come back at a future date and make more Blogger post-accessible JavaScripts. I would create and upload the script as a .js file on my Personal WebPages. I would insert a reference to that file in my template. Then I would enter as HTML in a regular post the necessary {FORM} and {TABLE} stuff to make use of the script.

1 comment:

Postcode to postcode said...

Thanks for sharing some nice information about the distance calculator