1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-01 04:20:27 +02:00
This commit is contained in:
Justin Lin
2020-04-03 17:40:27 +08:00
parent fe6b207e91
commit 72b3bcab2e
2 changed files with 3 additions and 4 deletions

View File

@@ -1,4 +1,3 @@
use <ptf/ptf_rotate.scad>;
function _default_region_size(points) =
@@ -8,8 +7,7 @@ function _default_region_size(points) =
)
max([(max(xs) - min(xs) / 2), (max(ys) - min(ys)) / 2]);
function _cells_lt_before_intersection(shape, size, points, pt) =
let(half_region_size = 0.5 * size)
function _cells_lt_before_intersection(shape, size, points, pt, half_region_size) =
[
for(p = points)
if(pt != p)

View File

@@ -5,10 +5,11 @@ use <shape_square.scad>;
function voronoi_cells(points) =
let(
size = _default_region_size(points),
half_size = size * 0.5,
shape = shape_square(size),
regions_lt = [
for(p = points)
_cells_lt_before_intersection(shape, size, points, p)
_cells_lt_before_intersection(shape, size, points, p, half_size)
]
)
[