mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-17 04:04:16 +02:00
refactor: use hashset
This commit is contained in:
@@ -8,14 +8,16 @@
|
||||
*
|
||||
**/
|
||||
|
||||
use <../util/sort.scad>;
|
||||
use <../util/has.scad>;
|
||||
use <../util/set/hashset.scad>;
|
||||
use <../util/set/hashset_has.scad>;
|
||||
use <../__comm__/_pt3_hash.scad>;
|
||||
|
||||
function vx_intersection(points1, points2) =
|
||||
let(
|
||||
leng1 = len(points1),
|
||||
leng2 = len(points2),
|
||||
pts_pair = leng1 > leng2 ? [points1, points2] : [points2, points1],
|
||||
sorted = sort(pts_pair[1], by = "vt")
|
||||
hash = function(p) _pt3_hash(p),
|
||||
sorted = hashset(pts_pair[1], hash = hash)
|
||||
)
|
||||
[for(p = pts_pair[0]) if(has(sorted, p, sorted = true)) p];
|
||||
[for(p = pts_pair[0]) if(hashset_has(sorted, p, hash = hash)) p];
|
Reference in New Issue
Block a user