示例#1
0
void  Approx_poly::init(int nb,const ArgAPP & arg)
{
     _s = NEW_VECTEUR(-1,nb,SomApproxPoly);
     _s[-1]._mat = RMat_Inertie();
     _nb = nb;

     for (int i = 0; i<nb ; i++)
         _s[i].init_link(_s+i-1);

     _s[0]._pred = 0;
     _s[0]._best_anc = 0;
     _s[0]._cost = 0.0;

     switch (arg._mcout)
     {
          case ArgAPP::D2_droite :
               _calc_cout = APP_cout_square_droite;
          break;
	  case ArgAPP::DMaxDroite :
               _calc_cout = APP_cout_seuil;
          break;
     };
     switch (arg._mseg)
     {
          case ArgAPP::Extre :
               _calc_seg = APP_seg_extre;
          break;

          case ArgAPP::MeanSquare :
               _calc_seg = APP_seg_mean_square;
          break;
     };
}
示例#2
0
void cElHJaFacette::MakeInertie
     (
         Im2D_INT2 aImMnt,
	 INT aValForb,
	 cGenSysSurResol * aSys
     )
{
     if (! aSys)
        mMatInert = RMat_Inertie();
     Pt2di aSzIm = aImMnt.sz();
     INT aX0 = std::max(0,round_down(mBox._p0.x));
     INT aY0 = std::max(0,round_down(mBox._p0.y));
     INT aX1 = std::max(aSzIm.x,round_up(mBox._p1.x));
     INT aY1 = std::max(aSzIm.y,round_up(mBox._p1.y));
     INT2 ** aDMnt = aImMnt.data();

     for (INT anX=aX0 ; anX<aX1 ; anX++)
         for (INT anY=aY0 ; anY<aY1 ; anY++)
         {
            Pt2dr aPR(anX,anY);
            if  (PointInFacette(aPR))
            {
               INT aVal = aDMnt[anY][anX];
	       REAL aZFac = mPlan->Plan().ZOfXY(aPR);
	       if (aVal != aValForb)
	       {
                  if (aSys)
                      aSys->GSSR_Add_EqFitDroite(aZFac,aVal);
		  else
                      mMatInert.add_pt_en_place(aVal,aZFac);
	       }
            }
         }
}