void cElHJaFacette::Show(REAL aDirH,INT aCoul,bool WithBox) { Video_Win aW = *(mPlan->W()); aW.hach(mVPt,Pt2dr::FromPolar(1.0,aDirH),3.0,aW.pdisc()(aCoul)); if (WithBox) { aW.draw_rect(mBox._p0,mBox._p1,aW.pdisc()(aCoul)); } }
void cASAMG::ComputeSubset(int aNbPts,cResumNuage & aRN) { Video_Win * aW = mAppli->Param().VisuLowPts().Val() ? TheWinIm() : 0; double aSzCel = sqrt(double(mSz.x*mSz.y)/aNbPts); Pt2di aNb2C = round_up(Pt2dr(mSz)/aSzCel); Pt2di aPK; Im2D_U_INT1 anImDist(mSz.x,mSz.y); TIm2D<U_INT1,INT> aTDist(anImDist); ELISE_COPY(mMasqN.all_pts(),mMasqN.in(),anImDist.out()); Chamfer::d32.im_dist(anImDist); if (aW) { ELISE_COPY(anImDist.all_pts(),mStdN->ImDef().in()!=0,aW->odisc()); ELISE_COPY(select(anImDist.all_pts(),anImDist.in()>0),P8COL::blue,aW->odisc()); ELISE_COPY(select(anImDist.all_pts(),anImDist.in()>10),P8COL::yellow,aW->odisc()); } int aNbSomTot = 0; std::vector<Pt2di> aVPts; std::vector<int> aVNb; for (aPK.x=0 ; aPK.x<aNb2C.x ; aPK.x++) { Pt2di aP0,aP1; aP0.x = (aPK.x*mSz.x) / aNb2C.x; aP1.x = ((aPK.x+1)*mSz.x) / aNb2C.x; for (aPK.y=0 ; aPK.y<aNb2C.y ; aPK.y++) { aP0.y = (aPK.y*mSz.y) / aNb2C.y; aP1.y = ((aPK.y+1)*mSz.y) / aNb2C.y; Pt2di aP; Pt2dr aPMoy(0,0); int aNbSom=0; if (aW) { aW->draw_rect(Pt2dr(aP0),Pt2dr(aP1),Line_St(aW->pdisc()(P8COL::green))); } for (aP.x=aP0.x; aP.x<aP1.x ; aP.x++) { for (aP.y=aP0.y; aP.y<aP1.y ; aP.y++) { if (mTMasqN.get(aP)) { aPMoy = aPMoy + Pt2dr(aP); aNbSom++; } } } if (aNbSom>0) { aPMoy = aPMoy/double(aNbSom); double aDBest = 1e10; Pt2di aPBest(0,0); for (aP.x=aP0.x; aP.x<aP1.x ; aP.x++) { for (aP.y=aP0.y; aP.y<aP1.y ; aP.y++) { if (mTMasqN.get(aP)) { double aDist = euclid(Pt2dr(aP),aPMoy) - std::min(6,aTDist.get(aP))/1.8; if (aDist<aDBest) { aDBest = aDist; aPBest = aP; } } } } aVPts.push_back(aPBest); aVNb.push_back(aNbSom); /* cLinkPtFuNu aPF(aPBest.x,aPBest.y,aNbSom); aVPTR.push_back(aPF); */ aNbSomTot += aNbSom; if (aW) { aW->draw_circle_abs(Pt2dr(aPBest),3.0,aW->pdisc()(P8COL::red)); } } } } aRN.Reset(aVPts.size()); aRN.mNbSom = aNbSomTot; for (int aK=0 ; aK<int(aVPts.size()); aK++) { aRN.mVX.push_back(aVPts[aK].x); aRN.mVY.push_back(aVPts[aK].y); aRN.mVNb.push_back(aVNb[aK]); } if (aW) { // aW->clik_in(); } }