clean up unsuccessful methods
This commit is contained in:
parent
4d1e42a38b
commit
50e1844caa
86
src/main.js
86
src/main.js
|
|
@ -2774,92 +2774,6 @@ function stage() {
|
||||||
let shape = new Shape(regionPoints[0].x, regionPoints[0].y, cxt)
|
let shape = new Shape(regionPoints[0].x, regionPoints[0].y, cxt)
|
||||||
shape.fromPoints(points, 1)
|
shape.fromPoints(points, 1)
|
||||||
actions.addShape.create(context.activeObject, shape, cxt)
|
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
|
break
|
||||||
// Loop labels in JS!
|
// Loop labels in JS!
|
||||||
shapeLoop:
|
shapeLoop:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue