Пример #1
0
        public Circle_dt circumcircle()
        {
            double u   = ((_a.x - _b.x) * (_a.x + _b.x) + (_a.y - _b.y) * (_a.y + _b.y)) / 2.0;
            double v   = ((_b.x - _c.x) * (_b.x + _c.x) + (_b.y - _c.y) * (_b.y + _c.y)) / 2.0;
            double den = (_a.x - _b.x) * (_b.y - _c.y) - (_b.x - _c.x) * (_a.y - _b.y);

            // oops, degenerate case
            if ((den == 0))
            {
                _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);
        }
Пример #2
0
 /// <summary>
 /// Copy Constructor. Creates a new Circle with same properties of <paramref name="circle"/>
 /// </summary>
 /// <param name="circle">Circle to clone.</param>
 /// <remarks></remarks>
 public Circle_dt(Circle_dt circle) : this(circle.Center, circle.Radius)
 {
 }