Last active
August 29, 2015 14:07
-
-
Save fukajun/2680b546ab74590cf2cf to your computer and use it in GitHub Desktop.
テーブルを自作するときの角度のある脚の設置位置を計算
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 家のテーブルを作成するときの | |
# 脚の設置位置を計算するためのスクリプト | |
# 変わりそうな値は定数にしてる | |
module Math | |
def self.radians(degree) | |
degree * Math::PI / 180 | |
end | |
end | |
# | |
# c ∠ | b | |
# a | |
# テーブルの脚の角度 | |
SLOPE_DEG = 7 # cbの角度 | |
# テーブルの脚の太さ(直径) | |
LEG_DIA = 30 | |
# 脚の半径 | |
r = LEG_DIA / 2.0 | |
# テーブルの脚の高さ(mm) | |
b = 550 | |
# どれくらい脚がはみ出すか | |
a = (Math.tan(Math.radians(SLOPE_DEG)) * b).round | |
puts "どれくらいはみ出るか: #{a}mm" | |
# テーブルの端からどれくらいの場所に取り付けると傾いている脚がはみ出さないか? | |
# cos(45度) = x/a | |
len = (Math.cos(Math.radians(45)) * a).round | |
# ↓ ココの長さ | |
# | ̄ ̄ ̄ ̄ ̄ ̄| ̄ ̄ ̄ ̄ | |
# | | | |
# | | | |
# | | | |
# | ◯| ← 脚の根本 | |
# | ̄  ̄ ̄ ̄ ̄ | |
# | | |
puts "脚の根本はタテ・ヨコそれぞれ:#{len + r * 2}mm のところに設置" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment