// x_0 = +m_12 / (2 m_11)
// y_0 = -m_13 / (2 m_11)
// Note that the minors m_11, m_12 and m_13 all have the last column
// filled with 1.0, hence simplifying the computation
final BigFraction[] c2 = new BigFraction[] {
new BigFraction(vA.getX()), new BigFraction(vB.getX()), new BigFraction(vC.getX())
};
final BigFraction[] c3 = new BigFraction[] {
new BigFraction(vA.getY()), new BigFraction(vB.getY()), new BigFraction(vC.getY())
};
final BigFraction[] c1 = new BigFraction[] {
c2[0].multiply(c2[0]).add(c3[0].multiply(c3[0])),
c2[1].multiply(c2[1]).add(c3[1].multiply(c3[1])),
c2[2].multiply(c2[2]).add(c3[2].multiply(c3[2]))
};
final BigFraction twoM11 = minor(c2, c3).multiply(2);
final BigFraction m12 = minor(c1, c3);
final BigFraction m13 = minor(c1, c2);
final BigFraction centerX = m12.divide(twoM11);
final BigFraction centerY = m13.divide(twoM11).negate();
final BigFraction dx = c2[0].subtract(centerX);
final BigFraction dy = c3[0].subtract(centerY);
final BigFraction r2 = dx.multiply(dx).add(dy.multiply(dy));
return new EnclosingBall<Euclidean2D, Vector2D>(new Vector2D(centerX.doubleValue(),
centerY.doubleValue()),
FastMath.sqrt(r2.doubleValue()),
vA, vB, vC);
}
}
}
}