1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-07 15:26:39 +02:00

Default to 1.

This commit is contained in:
Justin Lin
2021-02-14 10:45:47 +08:00
parent 09e3efdc05
commit ed22e229e4
4 changed files with 4 additions and 4 deletions

View File

@@ -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

View File

@@ -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.

View File

@@ -8,7 +8,7 @@
*
**/
module hull_polyline2d(points, width) {
module hull_polyline2d(points, width = 1) {
half_width = width / 2;
leng = len(points);

View File

@@ -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]);