mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-08 07:46:39 +02:00
Default to 1.
This commit is contained in:
@@ -5,7 +5,7 @@ Creates a 2D polyline from a list of `[x, y]` coordinates. As the name says, it
|
|||||||
## Parameters
|
## Parameters
|
||||||
|
|
||||||
- `points` : The list of `[x, y]` points of the polyline. The points are indexed from 0 to n-1.
|
- `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.
|
- `$fa`, `$fs`, `$fn` : Check [the circle module](https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Using_the_2D_Subsystem#circle) for more details.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
@@ -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]`.
|
- `p1` : 2 element vector `[x, y]`.
|
||||||
- `p2` : 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"`.
|
- `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"`.
|
- `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.
|
- `$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.
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
module hull_polyline2d(points, width) {
|
module hull_polyline2d(points, width = 1) {
|
||||||
half_width = width / 2;
|
half_width = width / 2;
|
||||||
leng = len(points);
|
leng = len(points);
|
||||||
|
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
use <__comm__/__frags.scad>;
|
use <__comm__/__frags.scad>;
|
||||||
use <__comm__/__nearest_multiple_of_4.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;
|
half_width = 0.5 * width;
|
||||||
|
|
||||||
atan_angle = atan2(p2[1] - p1[1], p2[0] - p1[0]);
|
atan_angle = atan2(p2[1] - p1[1], p2[0] - p1[0]);
|
||||||
|
Reference in New Issue
Block a user