stop gap until new function is ready
This commit is contained in:
parent
c45a35956c
commit
177517778c
2 changed files with 42 additions and 33 deletions
|
|
@ -525,35 +525,40 @@
|
|||
let e2 = arcQ[el-2]; // second last in arcQ
|
||||
let e3 = arcQ[el-1]; // last in arcQ
|
||||
let cc = BASE.util.center2d(e1, e2, e3, 1); // find center
|
||||
if ([cc.x,cc.y,cc.z,cc.r].hasNaN()) {
|
||||
console.log({cc, e1, e2, e3});
|
||||
}
|
||||
let dc = 0;
|
||||
if (arcQ.length === 3) {
|
||||
arcQ.center = [ cc ];
|
||||
} else {
|
||||
// check center point delta
|
||||
let dx = cc.x - arcQ.center[0].x;
|
||||
let dy = cc.y - arcQ.center[0].y;
|
||||
dc = Math.sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
// if new point is off the arc
|
||||
if (deem || depm || desp || dc > arcDist || cc.r >= arcMax) {
|
||||
// console.log({dc, depm, desp});
|
||||
if (arcQ.length === 4) {
|
||||
// not enough points for an arc, drop first point and recalc center
|
||||
emitQrec(arcQ.shift());
|
||||
arcQ.center = [ BASE.util.center2d(arcQ[0], arcQ[1], arcQ[2], 1) ];
|
||||
if (cc) {
|
||||
if ([cc.x,cc.y,cc.z,cc.r].hasNaN()) {
|
||||
console.log({cc, e1, e2, e3});
|
||||
}
|
||||
if (arcQ.length === 3) {
|
||||
arcQ.center = [ cc ];
|
||||
} else {
|
||||
// enough to consider an arc, emit and start new arc
|
||||
let defer = arcQ.pop();
|
||||
drainQ();
|
||||
// re-add point that was off the last arc
|
||||
arcQ.push(defer);
|
||||
// check center point delta
|
||||
let dx = cc.x - arcQ.center[0].x;
|
||||
let dy = cc.y - arcQ.center[0].y;
|
||||
dc = Math.sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
// if new point is off the arc
|
||||
if (deem || depm || desp || dc > arcDist || cc.r >= arcMax) {
|
||||
// console.log({dc, depm, desp});
|
||||
if (arcQ.length === 4) {
|
||||
// not enough points for an arc, drop first point and recalc center
|
||||
emitQrec(arcQ.shift());
|
||||
arcQ.center = [ BASE.util.center2d(arcQ[0], arcQ[1], arcQ[2], 1) ];
|
||||
} else {
|
||||
// enough to consider an arc, emit and start new arc
|
||||
let defer = arcQ.pop();
|
||||
drainQ();
|
||||
// re-add point that was off the last arc
|
||||
arcQ.push(defer);
|
||||
}
|
||||
} else {
|
||||
// new point is on the arc
|
||||
arcQ.center.push(cc);
|
||||
}
|
||||
} else {
|
||||
// new point is on the arc
|
||||
arcQ.center.push(cc);
|
||||
// drainQ on invalid center
|
||||
drainQ();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue