Skip to content

Instantly share code, notes, and snippets.

@marcocarvalho
Created December 18, 2018 01:37
Show Gist options
  • Save marcocarvalho/33f6ec98a4c62356d47dce8b4b50f39c to your computer and use it in GitHub Desktop.
Save marcocarvalho/33f6ec98a4c62356d47dce8b4b50f39c to your computer and use it in GitHub Desktop.
Heat treat oven line distribuition
# nTT = numedo de triangulos 13
# nTO = numero de triangulos onze
# nTT * c + nTO * c = 100
# c ( NTT + nTO ) = 100
# nTT * hTT + nTO * hTO = 270
# hTO = √cˆ2 + 11,5 ^ 2
# hTO = √cˆ2 + 132.25
# hTT = √cˆ2 + 13 ^ 2
# hTT = √cˆ2 + 169
# 4 ( 2 + 3 ) = 20
def print_calc(nTT, nTO, c, hy_tt, hy_to, total)
puts "%-3i | %-3i | %-10.2f | %-10.2f | %-10.2f | %.2f" % [ nTT, nTO, c, hy_tt, hy_to, total ]
end
def calc(nTT, nTO)
c = c_length(nTT, nTO)
hy_tt = h_tt(c)
hy_to = h_to(c)
total = nTT * hy_tt + nTO * hy_to
print_calc(nTT, nTO, c, hy_tt, hy_to, total)
total
end
def c_length(nTT, nTO)
100.to_f / ( nTT + nTO )
end
def h_tt(c)
Math.hypot(11.5, c)
end
def h_to(c)
Math.hypot(13, c)
end
def run
pairs = [
[1,1],
[1,2],
[2,2],
[2,3],
[3,3],
[3,4],
[4,4],
[4,5],
[5,5],
[5,6],
[6,6],
[6,7],
[7,7],
[7,8],
[8,8],
[8,9],
[9,9],
[9,10],
[10,10],
[10,11],
[11,11],
[11,12],
[12,12],
[12,13],
[13,13],
]
puts "nTT | nTO | cateto | h_tt | h_to | sum(h_tt + h_to)"
pairs.each do |n_tt, n_to|
calc(n_tt, n_to)
end; nil
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment