Beispiel #1
0
void CorrectRect(Pt2di &  aP0,Pt2di &  aP1,const Pt2di & aSz)
{
    aP0 = Inf(aSz,Sup(aP0,Pt2di(0,0)));
    aP1 = Inf(aSz,Sup(aP1,Pt2di(0,0)));

    CorrectNonEmpty(aP0.x,aP1.x,aSz.x);
    CorrectNonEmpty(aP0.y,aP1.y,aSz.y);
}
Beispiel #2
0
         bool GenScaleIm<TObj>::do_it_gen(Pt2dr tr,REAL sc,Pt2di  pW0,Pt2di  pW1)
{

	_tr = tr;
	_sc = sc;
    XTransfo.Set(_tr.x,_sc);
    YTransfo.Set(_tr.y,_sc);


	_CoeffPds = round_ni(100.0/sc);
	pt_set_min_max(pW0,pW1);

	Pt2dr pu0 = Sup(Pt2dr(to_user(Pt2dr(pW0))),Pt2dr(0.0,0.0));
 	Pt2dr pu1 = Inf(Pt2dr(to_user(Pt2dr(pW1))),Pt2dr(_SzU));


	pW0 = Sup(Pt2di(0,0),round_down(to_window(pu0)));
	pW1 = Inf(_SzW		,round_up(to_window(pu1)));



	_pW0 = pW0;
	_pW1 = pW1;


	_xU0 = std::max(0		, round_down(0.5+x_to_user(_pW0.x-0.5)));
	_xU1 = std::min(_SzU.x	, round_up  (0.5+x_to_user(_pW1.x-0.5)));
	_yU0 = std::max(0		, round_down(0.5+y_to_user(_pW0.y-0.5)));
	_yU1 = std::min(_SzU.y	, round_up  (0.5+y_to_user(_pW1.y-0.5)));


    	if ((_xU0 >=_xU1) || (_yU0 >= _yU1))
           return false;

	for (INT ux=_xU0; ux<=_xU1 ; ux++)
	{
	     _u2wX[ux] =  FitInWX(PremPixelU2WX(ux));
    }

	for (INT uy=_yU0; uy<=_yU1 ; uy++)
	{
	     _u2wY[uy] =  FitInWY(PremPixelU2WY(uy));
    }

	for (INT wx= 0;wx<= _SzW.x ; wx++)	
	{
		 _Cw2uX[wx] = PixCenterW2U_x(wx);
	}
	for (INT wy=0;wy<= _SzW.y ; wy++)	
	{
		 _Cw2uY[wy] = PixCenterW2U_y(wy);
	}

     return true;
}
    BooleanMappedValue BooleanValueImageExpanderEstimator::visit(SPnode * spn) const
    {
		#ifdef MYDEBUG
			std::cout << "in BooleanValueImageExpanderEstimator::visit, for " << spn->getNodeName() << std::endl;
		#endif
		
        // check if we need to split
        ivector box = spn->getBox();
		
		#ifdef MYDEBUG
			std::cout << "this box is " << box << std::endl;
        #endif
		
		#ifdef MYDEBUG
			std::cout << "this tolerance is " << tolerance << std::endl;
		#endif
		
		interval thisRange = fobj(box);
		
		#ifdef MYDEBUG
			std::cout << "this range is " << thisRange << std::endl;
		#endif
		
		
		bool retValue = false;
		
		if ( !(Sup(thisRange) < infCriterion) 
						&& !(Inf(thisRange) > supCriterion) ) { // overlap
			retValue = true;
			#ifdef MYDEBUG_MIN
				std::cout << "overlap, returning true" << std::endl;
			
			#endif
			
			if ( (Sup(thisRange) > supCriterion) 
				|| (Inf(thisRange) < infCriterion) ) { //indet
				
				int maxdiamcomp;
				double maxDiam = MaxDiam (box, maxdiamcomp);
				// check if box max width is < tolerance, expand if not
				if (!(maxDiam < tolerance)) {
					spn->nodeExpand();
					#ifdef MYDEBUG_MIN
						std::cout << "and max width >= tolerance " << std::endl;
					
					#endif
				}
				
			}
			// else thisRange is inside criterion				
		}
		
		
		return BooleanMappedValue(retValue);
    }
RImGrid::RImGrid
(
     bool AdaptStep,
     Pt2dr aP0,
     Pt2dr aP1,
     Pt2dr  aStepGr,
     const std::string & aName,
     Pt2di aSz
) :
  mP0     (Inf(aP0,aP1)),
  mP1     (Sup(aP0,aP1)),
  mStepGr (AdaptStep ? AdaptPas(aStepGr,mP1-mP0) : aStepGr),
  mSzGrid ( (aSz!=Pt2di(0,0)) ? 
            aSz               :
            (
                AdaptStep                                        ?
	        (round_ni((aP1-aP0).dcbyc(mStepGr))+Pt2di(1,1))  :
                (round_up((aP1-aP0).dcbyc(mStepGr))+Pt2di(1,1))
            )
          ),
  mDef    (-1e20),
  mGrid   (mSzGrid.x,mSzGrid.y,mDef),
  mTim    (new TIm2D<REAL,REAL>(mGrid)),
  mName   (aName),
  mStepAdapted (AdaptStep)
{
}
void WorkloadDistributionWidget::setupDistributionTable(){
	const ivector wlvector = this->workloads->getWorkloadVector();
	const int distLb = Lb( wlvector );
	const int distUb = Ub( wlvector );
	const int distCount = distUb - distLb + 1;

	distTable->setRowCount(distCount);

	QStringList rowHeaders;
	for (int i = distLb; i <= distUb; i++) {
		rowHeaders << QString("%1").arg(i);
	}

	distTable->setVerticalHeaderLabels(rowHeaders);

	for (int i = distLb; i <= distUb; i++) {
			stringstream strStr;
			strStr << Scientific << SetPrecision(15,16) << Sup(wlvector[i]) << endl
					<< Scientific << SetPrecision(15,16) << Inf(wlvector[i]);

			QString itemText = QString::fromStdString(strStr.str());
			QTableWidgetItem *newItem =	new QTableWidgetItem(itemText);
			distTable->setItem(i , 0 , newItem);
	}

	distTable->resizeRowsToContents();
}
Beispiel #6
0
template <class Type>   Box2d<Type>  Inf(const Box2d<Type> & b1,const Box2d<Type> & b2)
{
      return  Box2d<Type>
              (
                   Sup(b1._p0,b2._p0),
                   Inf(b1._p1,b2._p1)
              );
}
Beispiel #7
0
//=================================================================================================
void Terrain::CalculateBox()
{
	assert(state > 0);

	float smax = -Inf(),
		smin = Inf(),
		pmax, pmin, hc;

	for(uint i = 0; i < n_parts*n_parts; ++i)
	{
		pmax = -Inf();
		pmin = Inf();

		const uint z_start = (i / n_parts)*tiles_per_part,
			z_end = z_start + tiles_per_part,
			x_start = (i%n_parts)*tiles_per_part,
			x_end = x_start + tiles_per_part;

		for(uint z = z_start; z <= z_end; ++z)
		{
			for(uint x = x_start; x <= x_end; ++x)
			{
				hc = h[x + z*hszer];
				if(hc > pmax)
					pmax = hc;
				if(hc < pmin)
					pmin = hc;
			}
		}

		pmin -= 0.1f;
		pmax += 0.1f;

		parts[i].box.v1.y = pmin;
		parts[i].box.v2.y = pmax;

		if(pmax > smax)
			smax = pmax;
		if(pmin < smin)
			smin = pmin;
	}

	box.v1.y = smin;
	box.v2.y = smax;
}
Beispiel #8
0
//----------------------------------------------------------------------------
// Intersection of an interval 'X' and an extended interval 'Y'. The result
// is given as a pair (vector) of intervals, where one or both of them can
// be empty intervals.
//----------------------------------------------------------------------------
ivector operator& ( const interval& X, const xinterval& Y )
{
  interval H;
  ivector  IS(2);

  IS[1] = EmptyIntval();
  IS[2] = EmptyIntval();

  switch (Y.kind) {
    case Finite     : // [X.inf,X.sup] & [Y.inf,Y.sup]
                      //------------------------------
                      H = _interval(Y.inf,Y.sup);
                      if ( !Disjoint(X,H) ) IS[1] = X & H;
                      break;
    case PlusInfty  : // [X.inf,X.sup] & [Y.inf,+oo]
                      //----------------------------
                      if (Sup(X) >= Y.inf) {
                        if (Inf(X) > Y.inf)
                          IS[1] = X;
                        else
                          IS[1] = _interval(Y.inf,Sup(X));
                      }
                      break;
    case MinusInfty : // [X.inf,X.sup] & [-oo,Y.sup]
                      //----------------------------
                      if (Y.sup >= Inf(X)) {
                        if (Sup(X)<Y.sup)
                          IS[1] = X;
                        else
                          IS[1] = _interval(Inf(X),Y.sup);
                      }
                      break;
    case Double     : if ( (Inf(X) <= Y.sup) && (Y.inf <= Sup(X)) ) {
                        IS[1] = _interval(Inf(X),Y.sup);    // X & [-oo,Y.sup]
                        IS[2] = _interval(Y.inf,Sup(X));    // X & [Y.inf,+oo]
                      }
                      else if (Y.inf <= Sup(X)) // [X.inf,X.sup] & [Y.inf,+oo]
                        if (Inf(X) >= Y.inf)    //----------------------------
                          IS[1] = X;
                        else
                          IS[1] = _interval(Y.inf,Sup(X));
                      else if (Inf(X) <= Y.sup){// [X.inf,X.sup] & [-oo,Y.sup]
                        if (Sup(X) <= Y.sup)    //----------------------------
                          IS[1] = X;
                        else
                          IS[1] = _interval(Inf(X),Y.sup);
                      }
                      break;
    case Empty      : break;                           // [X.inf,X.sup] ** [/]
  } // switch                                          //---------------------

  return IS;
} // operator&
Beispiel #9
0
void ModelDiffBox::MakeIt(Box2di OldOne,Box2di NewOne)
{
    mInterIsEmpty = mEnPlus.MakeIt(NewOne,OldOne);
    mEnMoins.MakeIt(OldOne,NewOne);

    if (!mInterIsEmpty)
    {
           mInter = Box2di(Inf(OldOne._p0,NewOne._p0),Sup(OldOne._p1,NewOne._p1));
    }
}
Beispiel #10
0
Pane MessageWindow::getPane(StrLen title) const
 {
  Point size=getMinSize(title,sub_win.getMinSize());
  
  Point s=desktop->getScreenSize();
  
  size=Inf(size,s-s/4);
  
  return Pane((s.x-size.x)/2,+cfg.pos_ratio*(s.y-size.y),size);
 }
