2017-06-01 13:14:50 +08:00
# paths2sections
2020-06-27 10:45:34 +08:00
Given a list of paths, this function will return all cross-sections described by those paths. Combined with the `sweep` module, you can describe a more complex model.
2017-06-01 13:14:50 +08:00
You paths should be indexed count-clockwisely.
## Parameters
- `paths` : A list of paths used to describe the surface of the model.
## Examples
2020-01-28 17:51:20 +08:00
use < paths2sections.scad > ;
2021-12-04 10:57:29 +08:00
use < polyline_join.scad > ;
2020-06-27 10:45:34 +08:00
use < sweep.scad > ;
2017-06-01 13:14:50 +08:00
paths = [
[[5, 0, 5], [15, 10, 10], [25, 20, 5]],
[[-5, 0, 5], [-15, 10, 10], [-25, 20, 5]],
[[-5, 0, -5], [-15, 10, -10], [-25, 20, -5]],
[[5, 0, -5], [15, 10, -10], [25, 20, -5]]
];
sections = paths2sections(paths);
2020-06-27 10:45:34 +08:00
sweep(sections);
2017-06-01 13:14:50 +08:00
#for (path = paths) {
2021-12-04 10:57:29 +08:00
polyline_join(path)
sphere(.25);
2017-06-01 13:14:50 +08:00
}
2021-02-24 21:09:54 +08:00
![paths2sections ](images/lib3x-paths2sections-1.JPG )
2017-06-01 13:14:50 +08:00
2020-01-28 17:51:20 +08:00
use < bezier_curve.scad > ;
use < paths2sections.scad > ;
2021-12-04 10:57:29 +08:00
use < polyline_join.scad > ;
2020-06-27 10:45:34 +08:00
use < sweep.scad > ;
2017-06-01 13:14:50 +08:00
t_step = 0.05;
paths = [
bezier_curve(t_step,
[[1.25, 0, 5], [5, 20, 5], [16, 20, -2], [18, 20, 10], [30, 15, 8]]
),
bezier_curve(t_step,
[[-1.25, 0, 5], [0, 20, 5], [16, 22, -2], [18, 20, 10], [30, 25, 8]]
),
bezier_curve(t_step,
[[-1.25, 0, -5], [0, 20, -5], [16, 20, 1], [18, 27, -3], [20, 27, -5]]
),
bezier_curve(t_step,
[[1.25, 0, -5], [5, 20, -5], [16, 20, 1], [18, 17.5, -3], [20, 17.5, -5]]
)
];
sections = paths2sections(paths);
2020-06-27 10:45:34 +08:00
sweep(sections);
2017-06-01 13:14:50 +08:00
#for (path = paths) {
2021-12-04 10:57:29 +08:00
polyline_join(path)
sphere(.25);
2017-06-01 13:14:50 +08:00
}
2021-02-24 21:09:54 +08:00
![paths2sections ](images/lib3x-paths2sections-2.JPG )