Exemplo n.º 1
0
    /// <summary>
    /// Returns the center of the circumcircle defined by three points (c0,
    /// c1 and c2) on its edge.
    /// </summary>
    public static Vector2 CircumcircleCenter(Vector2 c0, Vector2 c1, Vector2 c2)
    {
        var mp0 = 0.5f * (c0 + c1);
        var mp1 = 0.5f * (c1 + c2);

        var v0 = RotateRightAngle(c0 - c1);
        var v1 = RotateRightAngle(c1 - c2);

        float m0, m1;

        Geom.LineLineIntersection(mp0, v0, mp1, v1, out m0, out m1);

        return(mp0 + m0 * v0);
    }