Beispiel #11
0
       /*!
        *  \brief  hit tests between point and pair (treats pair as an "edge")
        */
      bool hit(const Point& pnt, const Pair& par ){
          //if inside surround < 0
          if( ( pnt <= Round::sur( par ) )[0] < 0 ) {
            if ( (pnt ^ par ^ Inf(1)).wt() == 0.0 ) {
                return true;
              }
          } 
          return false;

      }
Beispiel #12
0
template <class Type> void   Box2d<Type>::QSplitWithRab(typename Box2d<Type>::QBox & aQB,Type aRab) const
{
   QSplit(aQB);

   for (int aK=0 ; aK<4 ; aK++)
   {
        aQB[aK] = aQB[aK].AddTol(aRab);
        aQB[aK] = Inf(aQB[aK],*this);
   }
}
EHFS_ScoreGrad::EHFS_ScoreGrad 
(
    REAL         Step,
    REAL         Width,
    REAL         LentghMax,
    Im2D_INT1    ImGlobGX,
    Im2D_INT1    ImGlobGY,
    REAL         CostChg ,
    REAL         EcarTeta,
    REAL         EcarMaxLoc,
    REAL         SeuilGrad
) :
  ElHoughFiltSeg (Step,Width,LentghMax,Inf(ImGlobGX.sz(),ImGlobGY.sz())),
  mImLocGX       (SzMax().x,SzMax().y), 
  mImLocGY       (SzMax().x,SzMax().y), 
  mImLocGRho     (SzMax().x,SzMax().y), 
  mDataLocRho    (mImLocGRho.data()),
  mImLocGTeta    (SzMax().x,SzMax().y), 
  mDataLocTeta   (mImLocGTeta.data()), 
  mImYMaxLoc     (SzMax().x),
  mDataYMaxLoc   (mImYMaxLoc.data()),
  mImGlobGX      (ImGlobGX),
  mImGlobGY      (ImGlobGY),
  mCostChgt      (CostChg),  
  //mEcarTeta      (EcarTeta),
  mPdsTeta       (256),
  mDataPdsTeta   (mPdsTeta.data()),
  //mEcarMaxLoc    (EcarMaxLoc),
  mPdsMaxLoc     (SzMax().y),
  mDataPdsMaxLoc (mPdsMaxLoc.data()),
  //mSeuilGrad     (SeuilGrad),
  mPdsRho        (256),
  mDataPdsRho    (mPdsRho.data()),
  mGainIfSeg     (SzMax().x),
  mDataGainIfSeg (mGainIfSeg.data())
{
     for (INT iTeta=0; iTeta<256 ; iTeta++)
     {
         REAL DeltaTeta = (iTeta%128) *PI /128.0 - PI/2;
         DeltaTeta /= EcarTeta;
         mDataPdsTeta[iTeta] =  pow(0.5,ElSquare(DeltaTeta));
     }

     for (INT y=0 ; y<SzMax().y ; y++)
     {
         REAL dY = (y-mNbYMax) * mStep;
         dY /= EcarMaxLoc;
         mDataPdsMaxLoc[y] = pow(0.5,ElSquare(dY));
     }

     for (INT iRho=0 ; iRho<256 ; iRho++)
     {
         mDataPdsRho[iRho] = ElMin(1.0,iRho/SeuilGrad);
     }
}
    cxsc::interval IntervalExpanderEstimator::visit(SPnode * spn) const
    {
		#ifdef MYDEBUG
			std::cout << "in IntervalExpanderEstimator::visit, for " << spn->getNodeName() << std::endl;
		#endif
		
        // check if we need to split
        ivector box = spn->getBox();
		
		#ifdef MYDEBUG
			std::cout << "this box is " << box << std::endl;
        #endif
		
		interval thisRange = fobj(box);
		real thisMidImage = fobj.imageMid(box);
		
		#ifdef MYDEBUG
			std::cout << "this midImage is " << thisMidImage << std::endl;
		#endif
		
		#ifdef MYDEBUG
			std::cout << "this range is " << thisRange << std::endl;
		#endif
		
		#ifdef MYDEBUG
			std::cout << "this tolerance is " << tolerance << std::endl;
		#endif
		
		// split if so
		if (max(Sup(thisRange) - thisMidImage, thisMidImage - Inf(thisRange)) > tolerance) {
			spn->nodeExpand();

		}
		#ifdef MYDEBUG_MIN
		if (!(max(Sup(thisRange) - thisMidImage, thisMidImage - Inf(thisRange)) > tolerance)) {
		
			std::cout << "no need to expand further: interval image <= tolerance " << std::endl;
		}
		#endif
		
		return thisRange;
    }
