用鼠标点三个点,如何画出对应的圆?

解决方案 »

  1.   

    其实原理大家都知道,只是公式的推导设定(x1,y1),(x2,y2),(x3,y3)为不共线,不公点的三点然后推导出圆心坐标,由此得出半径和圆的方程
      

  2.   

    用系统自带的画圆函数不就可以了吗!!
    楼主多看看书!
    circle(x,y,z);
      

  3.   

    我要找的是根据三点得到外心的公式。也就是外切园的圆心和三个点的坐标(x1,y1)(x2,y2)(x3,y3)的关系。在windows下没有circle(x,y,z);这个函数。请教高手帮忙。分不够可以在加。
      

  4.   

    Subject 1.04: How do I generate a circle through three points?    Let the three given points be a, b, c.  Use _0 and _1 to represent
        x and y coordinates. The coordinates of the center p=(p_0,p_1) of
        the circle determined by a, b, and c are:        A = b_0 - a_0;
            B = b_1 - a_1;
            C = c_0 - a_0;
            D = c_1 - a_1;
        
            E = A*(a_0 + b_0) + B*(a_1 + b_1);
            F = C*(a_0 + c_0) + D*(a_1 + c_1);
        
            G = 2.0*(A*(c_1 - b_1)-B*(c_0 - b_0));
        
            p_0 = (D*E - B*F) / G;
            p_1 = (A*F - C*E) / G;
     
        If G is zero then the three points are collinear and no finite-radius
        circle through them exists.  Otherwise, the radius of the circle is:            r^2 = (a_0 - p_0)^2 + (a_1 - p_1)^2    Reference:    [O' Rourke (C)] p. 201. Simplified by Jim Ward.
      

  5.   

    ///////////////////////////////////////////
    //求三角形外接圆圆心坐标
    ///////////////////////////////////////////
    void circle_center(Point *center,Point pt[3],double *radiu)
    {
    double x1,x2,x3,y1,y2,y3;
    double x = 0;
    double y = 0; x1 = pt[0].pt.x;
    x2 = pt[1].pt.x;
    x3 = pt[2].pt.x;
    y1 = pt[0].pt.y;
    y2 = pt[1].pt.y;
    y3 = pt[2].pt.y; x=((y2-y1)*(y3*y3-y1*y1+x3*x3-x1*x1)-(y3-y1)*(y2*y2-y1*y1+x2*x2-x1*x1))/(2*(x3-x1)*(y2-y1)-2*((x2-x1)*(y3-y1)));
    y=((x2-x1)*(x3*x3-x1*x1+y3*y3-y1*y1)-(x3-x1)*(x2*x2-x1*x1+y2*y2-y1*y1))/(2*(y3-y1)*(x2-x1)-2*((y2-y1)*(x3-x1))); center->pt.x = x ;
    center->pt.y = y ;
    *radiu = (pt[0].pt.x - x)*(pt[0].pt.x - x) + (pt[0].pt.y - y)*(pt[0].pt.y - y);}