1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-13 18:24:28 +02:00

counter-clockwise

This commit is contained in:
Justin Lin
2021-04-18 10:49:45 +08:00
parent 97e2c50dee
commit 7b07fa981c
3 changed files with 4 additions and 3 deletions

View File

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

View File

@@ -6,5 +6,5 @@ function tri_delaunay_shapes(d) =
[ [
for(tri = hashmap_keys(delaunay_triangles(d))) for(tri = hashmap_keys(delaunay_triangles(d)))
if(tri[0] > 3 && tri[1] > 3 && tri[2] > 3) if(tri[0] > 3 && tri[1] > 3 && tri[2] > 3)
[coords[tri[0]], coords[tri[1]], coords[tri[2]]] [coords[tri[2]], coords[tri[1]], coords[tri[0]]] // counter-clockwise
]; ];

View File

@@ -3,6 +3,7 @@ use <_impl/_tri_delaunay_voronoi_impl.scad>;
use <util/map/hashmap.scad>; use <util/map/hashmap.scad>;
use <util/map/hashmap_keys.scad>; use <util/map/hashmap_keys.scad>;
use <util/map/hashmap_get.scad>; use <util/map/hashmap_get.scad>;
use <util/reverse.scad>;
function tri_delaunay_voronoi(d) = function tri_delaunay_voronoi(d) =
let( let(
@@ -42,7 +43,7 @@ function tri_delaunay_voronoi(d) =
]), ]),
cells = [ cells = [
for(i = [4:coords_leng - 1]) for(i = [4:coords_leng - 1])
indicesOfCell(connectedTris[i], triIndices) reverse(indicesOfCell(connectedTris[i], triIndices)) // counter-clockwise
] ]
) )
[for(cell = cells) [for(i = cell) vertices[i]]]; [for(cell = cells) [for(i = cell) vertices[i]]];