mirror of https://github.com/CGAL/cgal
add virtual functions to Sliver_criterion and use them :
- get_max_value() to be able to keep the abstract class and derivatives properly - get_perturbation_unit() to replace "delta" in Sliver_perturber (progressive version of perturber is running for bound = i*delta for i >= 1)
This commit is contained in:
parent
3cac42e78e
commit
efd97dd121
|
|
@ -2420,7 +2420,7 @@ min_sliver_value(const Cell_vector& cells,
|
|||
using boost::make_transform_iterator;
|
||||
|
||||
if ( cells.empty() )
|
||||
return SliverCriterion::max_value;
|
||||
return criterion.get_max_value();
|
||||
|
||||
if ( ! use_cache )
|
||||
{
|
||||
|
|
@ -2428,10 +2428,21 @@ min_sliver_value(const Cell_vector& cells,
|
|||
}
|
||||
|
||||
// Return min dihedral angle
|
||||
Sliver_criterion_value<SliverCriterion> sc_value(tr_,criterion);
|
||||
|
||||
return *(std::min_element(make_transform_iterator(cells.begin(),sc_value),
|
||||
make_transform_iterator(cells.end(),sc_value)));
|
||||
//Sliver_criterion_value<SliverCriterion> sc_value(tr_,criterion);
|
||||
//
|
||||
//return *(std::min_element(make_transform_iterator(cells.begin(),sc_value),
|
||||
// make_transform_iterator(cells.end(),sc_value)));
|
||||
FT min = criterion.get_max_value();
|
||||
FT sliver_value = 0.;
|
||||
for(typename Cell_vector::const_iterator it = cells.begin();
|
||||
it != cells.end();
|
||||
++it)
|
||||
{
|
||||
sliver_value = criterion(c3t3_.triangulation().tetrahedron(*it));
|
||||
if( sliver_value < min )
|
||||
min = sliver_value;
|
||||
}
|
||||
return min;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -237,8 +237,7 @@ public:
|
|||
* The perturber runs step by step, using delta as step size.
|
||||
*/
|
||||
Mesh_optimization_return_code
|
||||
operator()(const FT& delta = FT(1.),
|
||||
Visitor visitor = Visitor());
|
||||
operator()(Visitor visitor = Visitor());
|
||||
|
||||
/**
|
||||
* Adds a perturbation at the end of the perturbation queue
|
||||
|
|
@ -388,7 +387,7 @@ Sliver_perturber(C3T3& c3t3,
|
|||
template <typename C3T3, typename Md, typename Sc, typename V_>
|
||||
Mesh_optimization_return_code
|
||||
Sliver_perturber<C3T3,Md,Sc,V_>::
|
||||
operator()(const FT& delta, Visitor visitor)
|
||||
operator()(Visitor visitor)
|
||||
{
|
||||
// Reset sliver value cache
|
||||
helper_.reset_cache();
|
||||
|
|
@ -413,6 +412,7 @@ operator()(const FT& delta, Visitor visitor)
|
|||
<< "(#vertices in pqueue, #iterations, #fails)" << std::endl;
|
||||
#endif
|
||||
|
||||
const FT& delta = sliver_criterion_.get_perturbation_unit();
|
||||
FT current_bound = delta;
|
||||
bool perturbation_ok = true;
|
||||
while ( current_bound <= sliver_bound() && perturbation_ok)
|
||||
|
|
|
|||
|
|
@ -37,6 +37,11 @@ class Sliver_criterion
|
|||
{
|
||||
typedef typename K::Tetrahedron_3 Tetrahedron_3;
|
||||
|
||||
public:
|
||||
virtual const double get_max_value() const = 0;
|
||||
//Sliver_perturber performs perturbation "unit-per-unit"
|
||||
// so it needs to know how much is a unit for each criterion
|
||||
virtual const double get_perturbation_unit() const = 0;
|
||||
public:
|
||||
virtual double operator()(const Tetrahedron_3& t) const = 0;
|
||||
};
|
||||
|
|
@ -50,7 +55,10 @@ public:
|
|||
static double default_value;
|
||||
static double max_value;
|
||||
static double min_value;
|
||||
|
||||
|
||||
virtual const double get_max_value() const { return 90.; }
|
||||
virtual const double get_perturbation_unit() const { return 1.; }
|
||||
|
||||
double operator()(const Tetrahedron_3& t) const
|
||||
{
|
||||
return CGAL::to_double(minimum_dihedral_angle(t, K()));
|
||||
|
|
@ -71,7 +79,10 @@ public:
|
|||
static double default_value;
|
||||
static double max_value;
|
||||
static double min_value;
|
||||
|
||||
|
||||
virtual const double get_max_value() const { return 1.; }
|
||||
virtual const double get_perturbation_unit() const { return 0.05; }
|
||||
|
||||
double operator()(const Tetrahedron_3& t) const
|
||||
{
|
||||
return CGAL::to_double(radius_ratio(t, K()));
|
||||
|
|
|
|||
Loading…
Reference in New Issue