From 50e1844caa552f7c27094826166b076597761115 Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Wed, 11 Dec 2024 15:12:26 -0500 Subject: [PATCH] clean up unsuccessful methods --- src/main.js | 86 ----------------------------------------------------- 1 file changed, 86 deletions(-) diff --git a/src/main.js b/src/main.js index 3c1826a..17a61a5 100644 --- a/src/main.js +++ b/src/main.js @@ -2774,92 +2774,6 @@ function stage() { let shape = new Shape(regionPoints[0].x, regionPoints[0].y, cxt) shape.fromPoints(points, 1) actions.addShape.create(context.activeObject, shape, cxt) - /* - for (let i in context.activeObject.currentFrame.shapes) { - let shape = context.activeObject.currentFrame.shapes[i] - for (let curve of shape.curves) { - let intersects = curve.intersects(line) - for (let intersect of intersects) { - let pos = curve.compute(intersect) - if (pos.x < min_x) { - curveB = curve - min_x = pos.x - point = intersect - } - } - } - } - let previousCurves = []; - let previousCurveIds = []; - if (curveB) { - previousCurves.push(curveB.toString()) - previousCurveIds.push(curveB.toString()) - let derivative = curveB.derivative(point) - // if curve is moving downward at intersection - let splitCurve = curveB.split(point) - let curveA; - if (derivative.y > 0) { - curveA = splitCurve.right - } else { - curveA = splitCurve.left.reverse() - } - // debugCurves.push(curveA) - for (let i=0; i<2; i++) { - - let min_intersect = Infinity - let nextCurve = undefined - for (let i in context.activeObject.currentFrame.shapes) { - let shape = context.activeObject.currentFrame.shapes[i] - for (let j of shape.quadtree.query(curveA.bbox())) { - let curve = shape.curves[j] - console.log(previousCurveIds) - console.log(curve.toString()) - console.log(curve==(previousCurves.length?previousCurves[0]:undefined)) - console.log(curve.toString()==(previousCurves.length?previousCurves[0].toString():undefined)) - if (previousCurves.indexOf(curve.toString()) != -1) { - console.log("skipping") - continue; - } - let intersects = curveA.intersects(curve) - // if (intersects.length > 4) continue; - console.log(intersects) - console.log(curve) - for (let intersect of intersects) { - intersect = intersect.split('/') - let intersect_a = parseFloat(intersect[0]) - let intersect_b = parseFloat(intersect[1]) - if (intersect_a < min_intersect) { - // console.log(curve) - min_intersect = intersect_a - nextCurve = curve - point = intersect_b - } - } - } - } - curveB = nextCurve - if (curveB) { - // debugCurves.push(curveB) - console.log(min_intersect) - let splitCurve = curveB.split(point) - let d_A = curveA.derivative(min_intersect) - let d_B = curveB.derivative(point) - curveA = curveA.split(min_intersect).left - debugCurves.push(curveA) - if ((d_A.x * d_B.y - d_A.y * d_B.x) < 0) { - curveA = splitCurve.left.reverse() - } else { - curveA = splitCurve.right - } - // debugCurves.push(curveB) - } else { - break - } - } - - // for (let) - } - */ break // Loop labels in JS! shapeLoop: