Real Scale Projection

Miscellaneous Forums/General Discussion/Real Scale Projection

1 pixel = how many meters in real life?

Let's consider an equation that auto-sizes and takes into account the monitor size and screen resolution.

What I want to do is simulate a ball bouncing on my screen that is scaled to real life. So if I drop a ball in front of my monitor and hit the space bar, both balls with drop and bounce perfectly.

Let's consider an 800,600 resolution on a 17 inch monitor. In order to find out the actual size that each pixel represents in meters...or millimeters (doesn't matter).

As far as I know, there is no way to programmatically retrieve the physical dimensions of a monitor, so you have no way of finding out if that 800x600 screens runs on a 15" or a 32" monitor...

So there's no way to find out the physical width and height of the screen IRL?

I suppose you could have the user input the size of the monitor and it'd be pretty accurate.

Let's assume that the monitor is physically 15 inches wide by 11.5 inches tall. That yields a ratio of 1.3 which is pretty accurate.

Now let's say that i have the resolution set to 800,600. So I now have 800 pixels across 15 inches. I'm using SI so 15 inches converted to meters is 0.381 meters. So now I would take 0.381 and divide by 800. Which is 0.00047625. So on the screen, 1 pixel represents 0.00047625 of a meter.

Now...to find out how many pixels are in a meter. I do a 1/0.00047625 which is roughly 2099. So I'm assuming I mulitply all my physics by 2099 to get reality, based on my monitors physical dimensions.

It's untested but does that sound about right?


I suppose you could have the user input the size of the monitor and it'd be pretty accurate.


What they used to do in old desktop publishing programs was have the user place a floppy disk on the screen and adjust an on-screen rectangle to fit. You could do the same with a CD/DVD nowadays and take it from there... don't ask me about the mathematics involved, though I supposed you'd have a direct measurement in pixels since you're drawing a circle to fit a standard sized disk. That said, not all pixels are square...

Hmm i don't know how you can read out the dpi of a screen and which os support this so it could come down to an horrible dpi list which you have to align with the vendor information.

I also remember the idea comparing a standard sized real object with a virtual adjustable shape to get some approximation.

Depending on if you're in 3d or 2d space you also don't have to use pixel as a base as you already have a proper length instead. But if wanted you can get them by a 3d-to-2d projection. You also would have to differ betweeen window- and fullscreenmode if you're not running at the same resolution.

I have no freaking clue what you just said taumel.

It also depends on your userbase -- are you making a program for engineers, or your grandma?

While most 'techies' would know the dimensions of their monitor, most casual users have no idea whatsoever.

There's also the added complication of wide screen vs. non-widescreen. You can get 17" and 19" monitors in both formfactors, and pixel sizes then greatly depend on the video card driver settings: on a widescreen display, 800x600 could either be stretched horizontally to fit, or it could be shown in proper aspect ratio except using black bars on the side.

Tocomplicate matters further, many video drivers also allow you to only display at the native resolution (especially laptops) -- So if you have a 15" display that supports 1024x768, switching to 800x600 may result in a small picture centered in the middle of the screen, with black bars all around, rather than stretching the image to fill the entire screen.

Actually measuring a real-world object against the screen (like the floppy mentioned above) would probably be the most fool-proof, except it is of course a hassle for the user, and in this day and age few people have floppies laying around anymore. I guess the next best thing could possibly be a CD jewel case, since those at least are rectangular (unlike an actual CD), andpretty much everyone has one of them near their computer these days.

Or I guess you could also draw a box and ask the user to measure it with a ruler and input the dimensions...