internal Circle_dt circumcircle() { double u = ((a.x - b.x) * (a.x + b.x) + (a.y - b.y) * (a.y + b.y)) / 2.0f; double v = ((b.x - c.x) * (b.x + c.x) + (b.y - c.y) * (b.y + c.y)) / 2.0f; double den = (a.x - b.x) * (b.y - c.y) - (b.x - c.x) * (a.y - b.y); if (den == 0) // oops, degenerate case { circum = new Circle_dt(a, Double.PositiveInfinity); } else { Point_dt cen = new Point_dt((u * (b.y - c.y) - v * (a.y - b.y)) / den, (v * (a.x - b.x) - u * (b.x - c.x)) / den); circum = new Circle_dt(cen, cen.distance2(a)); } return(circum); }
/** * Copy Constructor. <br /> * Creates a new Circle with same properties of <code>circ</code>. * @param circ Circle to clone. */ public Circle_dt(Circle_dt circ) { this.c = circ.c; this.r = circ.r; }
internal Circle_dt circumcircle() { double u = ((a.x - b.x) * (a.x + b.x) + (a.y - b.y) * (a.y + b.y)) / 2.0f; double v = ((b.x - c.x) * (b.x + c.x) + (b.y - c.y) * (b.y + c.y)) / 2.0f; double den = (a.x - b.x) * (b.y - c.y) - (b.x - c.x) * (a.y - b.y); if (den == 0) // oops, degenerate case circum = new Circle_dt(a, Double.PositiveInfinity); else { Point_dt cen = new Point_dt((u * (b.y - c.y) - v * (a.y - b.y)) / den, (v * (a.x - b.x) - u * (b.x - c.x)) / den); circum = new Circle_dt(cen, cen.distance2(a)); } return circum; }