Min and Max only construct a new node in the DAG, if the intervals overlap

This commit is contained in:
Andreas Fabri 2011-05-31 07:50:41 +00:00
parent 8fbfa4bae1
commit dee65b63f5
1 changed files with 16 additions and 2 deletions

View File

@ -1226,8 +1226,15 @@ struct Min <Lazy_exact_nt<ET> >
Lazy_exact_nt<ET> operator()( const Lazy_exact_nt<ET>& x, const Lazy_exact_nt<ET>& y) const
{
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
return new Lazy_exact_Min<ET>(x, y);
if (x.identical(y)){
return x;
}
Uncertain<bool> res = x.approx() < y.approx();
if(is_certain(res)){
return res.make_certain() ? x : y; ;
}
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
return new Lazy_exact_Min<ET>(x, y);
}
};
@ -1237,6 +1244,13 @@ struct Max <Lazy_exact_nt<ET> >
Lazy_exact_nt<ET> operator()( const Lazy_exact_nt<ET>& x, const Lazy_exact_nt<ET>& y) const
{
if (x.identical(y)){
return x;
}
Uncertain<bool> res = x.approx() > y.approx();
if(is_certain(res)){
return res.make_certain() ? x : y;
}
CGAL_PROFILER(std::string("calls to : ") + std::string(CGAL_PRETTY_FUNCTION));
return new Lazy_exact_Max<ET>(x, y);
}