Skip to content

Instantly share code, notes, and snippets.

@rcampbell
Last active May 8, 2017 18:46
Show Gist options
  • Save rcampbell/ebfaf9862ad25a0c3273b05c6e4d9810 to your computer and use it in GitHub Desktop.
Save rcampbell/ebfaf9862ad25a0c3273b05c6e4d9810 to your computer and use it in GitHub Desktop.
/*** 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]);
}
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment