Pt3dr cMEPCoCentrik::ComputeBase() { Pt3dr aBest(0,0,0); double aScoreMin = 1e20; for (int aK1=0 ; aK1<int(mVPlanBase.size()); aK1++) { Pt3dr aCdtBase = mVPlanBase[aK1]; double aScore = 0; for (int aK2=0 ; aK2<int(mVPlanBase.size()); aK2++) { Pt3dr aP2 = mVPlanBase[aK2]; if (scal(aP2,aCdtBase) < 0) aP2 = -aP2; double aDist = euclid(aP2-aCdtBase); aDist = CoutAttenueTetaMax(aDist,0.3); aScore += aDist; } if (aScore < aScoreMin) { aScoreMin = aScore; aBest = aCdtBase; } } return aBest; }
void MainWindow::CollectBest() { //Выбор лучших struct __t { double val; int pos; }; TCL::Array<__t> aBest(ImageProcessor::BEST); int nCount=0; for (int i=0; i<ImageProcessor::BEST; i++) { int nMin=-1; double m=1000000.999; for (int j=0; j<aValues.Size(); j++) { if (aValues[j].vSummary<m) { m=aValues[j].vSummary; nMin=j; } } if (nMin>-1) { aBest[nCount].val=m; aBest[nCount].pos=nMin; aValues[nMin].vSummary=10000000.0; nCount++; } } aDaBest.Resize(nCount); for (int i=0; i<nCount; i++) { aValues[aBest[i].pos].vSummary=aBest[i].val; aDaBest[i].Copy(aImprPlates[aBest[i].pos]); } }