Search code examples
geometryaspect-ratio

Representing known units in proportion as pixels


This question probably has a very simple answer/formula but math is not a strong point for me. If I have the proportions of a real world object, how can I take the units and proportionally represent that object in pixels?

Let's use the example of a North American hockey rink

The rink itself is 200ft x 85ft so its aspect ratio would be 40:17. Let's say I scale it so that the entire rink will be 1000px x 425px. Now, where my brain decides to stop working is figuring out how many pixels will represent a single foot.

We know the center of the ice should be exactly 100ft from either end of the rink. At this scale (or any scale), what is the formula to figure out how many pixels is equal to 100ft? or how many pixels is equal to one foot?


Solution

  • If 1000 pixels == 200 feet, then pixels per foot == 1000 / 200 = 5.0.

    The other axis is the same: 425 / 85 == 5.0 (since you maintained your aspect ratio at 2.35).

    It's easiest to think about "per" as the "/" sign, so "pixels per foot" translates into "pixels / feet", which is "1000 pixels / 200 feet"; doing the division yelds 5.0 pixels per foot.

    (So the 100 foot half a hockey rink would be 100 feet X 5 pixels, or 500 pixels).