boolean circumcircleContains(Point p) { return circum.radius() > circum.center().distance2(p); }
Circle circumcircle() { double u = ((a.getX() - b.getX()) * (a.getX() + b.getX()) + (a.getY() - b.getY()) * (a.getY() + b.getY())) / 2.0f; double v = ((b.getX() - c.getX()) * (b.getX() + c.getX()) + (b.getY() - c.getY()) * (b.getY() + c.getY())) / 2.0f; double den = (a.getX() - b.getX()) * (b.getY() - c.getY()) - (b.getX() - c.getX()) * (a.getY() - b.getY()); if (den == 0) // oops, degenerate case circum = new Circle(a, Double.POSITIVE_INFINITY); else { Point cen = new Point((u * (b.getY() - c.getY()) - v * (a.getY() - b.getY())) / den, (v * (a.getX() - b.getX()) - u * (b.getX() - c.getX())) / den); circum = new Circle(cen, cen.distance2(a)); } return circum; }