如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
源程序:doubleCCurveView::Power(doublev,intm){inti=1;doubletemp=1.0;if(m==0||v==0)return(1.0);elsefor(i=1;i<=m;i++)temp=temp*v;returntemp;}doubleCCurveView::NFctor(intn){doublefactor=1;if(n==0)return(factor);while(n>0){factor=n*factor;n=n-1;}return(factor);}voidCCurveView::OnMenuitem32771(){constintN1=8;doubleB[8+1];DoubleP1[30+1][2]={{700,600},{80,400},{90,180},{80,-80},{300,-80},{600,-80},{600,160},{600,450},{700,600}};DrawTu(N1,P1,B);}voidCCurveView::OnMenuitem32772(){constintN2=3;doubleB2[3+1];doubleP2[30+1][2]={{200,250},{200,300},{300,300},{300,250}};DrawTu(N2,P2,B2);}voidCCurveView::OnMenuitem32773(){constintN3=3;doubleB3[3+1];doubleP3[30+1][2]={{500,250},{500,300},{600,300},{600,250}};DrawTu(N3,P3,B3);}voidCCurveView::OnMenuitem32774(){constintZD1=3;doubleP1[3+1][2]={{100,100},{200,300},{400,300},{300,100}};doubleQ1[ZD1+1][2];InsertZhi(ZD1,P1,Q1);}voidCCurveView::OnMenuitem32775(){constintZD2=5;doubleP2[3+1][2]={{350,100},{450,300},{650,300},{550,100}};doubleQ2[ZD2+1][2];InsertZhi(ZD2,P2,Q2);}voidCCurveView::OnMenuitem32776(){constintZD3=20;doubleP3[3+1][2]={{600,100},{700,300},{900,300},{800,100}};doubleQ3[ZD3+1][2];InsertZhi(ZD3,P3,Q3);}voidCCurveView::DrawTu(intN,doubleP[][2],doubleB[]){CDC*pDC;pDC=GetDC();constD=30;constwidth=100;constheight=600;doubleQx[D+1],Qy[D+1];doubleAA,BB,CC,t;intj,e,cx,cy;Qx[0]=P[0][0];Qy[0]=P[0][1];Qx[D]=P[N][0];Qy[D]=P[N][1];for(e=1;e<D;e++){t=(double)e/D;for(j=0;j<=N;j++){AA=NFctor(N);BB=NFctor(j);CC=NFctor(N-j);B[j]=AA/(BB*CC)*Power(t,j)*Power((1-t),(N-j));}Qx[e]=0;Qy[e]=0;for(j=0;j<=N;j++){Qx[e]=Qx[e]+B[j]*P[j][0];Qy[e]=Qy[e]+B[j]*P[j][1];}}cx=(int)(Qx[0]+0.5);cy=(int)(Qy[0]+0.5);pDC->MoveTo(cx+width,height-cy);for(e=1;e<D;e++){t=(double)e/D;for(j=0;j<=N;j++){AA=NFctor(N);BB=NFctor(j);CC=NFctor(N-j);B[j]=AA/(BB*CC)*Power(t,j)*Power(