Last active
May 8, 2017 18:46
-
-
Save rcampbell/ebfaf9862ad25a0c3273b05c6e4d9810 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/*** ground ***/ | |
ha = 33.3; // hill angle in degrees | |
hl = 1600; // hill length in cm | |
hw = 2821; // hill width in cm | |
hh = sin(ha)*hl; // hill height in cm | |
hd = cos(ha)*hl; // hill depth in cm | |
color("ForestGreen") | |
union() { | |
// top | |
translate([0,hd,hh]) | |
cube([hw,1000,1]); | |
// hill | |
rotate(a=ha, v=[1,0,0]) | |
cube([hw,hl,1]); | |
// bottom | |
translate([0,-1000,0]) | |
cube([hw,1000,1]); | |
} | |
/*** path ***/ | |
pa = 9; // path angle in degrees | |
pl = hw; // path length in cm | |
pw = 200; // path width in cm | |
ph = 10; // path height (thickness) in cm | |
pr = sin(pa)*pl; // path rise | |
foo = tan(90-ha)*pr; // distance between the bottom of the path and the hill | |
bar = atan(foo/pl); // desired angle of the path on Z axis to stay tangent to the hill | |
color("SaddleBrown") | |
union() { | |
// top segment | |
translate([50,hd-pw-foo,hh-ph-pr]) // TODO fix this bunch of hacks | |
rotate(a=[0,-pa,bar]) | |
cube([pl,pw,ph]); | |
// bottom segment | |
translate([50,hd-pw-foo,hh-ph-pr]) // TODO fix this bunch of hacks | |
rotate(a=[0,pa,-bar]) | |
cube([pl,pw,ph]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment