void cEqHomogFormelle::StdRepondere(ElPackHomologue & aPack,REAL aCoeff) { cElHomographie H1 = HF1().HomCur(); cElHomographie H2 = HF2().HomCur(); ElDistRadiale_PolynImpair Dist(1e5,Pt2dr(0,0)); if (DRF()) Dist = DRF()->DistCur(); for ( ElPackHomologue::iterator it=aPack.begin(); it!=aPack.end(); it++ ) { Pt2dr aP1 = it->P1(); Pt2dr aP2 = it->P2(); if (mDRF) { aP1 = Dist.Direct(aP1); aP2 = Dist.Direct(aP2); } Pt2dr Ec = H1.Direct(Dist.Direct(it->P1())) - H2.Direct(Dist.Direct(it->P2())); REAL D = euclid(Ec); REAL Pds = 1 / (1 + ElSquare(D/aCoeff)); it->Pds() = Pds; } }
thStatus thExecuteaHist(thHistSpecList *Hist) { float vals[2]; int id,nd; daVarStruct *(varp[2]); int indxy[2]; thHistOpaque *opqptr; double weight; /* nd = Hist->nd;*/ opqptr = Hist->varname->opaque; if(!opqptr) return(S_SUCCESS); /* Assume it is a user filled histogram */ nd = opqptr->nd; varp[0] = opqptr->x; indxy[0] = opqptr->xindex; varp[1] = opqptr->y; indxy[1] = opqptr->yindex; for(id=0;id<nd;id++){ switch(varp[id]->type) { case DAVARINT: vals[id] = *((DAINT *) varp[id]->varptr + indxy[id]); break; case DAVARFLOAT: vals[id] = *((DAFLOAT *) varp[id]->varptr + indxy[id]); break; case DAVARDOUBLE: vals[id] = *((DADOUBLE *) varp[id]->varptr + indxy[id]); break; } } if(opqptr->weight) { switch(opqptr->weight->type) { case DAVARINT: weight = *((DAINT *) opqptr->weight->varptr + opqptr->weightindex); break; case DAVARFLOAT: weight = *((DAFLOAT *) opqptr->weight->varptr + opqptr->weightindex); break; case DAVARDOUBLE: weight = *((DADOUBLE *) opqptr->weight->varptr + opqptr->weightindex); break; } } else { weight = 1.0; } if((opqptr->test ? *((DAINT *) opqptr->test->varptr + opqptr->testindex) : 1)) { if(nd==1){ HF1(*(DAINT *) Hist->varname->varptr,vals[0],weight); /* printf("Filling %s at %f\n",Hist->varname->name,vals[0]);*/ } else HF2(*(int *) Hist->varname->varptr,vals[0],vals[1],weight); } return(S_SUCCESS); }