Logo Search packages:      
Sourcecode: javamorph version File versions  Download package

static boolean javamorph::CTriangulation::circle (  )  [inline, static, private]

Calculates the circumcircle of the current test triangle's points.

Returns:
true if such a circle can be found.

Definition at line 215 of file CTriangulation.java.

References center_x, center_y, circle_radius, distance(), p1, p2, and pnew.

Referenced by findPoint().

                                   {
        double x1, y1, x2, y2, x3, y3, q, n;
        x1 = (p1.x + pnew.x) / 2.0;
        y1 = (p1.y + pnew.y) / 2.0;
        x3 = (p2.x + pnew.x) / 2.0;
        y3 = (p2.y + pnew.y) / 2.0;
        x2 = pnew.x;
        y2 = pnew.y;
        q = (y2 - y1) * (y3 - y1) - (-x2 + x1) * (x3 - x1);
        n = (y2 - y3) * (-x2 + x1) - (-x2 + x3) * (y2 - y1);
        if(0.0 == n){
            return false;
        }
        q /= n;
        center_x = x3 + q * (y2 - y3);
        center_y = y3 + q * (-x2 + x3);
        circle_radius = distance(p1);
        return true;
    }


Generated by  Doxygen 1.6.0   Back to index