1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-04-20 22:21:52 +02:00

we don't have to mod nums_of_buckets

This commit is contained in:
Justin Lin 2021-09-16 07:50:37 +08:00
parent b1b61fddbf
commit fbc07cec80
3 changed files with 3 additions and 9 deletions

View File

@ -1,2 +1 @@
function _pt3_hash(number_of_buckets) =
function(p) floor(abs(p * [73856093, 19349669, 83492791])) % number_of_buckets;
function _pt3_hash(p) = floor(abs(p * [73856093, 19349669, 83492791]));

View File

@ -21,7 +21,7 @@ function _geom_icosahedron(icosahedron_points, icosahedron_faces, tris, radius,
each [for(t = tri_subdivide(tri, detail)) each t]
],
number_of_buckets = ceil(sqrt(len(points)) * 1.5),
hash = _pt3_hash(number_of_buckets),
hash = function(p) _pt3_hash(p),
leng = len(points),
m_pts = _pimap_pts(
radius,

View File

@ -12,9 +12,4 @@ use <../__comm__/_pt3_hash.scad>;
use <../util/dedup.scad>;
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);
dedup(concat(points1, points2), hash = function(p) _pt3_hash(p));