1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-04-20 06:02:05 +02:00
This commit is contained in:
Justin Lin 2019-06-04 17:54:14 +08:00
parent dd90b4c106
commit 0b4d1e3840
4 changed files with 42 additions and 26 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

42
docs/lib-triangulate.md Normal file
View File

@ -0,0 +1,42 @@
# triangulate
Given a 2D shape. This function performs a simple polygon triangulation algorithm and returns the indices of each triangle.
**Since:** 1.3.
## Parameters
- `shape_pts` : The shape points.
- `epsilon` : An upper bound on the relative error due to rounding in floating point arithmetic. Default to 0.0001.
## Examples
include <triangulate.scad>;
shape = [
[0, 0],
[10, 0],
[12, 5],
[5, 10],
[10, 15],
[0, 20],
[-5, 18],
[-18, 3],
[-4, 10]
];
tris = triangulate(shape);
difference() {
polygon(shape);
for(tri = tris) {
offset(-.2)
polygon([for(idx = tri) shape[idx]]);
}
}
![triangulate](images/lib-triangulate-1.JPG)

View File

@ -1,23 +0,0 @@
include <triangulate.scad>;
shape = [
[0, 0],
[10, 0],
[12, 5],
[5, 10],
[10, 15],
[0, 20],
[-5, 18],
[-8, 3],
[-4, 10]
];
tris = triangulate(shape);
polygon(shape);
for(tri = tris) {
#offset(-.1)
polygon([for(idx = tri) shape[idx]]);
}

View File

@ -1,6 +1,3 @@
triangulate
triangulate_demo.scad
shape_taiwan: new `dt` parameter
bijection_offset: new `epsilon` parameter