Example #1
0
bool intersectionIsEmpty(const IntervalObject & v, const IntervalObject &w){

   typename IntervalObject::const_iterator iv = v.begin(), iw = w.begin(), endv = v.end();
   while(iv != endv){
     if((iv->leftBound() > iw->rightBound()) || (iw->leftBound() > iv->rightBound()))
       return true;
     ++iv; ++iw;
   }
   return false;
 }
Example #2
0
void leftObject(const IntervalObject &v, ResultType& result)
{
  typename ResultType::iterator i = result.begin();
  typename IntervalObject::const_iterator b = v.begin(), e=v.end();

  while(b!=e)
  {
    *i = b->leftBound();
    ++i;
    ++b;
  }
 // std::transform(v.begin(), v.end(), result.begin(), leftBound<ScalarType> );
}
Example #3
0
ResultType midObject(const IntervalObject &v)
{
  ResultType result(v.dimension());
  typedef typename ResultType::ScalarType ScalarType;
  typename ResultType::iterator i = result.begin();
  typename IntervalObject::const_iterator b = v.begin(), e=v.end();

  while(b!=e)
  {
    *i = (b->leftBound()+b->rightBound())/ScalarType(2.0);
    ++i;
    ++b;
  }
  return result;
}
Example #4
0
void diameter(const IntervalObject &v, ResultContainer &result)
{
  if(v.dimension()!=result.dimension())
    throw std::range_error("Unequal dimensions in function chomp::vectalg::diameter");
  typedef typename IntervalObject::ScalarType ScalarType;
  typename ResultContainer::iterator i = result.begin();
  typename IntervalObject::const_iterator b = v.begin(), e=v.end();

  while(b!=e)
  {
    *i = (ScalarType(b->rightBound()) - ScalarType(b->leftBound())).rightBound();
    ++i;
    ++b;
  }
}