Skip to content

Instantly share code, notes, and snippets.

@chinghanho
Created July 12, 2016 11:16
Show Gist options
  • Save chinghanho/7c74bf7b63da1674e542bb332cbc6f5e to your computer and use it in GitHub Desktop.
Save chinghanho/7c74bf7b63da1674e542bb332cbc6f5e to your computer and use it in GitHub Desktop.
計算鏡頭焦距及標準全級光圈光闌面積
focals = [20, 50, 85]
f_numbers = [1.4, 2, 2.8, 4, 5.6]
focals.each do |focal|
puts "鏡頭焦距:#{focal}mm"
puts ""
f_numbers.each do |f|
a = ((((focal/f)/2)**2)*3.14).round(2)
printf "ƒ/%-5s 光闌面積 %-6s mm2\n", f, a
end
puts ""
puts ""
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment