コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: CircleDT.cs プロジェクト: adiel2012/jdt
 /**
  * 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;
 }
コード例 #3
0
ファイル: CircleDT.cs プロジェクト: VKaban/jdt
 /**
  * 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;
 }
コード例 #4
0
ファイル: TriangleDT.cs プロジェクト: adiel2012/jdt
 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;
 }