Beispiel #15
0
float64
runtime·ldexp(float64 d, int32 e)
{
	uint64 x;

	if(d == 0)
		return 0;
	x = runtime·float64tobits(d);
	e += (int32)(x >> SHIFT) & MASK;
	if(e <= 0)
		return 0;	/* underflow */
	if(e >= MASK){		/* overflow */
		if(d < 0)
			return runtime·Inf(-1);
		return runtime·Inf(1);
	}
	x &= ~((uint64)MASK << SHIFT);
	x |= (uint64)e << SHIFT;
	return runtime·float64frombits(x);
}
Beispiel #16
0
void  CalcMaxLoc<Type,TypeBase,Compare>::FiltrMaxLoc_BCVS
      (
          ElSTDNS vector<Pt2di> & Pts,
          Im2D<Type,TypeBase> Im,
          REAL  FactInf,
          REAL  TolGeom,
          Pt2di SzVois,
          Im2D_U_INT1 Marq
      )
{
    Pt2di SzIm = Inf(Im.sz(),Marq.sz());
    Box2di BoxIm(Pt2di(0,0),SzIm);

    Marq.raz();
    mBufFiltr.clear();


    INT4 ** dIm = Im.data();

    for (INT kp1=0; kp1<(INT)Pts.size() ; kp1++)
    {
        ELISE_ASSERT
        (
           BoxIm.contains(Pts[kp1]),
           "GenMaxLoc::FiltrMaxLoc_BCVS"
        );
    }
    
	{
    for (INT kp1=0; kp1<(INT)Pts.size() ; kp1++)
    {
        Pt2di p1 = Pts[kp1];
        Box2di BoxP1(p1-SzVois,p1+SzVois);
        INT v1 = dIm[p1.y][p1.x];
        INT Vinf = round_up(v1*FactInf);
        bool Refut = false;
   

        for (INT kp2=0 ; (kp2<(INT)Pts.size())&&(!Refut)  ; kp2++)
        {
            Pt2di p2 = Pts[kp2];
            if (    (kp1!= kp2)
                 && CmpTot(v1,dIm[p2.y][p2.x],p1,p2)
                 && BoxP1.contains(p2)
                 && BandeConnectedVsup(p1,p2,Im,Vinf,TolGeom,Marq)
               )
               Refut = true;
        }
        if (! Refut)
           mBufFiltr.push_back(p1);
    }
	}
    Pts = mBufFiltr;
}
    BooleanValueImageExpanderEstimator::BooleanValueImageExpanderEstimator(
												const MappedFobj& f,
												const cxsc::interval& crit,
												cxsc::real tol)
                : fobj(f), supCriterion(Sup(crit)), infCriterion(Inf(crit)),
					tolerance(tol) 
	{
		if (tolerance < cxsc::MinReal) 
			throw std::invalid_argument(
				"BooleanValueImageExpanderEstimator::BooleanValueImageExpanderEstimator(MappedFobj&, cxsc::real) : tol < cxsc::MinReal");
	}
