1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 18:24:28 +02:00
This commit is contained in:
Justin Lin
2021-04-17 18:07:05 +08:00
parent 5ba4a37089
commit 99f260b372
4 changed files with 22 additions and 16 deletions

View File

@@ -198,18 +198,4 @@ function delBadTriangles(d, badTriangles) =
function _tri_delaunay(d, points, leng, i = 0) =
i == leng ? d :
_tri_delaunay(delaunay_addpoint(d, points[i]), points, leng, i + 1);
function tri_delaunay_shapes(d) =
let(coords = delaunay_coords(d))
[
for(tri = hashmap_keys(delaunay_triangles(d)))
if(tri[0] > 3 && tri[1] > 3 && tri[2] > 3)
[coords[tri[0]], coords[tri[1]], coords[tri[2]]]
];
function tri_delaunay_indices(d) = [
for(tri = hashmap_keys(delaunay_triangles(d)))
if(tri[0] > 3 && tri[1] > 3 && tri[2] > 3)
[tri[0] - 4, tri[1] - 4, tri[2] - 4]
];
_tri_delaunay(delaunay_addpoint(d, points[i]), points, leng, i + 1);

View File

@@ -1,4 +1,6 @@
use <experimental/_impl/_tri_delaunay_impl.scad>;
use <_impl/_tri_delaunay_impl.scad>;
use <tri_delaunay_shapes.scad>;
use <tri_delaunay_indices.scad>;
// ret: "TRI_SHAPES", "TRI_INDICES", "DELAUNAY"
function tri_delaunay(points, ret = "TRI_SHAPES") =

View File

@@ -0,0 +1,8 @@
use <_impl/_tri_delaunay_comm_impl.scad>;
use <util/map/hashmap_keys.scad>;
function tri_delaunay_indices(d) = [
for(tri = hashmap_keys(delaunay_triangles(d)))
if(tri[0] > 3 && tri[1] > 3 && tri[2] > 3)
[tri[0] - 4, tri[1] - 4, tri[2] - 4]
];

View File

@@ -0,0 +1,10 @@
use <_impl/_tri_delaunay_comm_impl.scad>;
use <util/map/hashmap_keys.scad>;
function tri_delaunay_shapes(d) =
let(coords = delaunay_coords(d))
[
for(tri = hashmap_keys(delaunay_triangles(d)))
if(tri[0] > 3 && tri[1] > 3 && tri[2] > 3)
[coords[tri[0]], coords[tri[1]], coords[tri[2]]]
];