mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-19 13:01:37 +02:00
always use square
This commit is contained in:
@@ -6,17 +6,7 @@ xs1 = rands(-20, 20, 15);
|
||||
ys1 = rands(-20, 20, 15);
|
||||
points = [for(i = [0:len(xs1) - 1]) [xs1[i], ys1[i]]];
|
||||
|
||||
function default_region_size(points) =
|
||||
let(
|
||||
xs = [for(p = points) p[0]],
|
||||
ys = [for(p = points) abs(p[1])]
|
||||
)
|
||||
max([(max(xs) - min(xs) / 2), (max(ys) - min(ys)) / 2]);
|
||||
|
||||
size = default_region_size(points);
|
||||
region_shape = shape_square(size, corner_r = size / 10);
|
||||
|
||||
cells = voronoi_cells(points, region_shape);
|
||||
cells = voronoi_cells(points);
|
||||
for(i = [0:len(points) - 1]) {
|
||||
pt = points[i];
|
||||
cell = cells[i];
|
||||
|
@@ -2,10 +2,10 @@ use <experimental/_impl/_voronoi2d_cells_impl.scad>;
|
||||
use <experimental/convex_intersection_for.scad>;
|
||||
use <shape_square.scad>;
|
||||
|
||||
function voronoi_cells(points, region_shape) =
|
||||
function voronoi_cells(points) =
|
||||
let(
|
||||
size = _default_region_size(points),
|
||||
shape = is_undef(region_shape) ? shape_square(size) : region_shape,
|
||||
shape = shape_square(size),
|
||||
regions_lt = [
|
||||
for(p = points)
|
||||
_cells_lt_before_intersection(shape, size, points, p)
|
||||
|
Reference in New Issue
Block a user