diff --git a/docs/lib3x-hull_polyline2d.md b/docs/lib3x-hull_polyline2d.md index 7b50f7b1..db6437c4 100644 --- a/docs/lib3x-hull_polyline2d.md +++ b/docs/lib3x-hull_polyline2d.md @@ -5,7 +5,7 @@ Creates a 2D polyline from a list of `[x, y]` coordinates. As the name says, it ## Parameters - `points` : The list of `[x, y]` points of the polyline. The points are indexed from 0 to n-1. -- `width` : The line width. +- `width` : The line width. Default to 1. - `$fa`, `$fs`, `$fn` : Check [the circle module](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#circle) for more details. ## Examples diff --git a/docs/lib3x-line2d.md b/docs/lib3x-line2d.md index 64cc7524..ec1bbfd2 100644 --- a/docs/lib3x-line2d.md +++ b/docs/lib3x-line2d.md @@ -6,7 +6,7 @@ Creates a line from two points. When the end points are `CAP_ROUND`, you can use - `p1` : 2 element vector `[x, y]`. - `p2` : 2 element vector `[x, y]`. -- `width` : The line width. +- `width` : The line width. Default to 1. - `p1Style` : The end-cap style of the point `p1`. The value must be `"CAP_BUTT"`, `"CAP_SQUARE"` or `"CAP_ROUND"`. The default value is `"CAP_SQUARE"`. - `p2Style` : The end-cap style of the point `p2`. The value must be `"CAP_BUTT"`, `"CAP_SQUARE"` or `"CAP_ROUND"`. The default value is `"CAP_SQUARE"`. - `$fa`, `$fs`, `$fn` : Check [the circle module](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#circle) for more details. The final fragments of a circle will be a multiple of 4 to fit edges. diff --git a/src/hull_polyline2d.scad b/src/hull_polyline2d.scad index 50136d42..bf8c5838 100644 --- a/src/hull_polyline2d.scad +++ b/src/hull_polyline2d.scad @@ -8,7 +8,7 @@ * **/ -module hull_polyline2d(points, width) { +module hull_polyline2d(points, width = 1) { half_width = width / 2; leng = len(points); diff --git a/src/line2d.scad b/src/line2d.scad index 55cf6ca0..0f6b7b83 100644 --- a/src/line2d.scad +++ b/src/line2d.scad @@ -11,7 +11,7 @@ use <__comm__/__frags.scad>; use <__comm__/__nearest_multiple_of_4.scad>; -module line2d(p1, p2, width, p1Style = "CAP_SQUARE", p2Style = "CAP_SQUARE") { +module line2d(p1, p2, width = 1, p1Style = "CAP_SQUARE", p2Style = "CAP_SQUARE") { half_width = 0.5 * width; atan_angle = atan2(p2[1] - p1[1], p2[0] - p1[0]);