void StochasticProcessWidget::addQuantile() {
	QTableWidgetItem *item;

	int lastRowIndex = quantileTable->rowCount();
	quantileTable->setRowCount(lastRowIndex + 1);

	double probabilityLimit = quantileEdit->text().toDouble();
	int stateCount = process->getNumStates();


	item = new QTableWidgetItem(quantileEdit->text());
	item->setTextAlignment(Qt::AlignCenter);
	quantileTable->setItem(lastRowIndex, 0, item);
	item = new QTableWidgetItem("[DEL]");
	item->setTextAlignment(Qt::AlignCenter);
	quantileTable->setItem(lastRowIndex, stateCount+1, item);

	for (int stateIndex = 1; stateIndex <= stateCount; stateIndex++) {
		ivector distValues = intervalDists[stateIndex-1];
		real probabilityInf = 0.0;
		real probabilitySup = 0.0;
		int distIndexSup;
		int distIndexInf;
		for (distIndexSup = Lb(distValues); distIndexSup <= Ub(distValues); distIndexSup++) {
			interval distValue = distValues[distIndexSup];
			probabilityInf += Inf(distValue);
			probabilitySup += Sup(distValue);
			if (probabilitySup >= probabilityLimit) {
				if(probabilityInf <probabilityLimit)
					distIndexInf = distIndexSup - 1;
				else
					distIndexInf = distIndexSup;
				break;
			}
		}

		QTableWidgetItem *resultItem = new QTableWidgetItem(QString("[%1..%2]").arg(distIndexInf).arg(distIndexSup));
		resultItem->setTextAlignment(Qt::AlignCenter);
		quantileTable->setItem(lastRowIndex, stateIndex, resultItem);
	}

	int distCount = process->getNumStates();
	QColor quantileCellColor;

	for (int i = 0; i < distCount; i++) {
		int hueValue = (int)round(255.0
				/ ((double)distCount / (double)i));
		quantileCellColor.setHsv(hueValue, 40, 245);
		quantileTable->item(lastRowIndex, i+1)->setBackgroundColor(quantileCellColor);
	}
}
Beispiel #19
0
bool PowInt<T>::propagate() {

    T& x = *arg1;
    const T& y = *(this->val);

    // Inverse operator
    T x_new( sqrt(y) );

    if      (Inf(x) >= 0.0)
        ;
    else if (Sup(x) <= 0.0)
        x_new = T(-Sup(x_new), -Inf(x_new));
    else
        x_new = T(-Sup(x_new), Sup(x_new));

    if ( Disjoint(x, x_new) )
        return true;
    else {
        x = Intersect(x, x_new);
    }

    return false;
}
template <class Type>   void cStructMergeTieP<Type>::DoExport()
{
    AssertUnExported();
    mExportDone = true;

    for (int aK=0 ; aK<mTheNb ; aK++)
    {
        tMapMerge & aMap = mTheMapMerges[aK];

        for (tItMM anIt = aMap.GT_Begin() ; anIt != aMap.GT_End() ; anIt++)
        {
            tMerge * aM = tMapMerge::GT_GetValOfIt(anIt);
            if (aM->IsOk())
            {
               mLM.push_back(aM);
               aM->SetNoOk();
            }
        }
    }

    for (int aK=0 ; aK<mTheNb ; aK++)
    {
       mNbSomOfIm[aK] = 0;
    }
    
    for (typename std::list<tMerge *>::const_iterator itM=mLM.begin() ; itM!=mLM.end() ; itM++)
    {
        int aNbA = (*itM)->NbArc();
        while (int(mStatArc.size()) <= aNbA)
        {
           mStatArc.push_back(0);
        }
        mStatArc[aNbA] ++;
        for (int aKS=0 ; aKS<mTheNb ; aKS++)
        {
           if ((*itM)->IsInit(aKS))
           {
               const tVal &  aVal = (*itM)->GetVal(aKS);
               if(mNbSomOfIm[aKS] == 0)
               {
                   mEnvSup[aKS] = mEnvInf[aKS] = aVal;
               }
               mNbSomOfIm[aKS] ++;
               mEnvInf[aKS] = Inf(mEnvInf[aKS],aVal);
               mEnvSup[aKS] = Sup(mEnvSup[aKS],aVal);
           }
        }
    }
}
Beispiel #21
0
std::string FloatConstantGenerator::GenFloatConstantImpl(
    const FieldDef &field) const {
  const auto &constant = field.value.constant;
  T v;
  auto done = StringToNumber(constant.c_str(), &v);
  FLATBUFFERS_ASSERT(done);
  if (done) {
#if (!defined(_MSC_VER) || (_MSC_VER >= 1800))
    if (std::isnan(v)) return NaN(v);
    if (std::isinf(v)) return Inf(v);
#endif
    return Value(v, constant);
  }
  return "#";  // compile time error
}
Beispiel #22
0
int clip_line_by_circle2( double slope, double intercept,
					const double centre[2], const double radius,
					double begin[2], double end[2])
{ double line0[2], line1[2];
	
	if( Inf(slope) ){
		line0[0]= line1[0]= intercept;
		line0[1]= centre[1]- radius*2;
		line1[1]= centre[1]+ radius*2;
	}
	else{
		line0[0]= centre[0]- radius*2;
		line0[1]= slope* line0[0]+ intercept;
		line1[0]= centre[0]+ radius*2;
		line1[1]= slope* line1[0]+ intercept;
	}
	return( clip_line_by_circle( line0, line1, centre, radius, begin, end ) );
}
void StochasticProcessWidget::setupDistributionTable(
		const imatrix & distributionMatrix) {
	const int distLb = Lb(distributionMatrix, 1);
	const int distUb = Ub(distributionMatrix, 1);
	const int valueLb = Lb(distributionMatrix, 2);
	const int valueUb = Ub(distributionMatrix, 2);
	const int distCount = distUb - distLb + 1;
	const int valueCount = valueUb - valueLb + 1;

	distTable->setRowCount(valueCount);
	distTable->setColumnCount(distCount);

	QStringList columnHeaders;
	for (int i = distLb; i <= distUb; i++) {
		columnHeaders << QString("S%1").arg(i);
	}

	distTable->setHorizontalHeaderLabels(columnHeaders);

	QStringList rowHeaders;
	for (int i = valueLb; i <= valueUb; i++) {
		rowHeaders << QString("%1").arg(i);
	}

	distTable->setVerticalHeaderLabels(rowHeaders);

	for (int r = distLb; r <= distUb; r++) {
		for (int c = valueLb; c <= valueUb; c++) {
			double
					inf =
							_double(Inf(distributionMatrix[r][c]));
			double
					sup =
							_double(Sup(distributionMatrix[r][c]));

			QString itemText = QString("%1\n%2").arg(sup).arg(inf);

			QTableWidgetItem *newItem =
					new QTableWidgetItem(itemText);
			distTable->setItem(c - valueLb, r - distLb,
					newItem);
		}
	}
}
Beispiel #24
0
    // Calculate Position of Mouse, Ray of Eye, etc, in Scene
    void Interface :: viewCalc(){
        
        //Assumes data has been copied to (or created from) scene transformation matrices (xf)
        vd().z  = Op::sp(Vec::z, !model().rot() * camera().rot() ); 
         
        /// Bottom Left (0,0) to top right (1,1)
        mouse.pos  = Vec( mouse.x / vd().w, 1 - mouse.y / vd().h, 0 ) ;
        mouse.move = Vec( mouse.dx / vd().w, - mouse.dy / vd().h, 0 ) ;
        
        mouse.cat     = Op::sp( mouse.move * -1, !scene().cat() );
        mouse.bivCat = vd().z ^ mouse.cat;

        //GLU FUNCS
        Vec v1 = gfx::GL::unproject( mouse.x, vd().h - mouse.y , 1.0,  scene().xf );
        Vec v2 = gfx::GL::unproject( mouse.x, vd().h - mouse.y , 0.0,  scene().xf );
        Vec v3 = gfx::GL::unproject( mouse.x, vd().h - mouse.y , 0.5,  scene().xf );   

        //OWN FUNCS (in progress, seem to give results scaled differently)
//        Vec3f tv1 = XMat::UnProject( Vec3f( mouse.x, vd().h - mouse.y , 1.0), scene().xf );
//        Vec3f tv2 = XMat::UnProject( Vec3f( mouse.x, vd().h - mouse.y , 0.0),scene().xf );
//        Vec3f tv3 = XMat::UnProject( Vec3f( mouse.x, vd().h - mouse.y , 0.5),scene().xf );
//        
//        Vec v1(tv1.x, tv1.y, tv1.z);
//        Vec v2(tv2.x, tv2.y, tv2.z);
//        Vec v3(tv3.x, tv3.y, tv3.z);
        
 
        
        //Get Line of Mouse Position into Z Space (store as a Dual Line)
		vd().ray	 = Op::dl( Ro::null(v3) ^ v1.null() ^ Inf(1) ).runit();
        
		mouse.projectFar	= v1 ;
		mouse.projectNear	= v2 ;
		mouse.projectMid	= v3 ;

        mouse.biv     = mouse.pos ^ mouse.projectFar; //not used?

        //Point on Line Closest to Origin
        mouse.origin = Ro::null( Fl::loc( vd().ray, Ori(1), true ) );        

    }
    BooleanMappedValue BooleanValueImageEstimator::visit(SPnode * spn) const
    {
		#ifdef MYDEBUG
			std::cout << "in BooleanValueImageEstimator::visit, for " << spn->getNodeName() << std::endl;
		#endif
		
        ivector box = spn->getBox();
		
		#ifdef MYDEBUG
			std::cout << "this box is " << box << std::endl;
        #endif
		
		interval thisRange = fobj(box);
			
		#ifdef MYDEBUG
			std::cout << "this range is " << thisRange << std::endl;
		#endif
		
		return BooleanMappedValue( !(Sup(thisRange) < infCriterion) 
				&& !(Inf(thisRange) > supCriterion) );
    }
