예제 #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;
 }