Skip to content

Instantly share code, notes, and snippets.

@K-Francis-H
Created November 23, 2020 19:46
Show Gist options
  • Select an option

  • Save K-Francis-H/18294f65f3049966b61d416631565d73 to your computer and use it in GitHub Desktop.

Select an option

Save K-Francis-H/18294f65f3049966b61d416631565d73 to your computer and use it in GitHub Desktop.
//given a list of 3 element vectors and the size for each node(cylinder diameter)
//this will generate a path going through each point. Especially useful for
//generating models from GPX and KML files for overlaying trail geometry on top
//of terrain
module tracePath(path, size){
for(i=[0:len(path)-1]){
if(i+1 < len(path)){
hull(){
translate(path[i])
cylinder(d=size);
translate(path[i+1])
cylinder(d=size);
}
}
}
}
//example usage:
list = [
[0,0,0],
[1,0,0],
[0,2,0],
[-3,0,0],
[0,-4,0],
[5,0,0],
[0,6,0],
[-7,0,0],
[0,-8,0],
[9,0,0]];
tracePath(list, 0.25);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment