mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-01 04:20:27 +02:00
refactor
This commit is contained in:
@@ -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)
|
||||
|
@@ -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)
|
||||
]
|
||||
)
|
||||
[
|
||||
|
Reference in New Issue
Block a user