(B, p)
| 137975 | return e; |
| 137976 | }; |
| 137977 | function extendBasis(B, p) { |
| 137978 | var i, j; |
| 137979 | if (enclosesWeakAll(p, B)) return [ |
| 137980 | p |
| 137981 | ]; |
| 137982 | // If we get here then B must have at least one element. |
| 137983 | for(i = 0; i < B.length; ++i){ |
| 137984 | if (enclosesNot(p, B[i]) && enclosesWeakAll(encloseBasis2(B[i], p), B)) return [ |
| 137985 | B[i], |
| 137986 | p |
| 137987 | ]; |
| 137988 | } |
| 137989 | // If we get here then B must have at least two elements. |
| 137990 | for(i = 0; i < B.length - 1; ++i)for(j = i + 1; j < B.length; ++j){ |
| 137991 | if (enclosesNot(encloseBasis2(B[i], B[j]), p) && enclosesNot(encloseBasis2(B[i], p), B[j]) && enclosesNot(encloseBasis2(B[j], p), B[i]) && enclosesWeakAll(encloseBasis3(B[i], B[j], p), B)) return [ |
| 137992 | B[i], |
| 137993 | B[j], |
| 137994 | p |
| 137995 | ]; |
| 137996 | } |
| 137997 | // If we get here then something is very wrong. |
| 137998 | throw new Error; |
| 137999 | } |
| 138000 | function enclosesNot(a, b) { |
| 138001 | var dr = a.r - b.r, dx = b.x - a.x, dy = b.y - a.y; |
| 138002 | return dr < 0 || dr * dr < dx * dx + dy * dy; |
no test coverage detected