Skip to content

Instantly share code, notes, and snippets.

@mat813
Created March 1, 2012 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mat813/1951453 to your computer and use it in GitHub Desktop.
Save mat813/1951453 to your computer and use it in GitHub Desktop.
taille écran / résolution / pixels
def diag(seize,neuf,inch,pixels)
ratio = (seize**2+neuf**2)**0.5
cms = inch*2.54
taille = [seize, neuf].map {|v| (v*cms/ratio).round(2)}
taille << (taille[0]/pixels*10).round(4)
taille << pixels*neuf/seize
return taille
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment