diff --git a/docs/images/lib-midpt_smooth-1.JPG b/docs/images/lib-midpt_smooth-1.JPG new file mode 100644 index 00000000..1754bc19 Binary files /dev/null and b/docs/images/lib-midpt_smooth-1.JPG differ diff --git a/docs/lib-midpt_smooth.md b/docs/lib-midpt_smooth.md new file mode 100644 index 00000000..862cff89 --- /dev/null +++ b/docs/lib-midpt_smooth.md @@ -0,0 +1,26 @@ +# midpt_smooth + +Given a 2D path, this function constructs a mid-point smoothed version by joining the mid-points of the lines of the path. + +**Since:** 1.3 + +## Parameters + +- `points` : The path points. +- `n` : Perform mid-point smoothing n times. +- `closed` : Is the points a 2D shape? If it's `true`, the function takes the last point and the first one to calculate a middle point. Default to `false`. + +## Examples + + include ; + include ; + include ; + include ; + + taiwan = shape_taiwan(50); + smoothed = midpt_smooth(taiwan, 20, true); + + translate([0, 0, 0]) hull_polyline2d(taiwan, .25); + #translate([10, 0, 0]) hull_polyline2d(smoothed, .25); + +![midpt_smooth](images/lib-midpt_smooth-1.JPG) \ No newline at end of file diff --git a/undocumented_features/midpt_smooth_demo.scad b/undocumented_features/midpt_smooth_demo.scad deleted file mode 100644 index 769d0411..00000000 --- a/undocumented_features/midpt_smooth_demo.scad +++ /dev/null @@ -1,14 +0,0 @@ -include ; -include ; -include ; -include ; - - - -taiwan = shape_taiwan(100, .5); -sm = midpt_smooth(taiwan, 1, true); - -*translate([10, 0, 0]) hull_polyline2d(shape_taiwan(100), .1); -translate([10, 0, 0]) hull_polyline2d(sm, .1); - -echo(len(taiwan)); \ No newline at end of file diff --git a/undocumented_features/undocumented_note.md b/undocumented_features/undocumented_note.md index 2103fbc7..4130e55f 100644 --- a/undocumented_features/undocumented_note.md +++ b/undocumented_features/undocumented_note.md @@ -1,6 +1,3 @@ -midpt_smooth - midpt_smooth.scad - trim_shape trim_shape_demo.scad