From ab2e2f7987244c89365504e5190056f7074b74a5 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Mon, 21 Jan 2019 17:26:58 -0500 Subject: [PATCH] add another level of point filtering/reduction --- js/geo-gyroid.js | 37 +++++++++++++++++++++++++++++++++++-- js/license.js | 2 +- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/js/geo-gyroid.js b/js/geo-gyroid.js index 32666b22..824d7d09 100644 --- a/js/geo-gyroid.js +++ b/js/geo-gyroid.js @@ -139,10 +139,11 @@ var gs_base_gyroid = exports; } while (added); } while (cleared < sparse.length); - return {edge, points, dir, polys: polys.map(poly => filter(poly))}; + return {edge, points, dir, polys: polys.map(poly => filter(poly,inc))}; } - function filter(poly) { + // merge x/y co-linear + function filter(poly,inc) { if (poly.length === 1) { return poly; } @@ -169,6 +170,38 @@ var gs_base_gyroid = exports; } e1 = el; } + return filter2(nuchain,inc); + } + + // merge points within radius + function filter2(poly,inc) { + if (poly.length === 1) { + return poly; + } + let nuchain = []; + let e1 = poly[0]; + let e2 = null; + let last = poly.length - 1; + let merge = inc; + for (let i=1; i - All Rights Reserved", LICENSE:"See the license.md file included with the source distribution", - VERSION:"1.2.6a" + VERSION:"1.2.6b" }; if (!module) var module = {}; module.exports = exports;