void filledElli (COORDS figure, HDC hdc, COLORREF color) { HBRUSH hBrush = CreateSolidBrush (color); HGDIOBJ orig = SelectObject (hdc, hBrush); elli (figure, hdc); deleteFilledObjetFigure (orig, hdc, hBrush); }
void normalElli (COORDS figure, HDC hdc, HPEN& hPen) { HGDIOBJ orig = SelectObject (hdc, hPen); elli (figure, hdc); deleteNormalObjetFigure (orig, hdc, hPen); }
/*! \brief Computes filter coefficients from user specifications and returns the global scale factor. * * Inputs are: * \arg fe : sampling frequency [Hz] * \arg at : attenuation [dB] * \arg bp : oscillations in bandwidth [dB] * \arg fb : low transition frequency [Hz] * \arg fa : high transition frequency [Hz] * \arg NCellMax : maximum number of cells * * Outputs are : * \arg FilterCellsOut : cells * \arg NCellsOut : number of cells * * #elli function is called and its outputs are NCellsOut, Poles, Zeros, CoefA, CoefB, CoefC, CoefD.\n * For all cells (index i=0,...,NCells-1), FilterCellsOut[i] are filled : * \f[ u = (0,0) \f] * \f[ a0 = 1 \f] * \f[ a1 = CoefB[i] \f] * \f[ b1 = CoefD[i] \f] * \f[ b2 = CoefC[i] \f] * \f[ zero = Zeros[i] \f] * \f[ pole = Poles[i] \f] * #PoleMatching, then #OrderCellMaxNorm and #CalcScalingFact functions are called using NCells and FilterCells arguments.\n * #CalcScalingFact result is returned. */ double CalcEllipticFilter(double fe, // sampling frequency [Hz] double at, // attenuation [dB] double bp, // oscillations in bandwidth [dB] double fb, // low transition frequency [Hz] double fa, // high transition frequency [Hz] int NCellMax, // maximum number of cells QuadCell **FilterCellsOut, // Output cells int *NCellsOut // output number of cells ) { double A, T, eps; double wc,wr; double *CoefA, *CoefB; double *CoefC, *CoefD; std::complex<double> *Poles, *Zeros; int NCells; QuadCell *FilterCells; double ag; int i; eps = sqrtl(exp(log(10.)*bp/10.)-1.); A = exp(log(10.)*at/20.); T = 1./fe; wc = fb*2*M_PI; wr = fa*2*M_PI; CoefA = (double*)malloc(NCellMax * sizeof(double)); CoefB = (double*)malloc(NCellMax * sizeof(double)); CoefC = (double*)malloc(NCellMax * sizeof(double)); CoefD = (double*)malloc(NCellMax * sizeof(double)); Poles = (std::complex<double>*)malloc(NCellMax * sizeof(std::complex<double>)); Zeros = (std::complex<double>*)malloc(NCellMax * sizeof(std::complex<double>)); elli(eps,A,fa,fb,fe, NCellMax, &NCells, Poles, Zeros, CoefA, CoefB, CoefC, CoefD); *NCellsOut = NCells; FilterCells = (QuadCell*)malloc(NCells*sizeof(QuadCell)); *FilterCellsOut = FilterCells; for (i=0;i<NCells;i++) { (FilterCells[i]).u[0] = (FilterCells[i]).u[1] = 0; (FilterCells[i]).a0 = 1.0; (FilterCells[i]).a1 = CoefB[i]; (FilterCells[i]).b1 = CoefD[i]; (FilterCells[i]).b2 = CoefC[i]; (FilterCells[i]).zero = Zeros[i]; (FilterCells[i]).pole = Poles[i]; } /* for (i=0;i<NCells;i++) { cout << " Cells " << i << " : (FilterCells[i]).a0 = " << (FilterCells[i]).a0 << Endl; cout << " Cells " << i << " : (FilterCells[i]).a1 = " << (FilterCells[i]).a1 << Endl; cout << " Cells " << i << " : (FilterCells[i]).b1 = " << (FilterCells[i]).b1 << Endl; cout << " Cells " << i << " : (FilterCells[i]).b2 = " << (FilterCells[i]).b2 << Endl; cout << " Cells " << i << " : (FilterCells[i]).zero = " << (FilterCells[i]).zero << Endl; cout << " Cells " << i << " : (FilterCells[i]).pole = " << (FilterCells[i]).pole << Endl; } */ PoleMatching(NCells,FilterCells); OrderCellMaxNorm(NCells,FilterCells); ag = CalcScalingFact(NCells,FilterCells); free(CoefA); free(CoefB); free(CoefC); free(CoefD); free(Poles); free(Zeros); return ag; }