From bb391fb505b9e080f127c43e85cc7651be16f07f Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Fri, 18 Dec 2020 10:00:51 +0800 Subject: [PATCH] add doc --- README.md | 2 +- docs/lib2x-vx_contour.md | 35 +++++++++++++++++++++++++++++++++++ src/voxel/vx_contour.scad | 10 ++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 docs/lib2x-vx_contour.md diff --git a/README.md b/README.md index 7769fd0d..b311fe20 100644 --- a/README.md +++ b/README.md @@ -243,7 +243,7 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp - [vx_bezier](https://openhome.cc/eGossip/OpenSCAD/lib2x-vx_bezier.html) - [vx_curve](https://openhome.cc/eGossip/OpenSCAD/lib2x-vx_curve.html) -- vx_contour +- [vx_contour](https://openhome.cc/eGossip/OpenSCAD/lib2x-vx_contour.html) ### Maze diff --git a/docs/lib2x-vx_contour.md b/docs/lib2x-vx_contour.md new file mode 100644 index 00000000..f8aba308 --- /dev/null +++ b/docs/lib2x-vx_contour.md @@ -0,0 +1,35 @@ +# vx_contour + +Given a list of points that form a closed area, `vx_contour` returns the contour which encircles the area. + +## Parameters + +- `points` : A list of `[x, y]` points. +- `sorted` : Default to `false`. If your points is sorted by x y, setting it to `true` will accelerate the calculation speed. + +## Examples + + use ; + use ; + + t = "dotSCAD"; + + color("white") + linear_extrude(2) + for(i = [0:len(t) - 1]) { + translate([i * 8, 0]) + for(pt = vx_ascii(t[i])) { + translate(pt) + square(1, center = true); + } + } + + color("black") + linear_extrude(1) + for(i = [0:len(t) - 1]) { + pts = vx_ascii(t[i]); + translate([i * 8, 0]) + polygon(vx_contour(pts)); + } + +![vx_curve](images/lib2x-vx_contour-1.JPG) diff --git a/src/voxel/vx_contour.scad b/src/voxel/vx_contour.scad index ae808c63..de8192c3 100644 --- a/src/voxel/vx_contour.scad +++ b/src/voxel/vx_contour.scad @@ -1,3 +1,13 @@ +/** +* vx_contour.scad +* +* @copyright Justin Lin, 2020 +* @license https://opensource.org/licenses/lgpl-3.0.html +* +* @see https://openhome.cc/eGossip/OpenSCAD/lib2x-vx_contour.html +* +**/ + use <_impl/_vx_contour_impl.scad>; use ;