diff --git a/docs/images/lib-paths2sections-1.JPG b/docs/images/lib-paths2sections-1.JPG new file mode 100644 index 00000000..bb8c1716 Binary files /dev/null and b/docs/images/lib-paths2sections-1.JPG differ diff --git a/docs/images/lib-paths2sections-2.JPG b/docs/images/lib-paths2sections-2.JPG new file mode 100644 index 00000000..a0a3e8c6 Binary files /dev/null and b/docs/images/lib-paths2sections-2.JPG differ diff --git a/docs/lib-paths2sections.md b/docs/lib-paths2sections.md new file mode 100644 index 00000000..91f8794c --- /dev/null +++ b/docs/lib-paths2sections.md @@ -0,0 +1,65 @@ +# paths2sections + +Given a list of paths, this function will return all cross-sections described by those paths. Combined with the `polysections` module, you can describe a more complex model. + +You paths should be indexed count-clockwisely. + +## Parameters + +- `paths` : A list of paths used to describe the surface of the model. + +## Examples + + include ; + include ; + include ; + + 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); + + polysections(sections); + + #for(path = paths) { + hull_polyline3d(path, 0.5); + } + +![paths2sections](images/lib-paths2sections-1.JPG) + + include ; + include ; + include ; + include ; + + 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); + + polysections(sections); + + #for(path = paths) { + hull_polyline3d(path, 0.5); + } + +![paths2sections](images/lib-paths2sections-2.JPG)