fixed behavior for finding center of undefined circles
This commit is contained in:
parent
ab9fb3c2f1
commit
cce1c58645
1 changed files with 5 additions and 2 deletions
|
|
@ -321,12 +321,15 @@
|
|||
*/
|
||||
function circleCenter(A,B,C)
|
||||
{
|
||||
let denominator = 2*determinant33([[A.x, A.y, 1], [B.x, B.y, 1], [C.x, C.y, 1]]);
|
||||
let xmat = [[A.x*A.x + A.y*A.y, A.y, 1],[B.x*B.x + B.y*B.y, B.y, 1],[C.x*C.x + C.y*C.y, C.y, 1]];
|
||||
let ymat = [[A.y, A.x*A.x + A.y*A.y, 1],[B.y, B.x*B.x + B.y*B.y, 1],[C.y, C.x*C.x + C.y*C.y, 1]];
|
||||
|
||||
let center = {x:determinant33(xmat), y:determinant33(ymat), z:A.z};
|
||||
let center = {x:determinant33(xmat)/denominator, y:determinant33(ymat)/denominator, z:A.z};
|
||||
|
||||
return center;
|
||||
if (denominator !== 0) {
|
||||
return center;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue