mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-13 18:24:28 +02:00
refactor
This commit is contained in:
@@ -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);
|
@@ -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") =
|
||||
|
8
src/experimental/tri_delaunay_indices.scad
Normal file
8
src/experimental/tri_delaunay_indices.scad
Normal 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]
|
||||
];
|
10
src/experimental/tri_delaunay_shapes.scad
Normal file
10
src/experimental/tri_delaunay_shapes.scad
Normal 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]]]
|
||||
];
|
Reference in New Issue
Block a user