fixed case where arcQ.center could be undefined
This commit is contained in:
parent
1c25bb22f3
commit
7959cc08f2
1 changed files with 8 additions and 1 deletions
|
|
@ -527,6 +527,7 @@
|
||||||
let e3 = arcQ[el-1]; // last in arcQ
|
let e3 = arcQ[el-1]; // last in arcQ
|
||||||
let cc = BASE.util.center2d(e1, e2, e3, 1); // find center
|
let cc = BASE.util.center2d(e1, e2, e3, 1); // find center
|
||||||
let dc = 0;
|
let dc = 0;
|
||||||
|
|
||||||
if (cc) {
|
if (cc) {
|
||||||
if ([cc.x,cc.y,cc.z,cc.r].hasNaN()) {
|
if ([cc.x,cc.y,cc.z,cc.r].hasNaN()) {
|
||||||
console.log({cc, e1, e2, e3});
|
console.log({cc, e1, e2, e3});
|
||||||
|
|
@ -546,7 +547,13 @@
|
||||||
if (arcQ.length === 4) {
|
if (arcQ.length === 4) {
|
||||||
// not enough points for an arc, drop first point and recalc center
|
// not enough points for an arc, drop first point and recalc center
|
||||||
emitQrec(arcQ.shift());
|
emitQrec(arcQ.shift());
|
||||||
arcQ.center = [ BASE.util.center2d(arcQ[0], arcQ[1], arcQ[2], 1) ];
|
let tc = [ BASE.util.center2d(arcQ[0], arcQ[1], arcQ[2], 1) ];
|
||||||
|
// the new center is invalid as well. drop the first point
|
||||||
|
if (!tc) {
|
||||||
|
emitQrec(arcQ.shift());
|
||||||
|
} else {
|
||||||
|
arcQ.center = [ tc ];
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// enough to consider an arc, emit and start new arc
|
// enough to consider an arc, emit and start new arc
|
||||||
let defer = arcQ.pop();
|
let defer = arcQ.pop();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue