void Bezier::new_split_Bezier(CDC*pDC,CPoint P[]) { CPoint R[4],Q[4]; int i,j; const double epsilon=1.5; if (maxdistance(P)<epsilon) { pDC->MoveTo(P[0].x,P[0].y); pDC->LineTo(P[3].x,P[3].y); } else { for (i=0;i<=3;i++) { R[i]=P[i]; } for (i=0;i<=2;i++) { Q[i]=R[0]; for (j=0;j<=2-i;j++) { R[j].x=(R[j].x+R[j+1].x)/2; R[j].y=(R[j].y+R[j+1].y)/2; } } Q[3]=R[0]; new_split_Bezier(pDC,Q); new_split_Bezier(pDC,R); } }
double Car::budget_cost() { /* Return sum(cost) / ODO * 100 */ double totalPrice = 0; foreach(Cost *cost, _costlist) { totalPrice += cost->cost(); } return totalPrice / ((maxdistance() - mindistance())/ 100.0); }