Created
November 23, 2020 19:46
-
-
Save K-Francis-H/18294f65f3049966b61d416631565d73 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
| //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