forked from JustinSDK/dotSCAD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
polyline_join.scad
46 lines (42 loc) · 961 Bytes
/
polyline_join.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* polyline_join.scad
*
* @copyright Justin Lin, 2021
* @license https://opensource.org/licenses/lgpl-3.0.html
*
* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-polyline_join.html
*
**/
module polyline_join(points) {
leng = len(points);
module hull_line(index) {
hull() {
translate(points[index])
children();
translate(points[index 1])
children();
}
}
module hull_line2(index) {
hull() {
translate(points[index])
children(0);
translate(points[index 1])
children(1);
}
}
if($children == 1) {
for(i = [0:leng - 2]) {
hull_line(i)
children();
}
}
else {
for(i = [0:min(leng, $children) - 2]) {
hull_line2(i) {
children(i);
children(i 1);
}
}
}
}