Improve readability by introducing a "infinity()" method to AFSR

This commit is contained in:
Simon Giraudot 2016-01-04 15:03:41 +01:00
parent 11f8381350
commit 8dab6907f7
3 changed files with 22 additions and 20 deletions

View File

@ -26,13 +26,13 @@ struct Perimeter {
double d = 0;
d = sqrt(squared_distance(c->vertex((index+1)%4)->point(),
c->vertex((index+2)%4)->point()));
if(d>bound) return std::numeric_limits<typename AdvancingFront::coord_type>::infinity();
if(d>bound) return adv.infinity();
d += sqrt(squared_distance(c->vertex((index+2)%4)->point(),
c->vertex((index+3)%4)->point()));
if(d>bound) return std::numeric_limits<typename AdvancingFront::coord_type>::infinity();
if(d>bound) return adv.infinity();
d += sqrt(squared_distance(c->vertex((index+1)%4)->point(),
c->vertex((index+3)%4)->point()));
if(d>bound) return std::numeric_limits<typename AdvancingFront::coord_type>::infinity();
if(d>bound) return adv.infinity();
// Otherwise, return usual priority value: smallest radius of
// delaunay sphere

View File

@ -42,13 +42,13 @@ struct Perimeter {
double d = 0;
d = sqrt(squared_distance(c->vertex((index+1)%4)->point(),
c->vertex((index+2)%4)->point()));
if(d>bound) return std::numeric_limits<typename AdvancingFront::coord_type>::infinity();
if(d>bound) return adv.infinity();
d += sqrt(squared_distance(c->vertex((index+2)%4)->point(),
c->vertex((index+3)%4)->point()));
if(d>bound) return std::numeric_limits<typename AdvancingFront::coord_type>::infinity();
if(d>bound) return adv.infinity();
d += sqrt(squared_distance(c->vertex((index+1)%4)->point(),
c->vertex((index+3)%4)->point()));
if(d>bound) return std::numeric_limits<typename AdvancingFront::coord_type>::infinity();
if(d>bound) return adv.infinity();
// Otherwise, return usual priority value: smallest radius of
// delaunay sphere

View File

@ -185,7 +185,7 @@ namespace CGAL {
\tparam P must be a functor with `double operator()(AdvancingFront,Cell_handle,int)` returning the
priority of the facet `(Cell_handle,int)`. This functor enables the user to choose how candidate
triangles are prioritized. If a facet should not appear in the output,
`std::numeric_limits<coord_type>::infinity()` must be returned. It defaults to a functor that returns the
`infinity()` must be returned. It defaults to a functor that returns the
smallest radius of the Delaunay sphere.
*/
@ -663,7 +663,7 @@ namespace CGAL {
Advancing_front_surface_reconstruction(Triangulation_3& dt,
Priority priority = Priority())
: T(dt), _number_of_border(1), COS_ALPHA_SLIVER(-0.86),
NB_BORDER_MAX(15), DELTA(.86), min_K(std::numeric_limits<coord_type>::infinity()),
NB_BORDER_MAX(15), DELTA(.86), min_K(infinity()),
eps(1e-7), inv_eps_2(coord_type(1)/(eps*eps)), eps_3(eps*eps*eps),
STANDBY_CANDIDATE(3), STANDBY_CANDIDATE_BIS(STANDBY_CANDIDATE+1),
NOT_VALID_CANDIDATE(STANDBY_CANDIDATE+2),
@ -1174,6 +1174,8 @@ namespace CGAL {
//=====================================================================
coord_type infinity() const { return std::numeric_limits<coord_type>::infinity(); }
coord_type
smallest_radius_delaunay_sphere(const Cell_handle& c,
const int& index) const
@ -1184,7 +1186,7 @@ namespace CGAL {
|| (c->vertex((index+2) & 3) == added_vertex)
|| (c->vertex((index+3) & 3) == added_vertex) ))
{
return std::numeric_limits<coord_type>::infinity();
return infinity();
}
Cell_handle n = c->neighbor(index);
// lazy evaluation ...
@ -1211,7 +1213,7 @@ namespace CGAL {
(c_is_plane && n_is_infinite)||
(n_is_plane && c_is_infinite)||
my_collinear(cp1, cp2, cp3))
value = std::numeric_limits<coord_type>::infinity();
value = infinity();
else
{
if (c_is_infinite||n_is_infinite||c_is_plane||n_is_plane)
@ -1305,7 +1307,7 @@ namespace CGAL {
Cell_handle c_predone = predone.first.first;
coord_type min_valueP = NOT_VALID_CANDIDATE,
min_valueA = std::numeric_limits<coord_type>::infinity();
min_valueA = infinity();
Facet min_facet, min_facetA;
bool border_facet(false);
@ -1343,7 +1345,7 @@ namespace CGAL {
Edge_like el1(neigh->vertex(n_i1),neigh->vertex(n_i3)),
el2(neigh->vertex(n_i2),neigh->vertex(n_i3));
if ((tmp != std::numeric_limits<coord_type>::infinity())&&
if ((tmp != infinity())&&
neigh->vertex(n_i3)->not_interior()&&
(!is_interior_edge(el1))&&(!is_interior_edge(el2)))
{
@ -1391,7 +1393,7 @@ namespace CGAL {
criteria value;
if ((min_valueA == std::numeric_limits<coord_type>::infinity()) || border_facet) // bad facets case
if ((min_valueA == infinity()) || border_facet) // bad facets case
{
min_facet = Facet(c, i); // !!! sans aucune signification....
value = NOT_VALID_CANDIDATE; // Attention a ne pas inserer dans PQ
@ -1445,7 +1447,7 @@ namespace CGAL {
{
init_timer.start();
Facet min_facet;
coord_type min_value = std::numeric_limits<coord_type>::infinity();
coord_type min_value = infinity();
int i1, i2, i3;
if (!re_init){
@ -1477,7 +1479,7 @@ namespace CGAL {
coord_type value = priority (*this, c, index);
// we might not want the triangle, for example because it is too large
if(value == std::numeric_limits<coord_type>::infinity()){
if(value == infinity()){
value = min_value;
}
@ -1490,7 +1492,7 @@ namespace CGAL {
}
}
if (min_value != std::numeric_limits<coord_type>::infinity())
if (min_value != infinity())
{
Cell_handle c_min = min_facet.first;
@ -1980,7 +1982,7 @@ namespace CGAL {
}
do
{
min_K = std::numeric_limits<coord_type>::infinity(); // pour retenir le prochain K necessaire pour progresser...
min_K = infinity(); // pour retenir le prochain K necessaire pour progresser...
do
{
@ -2042,10 +2044,10 @@ namespace CGAL {
// on augmente progressivement le K mais on a deja rempli sans
// faire des betises auparavant...
}
while((!_ordered_border.empty())&&(K <= K)&&(min_K != std::numeric_limits<coord_type>::infinity()));
while((!_ordered_border.empty())&&(K <= K)&&(min_K != infinity()));
#ifdef VERBOSE
if ((min_K < std::numeric_limits<coord_type>::infinity())&&(!_ordered_border.empty())) {
if ((min_K < infinity())&&(!_ordered_border.empty())) {
std::cout << " [ next K required = " << min_K << " ]" << std::endl;
}
#endif // VERBOSE
@ -2406,7 +2408,7 @@ namespace CGAL {
return false;
}
min_K = std::numeric_limits<coord_type>::infinity();
min_K = infinity();
// fin--
// if (_postprocessing_counter < 5)
// return true;