有谁有好的建议?有这方面的源码吗?

解决方案 »

  1.   

    void CBSplineView::bezier(CPoint *pp, int n)
    {//画Bezier曲线
    int x,y,i,j,k=100;
    double t,t1,u,v;
    double temp,temp1,temp2,bi;

    CClientDC dc(this);
    OnPrepareDC(&dc); t=1.0/k;
    dc.MoveTo(pp[0]);
    for(j=1;j<k;j++)
    {
    t1=j*t;
    u=t1;
    v=1-u;
    x=0;
    y=0;
    for(i=0;i<=n;i++)
    {
    temp=double(fac(n)/fac(i)/fac(n-i));
    temp1=powi(u,i);
    temp2=powi(v,n-i);
    bi=temp*temp1*temp2;
    x=x+bi*pp[i].x;
    y=y+bi*pp[i].y;
    }
    dc.LineTo(x,y);
    }
    dc.LineTo(pp[n]);
    }
    class CPoints : public CObject
    {
    DECLARE_SERIAL(CPoints) CPoints();           // protected constructor used by dynamic creation// Attributes
    public:// Operations
    public:
    virtual void Serialize(CArchive& ar);
    CPoint* GetPoint();
    CPoints(CPoint point);
    virtual ~CPoints();
    CPoints &operator=(CPoints &point)
    {
    this->m_point=point.m_point;
    return *this;
    }
    BOOL m_bSelected;// Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CPoints)
    //}}AFX_VIRTUAL// Implementation
    protected: // Generated message map functions
    //{{AFX_MSG(CPoints)
    // NOTE - the ClassWizard will add and remove member functions here.
    //}}AFX_MSG
    private:
    CPoint m_point;
    };
    IMPLEMENT_SERIAL(CPoints, CObject,2)CPoints::CPoints()
    {
    m_point.x=0;
    m_point.y=0;
    m_bSelected=FALSE;
    }CPoints::~CPoints()
    {
    }
    /////////////////////////////////////////////////////////////////////////////
    // CPoints message handlersCPoints::CPoints(CPoint point)
    {
    m_point.x=point.x;
    m_point.y=point.y;
    m_bSelected=FALSE;
    }CPoint* CPoints::GetPoint()
    {
    return &(this->m_point);
    }void CPoints::Serialize(CArchive &ar)
    {
    if(ar.IsStoring())
    {
    ar<<m_point;
    }
    else
    {
    ar>>m_point;
    }}
      

  2.   

    http://community.csdn.net/Expert/topic/3429/3429738.xml?temp=.1533777
      

  3.   

    http://blog.csdn.net/happyparrot/archive/2004/05/27/21588.aspx
    希望对你有所帮助。
      

  4.   

    如果将闭合曲线区域按垂直方向以一个单位划分,成多边形,然后用 syy64(太平洋)的方法也许能计算出近似值,搂主可以试试