mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-07 15:26:39 +02:00
refactor
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
use <ptf/ptf_rotate.scad>;
|
use <ptf/ptf_rotate.scad>;
|
||||||
|
|
||||||
function _default_region_size(points) =
|
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]);
|
max([(max(xs) - min(xs) / 2), (max(ys) - min(ys)) / 2]);
|
||||||
|
|
||||||
function _cells_lt_before_intersection(shape, size, points, pt) =
|
function _cells_lt_before_intersection(shape, size, points, pt, half_region_size) =
|
||||||
let(half_region_size = 0.5 * size)
|
|
||||||
[
|
[
|
||||||
for(p = points)
|
for(p = points)
|
||||||
if(pt != p)
|
if(pt != p)
|
||||||
|
@@ -5,10 +5,11 @@ use <shape_square.scad>;
|
|||||||
function voronoi_cells(points) =
|
function voronoi_cells(points) =
|
||||||
let(
|
let(
|
||||||
size = _default_region_size(points),
|
size = _default_region_size(points),
|
||||||
|
half_size = size * 0.5,
|
||||||
shape = shape_square(size),
|
shape = shape_square(size),
|
||||||
regions_lt = [
|
regions_lt = [
|
||||||
for(p = points)
|
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