From 23ed306148a4436a5d8b852f765c2afd6dc76b0b Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Tue, 7 Sep 2021 15:59:11 +0800 Subject: [PATCH] performance improved --- src/voxel/vx_union.scad | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/voxel/vx_union.scad b/src/voxel/vx_union.scad index 34363212..a7ff6a28 100644 --- a/src/voxel/vx_union.scad +++ b/src/voxel/vx_union.scad @@ -8,6 +8,13 @@ * **/ +use <../__comm__/_pt3_hash.scad>; use <../util/dedup.scad>; -function vx_union(points1, points2) = dedup(concat(points1, points2)); \ No newline at end of file +function vx_union(points1, points2) = + let( + pts = concat(points1, points2), + number_of_buckets = ceil(sqrt(len(pts))), + hash = _pt3_hash(number_of_buckets) + ) + dedup(pts, hash = hash, number_of_buckets = number_of_buckets); \ No newline at end of file