[Gambas-user] miles per hour to pixels per frame (general unit conversion function)

Kevin Fishburne kevinfishburne at ...1887...
Sat Aug 20 10:08:54 CEST 2011


On 08/20/2011 03:57 AM, Caveat wrote:
> Seems ok to me...
>
> 5280 feet in a mile, 128 pixels in a foot
> = 128*5280
> = 675840 pixels in a mile
>
> At 20 MPH you'd cover
> 20*675840 pixels
> = 13516800 pixels
>
> In a whole hour you'd cover 13516800 pixels but each frame only lasts
> 1/30th second, there's 60 seconds in a minute and 60 minutes in an hour
> so in one frame (lasting 1/108000th of an hour) you'd cover:
> 13516800 / (30 * 60 * 60) pixels
> = 13516800 / 108000 pixels
> = 125.155556 pixels
>
> Or put another way:
> 20 * 675840 / 108000
> = 125.155556
> = MPH2PPF(20)
>
> Scary corollary:  at 120 km/hr you do 2km / minute
> = 2000 metres/minute
> = 2000/60 metres per second
> = 33 metres per second!
>
> If you take just 1/2 a second to react to a problem, you'll already be
> 17 metres closer to it, and if you take your eyes off the road just for
> a second to answer a text or change CDs... :-O
>
> Regards,
> Caveat
>
> On Sat, 2011-08-20 at 03:17 -0400, Kevin Fishburne wrote:
>> I came up with this equation, which I think is correct:
>>
>> Public Function MPH2PPF(MPH As Single) As Single
>>
>>     ' Convert miles per hour to pixels per frame.
>>
>>     ' 1 mile = 675840 pixels.
>>     ' 1 hour = 108000 frames.
>>
>>     Return MPH * 675840 / 108000
>>
>> End
>>
>> The frame rate is 30 FPS, and 128 pixels = one foot. Can anyone verify
>> that this is correct?
>

Haha, love it. :) Thanks for the confirmation. Reminds me of some guy in 
the UK who was banned from driving for a year or two because he was 
caught driving 70 MPH while talking on the phone and texting at the same 
time on two different phones. He was accused of driving with his knees. 
What an asshole...

I always maintain a proper following distance and avoid anything but 
brief usage of electronics while driving. I prefer my guts to stay 
inside my body, thank you.

-- 
Kevin Fishburne
Eight Virtues
www: http://sales.eightvirtues.com
e-mail: sales at ...1887...
phone: (770) 853-6271





More information about the User mailing list