Point ScrollListShape::getMinSize(Point cap) const
 {
  Font font=cfg.font.get();

  Point space=+cfg.space;

  FontSize fs=font->getSize();

  Coord off=fs.dy;

  Coord dx=0;
  CoordAcc dy;

  for(ulen index=0,count=info->getLineCount(); index<count ;index++)
    {
     Replace_max(dx,GetLineDX(font,info->getLine(index),off));

     dy.add(fs.dy);
    }

  return 2*space+Inf(Point(dx,dy.value),cap-2*space);
 }
Beispiel #27
0
      static bool is_special(const base_t &i)
	{
	  return is_empty(i) || base_traits<iv_base_t>::is_special(Inf(i)) ||
	    base_traits<iv_base_t>::is_special(Sup(i));
	}
Beispiel #28
0
//----------------------------------------------------------------------------
// Extended interval division 'A / B' where 0 in 'B' is allowed.
//----------------------------------------------------------------------------
xinterval operator% ( const interval& A, const interval& B )
{
  interval  c;
  xinterval Q;

  if ( in(0.0, B) ) {
    if ( in(0.0, A) ) {
      Q.kind = Double;                    // Q = [-oo,+oo] = [-oo,0] v [0,+oo]
      Q.sup  = 0.0;                       //----------------------------------
      Q.inf  = 0.0;
    }
    else if ( B == 0.0 ) {                                          // Q = [/]
      Q.kind = PlusInfty;                                           //--------
      Q.inf  = divd(Sup(A),Inf(B));
    }
    else if ( (Sup(A) < 0.0) && (Sup(B) == 0.0) ) {         // Q = [Q.inf,+oo]
      Q.kind = PlusInfty;                                   //----------------
      Q.inf  = divd(Sup(A),Inf(B));
    }
    else if ( (Sup(A) < 0.0) && (Inf(B) < 0.0) && (Sup(B) > 0.0) ) {
      Q.kind = Double;                        // Q = [-oo,Q.sup] v [Q.inf,+oo]
      Q.sup  = divu(Sup(A),Sup(B));           //------------------------------
      Q.inf  = divd(Sup(A),Inf(B));
    }
    else if ( (Sup(A) < 0.0) && (Inf(B) == 0.0) ) {         // Q = [-oo,Q.sup]
      Q.kind = MinusInfty;                                  //----------------
      Q.sup  = divu(Sup(A),Sup(B));
    }
    else if ( (Inf(A) > 0.0) && (Sup(B) == 0.0) ) {         // Q = [-oo,Q.sup]
      Q.kind = MinusInfty;                                  //----------------
      Q.sup  = divu(Inf(A),Inf(B));
    }
    else if ( (Inf(A) > 0.0) && (Inf(B) < 0.0) && (Sup(B) > 0.0) ) {
      Q.kind = Double;                        // Q = [-oo,Q.sup] v [Q.inf,+oo]
      Q.sup  = divu(Inf(A),Inf(B));           //------------------------------
      Q.inf  = divd(Inf(A),Sup(B));
    }
    else { // if ( (Inf(A) > 0.0) && (Inf(B) == 0.0) )
      Q.kind = PlusInfty;                                   // Q = [Q.inf,+oo]
      Q.inf  = divd(Inf(A),Sup(B));                         //----------------
    }
  } // in(0.0,B)
  else {  // !in(0.0,B)
    c = A / B;                                            // Q = [C.inf,C.sup]
    Q.kind = Finite;                                      //------------------
    Q.inf  = Inf(c);
    Q.sup  = Sup(c);
  }

  return Q;
} // operator%
Beispiel #29
0
      static double my_inf(const base_t &i) 
	{
	  return Inf(i);
	}
Beispiel #30
0
	void makeInf()
	{ x = Inf(); y = Inf(); }