better NaN detection

This commit is contained in:
Stewart Allen 2021-05-31 22:02:36 -04:00
commit c45a35956c
2 changed files with 7 additions and 1 deletions

View file

@ -166,6 +166,10 @@
return this.slice().sort().filter((x, i, a) => !i || x != a[i-1]);
};
AP.hasNaN = function() {
return this.filter(v => isNaN(v)).length > 0;
};
for(let i in AP){
Object.defineProperty(Array.prototype, i, {
value: AP[i],

View file

@ -525,7 +525,9 @@
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 (isNaN(cc.x)) console.log({cc, e1, e2, e3});
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 ];