From d85da1c3a3f39a372d7bfd7aab8ba9079ae7965f Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Fri, 15 Nov 2024 05:26:12 -0500 Subject: [PATCH] add hard edge simplification --- src/main.js | 69 ++++++++++++++++++++++++----------------------------- 1 file changed, 31 insertions(+), 38 deletions(-) diff --git a/src/main.js b/src/main.js index ba492a8..82a5957 100644 --- a/src/main.js +++ b/src/main.js @@ -10,7 +10,7 @@ let canvases = []; let mode = "draw" let minSegmentSize = 5; -let maxSmoothAngle = 0.2; +let maxSmoothAngle = 0.6; let tools = { select: { @@ -99,43 +99,36 @@ class Shape { } simplify(mode="smooth") { // Mode can be corners, smooth or auto - // let maxIndex; - // for (let j=0; j<5; j++) { - // if (this.curves.length < 3) return; - // maxIndex = this.curves.length-1; - // for (let i=1; i 3) { + angles = [2*Math.PI] + for (let i=1; i