mirror of https://github.com/CGAL/cgal
removed the need for the boolean in the is_hidden predicate
This commit is contained in:
parent
4e9630b549
commit
b2029728bb
|
|
@ -23,7 +23,7 @@
|
|||
#ifndef CGAL_APOLLONIUS_GRAPH_2_H
|
||||
#define CGAL_APOLLONIUS_GRAPH_2_H
|
||||
|
||||
//#define CGAL_APOLLONIUS_GRAPH_IS_HIDDEN_THREE_ARGUMENTS 1
|
||||
#define CGAL_APOLLONIUS_GRAPH_PSEUDO_CIRCLE_DESIGN 1
|
||||
|
||||
|
||||
#include <iostream>
|
||||
|
|
@ -775,28 +775,10 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
typedef Boolean_tag<Geom_traits::Is_hidden_2::Has_three_argument_operator>
|
||||
Hidden_predicate_tag;
|
||||
// wrappers for the geometric predicates
|
||||
|
||||
// checks is q is contained inside p
|
||||
bool is_hidden(const Site_2 &p,
|
||||
const Site_2 &q) const;
|
||||
|
||||
// returns true if q is hidden by the sites p1 and p2
|
||||
inline
|
||||
bool is_hidden(const Site_2 &p1, const Site_2 &p2,
|
||||
const Site_2 &q, Tag_false) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
inline
|
||||
bool is_hidden(const Site_2 &p1, const Site_2 &p2,
|
||||
const Site_2 &q, Tag_true) const
|
||||
{
|
||||
return geom_traits().is_hidden_2_object()(p1, p2, q);
|
||||
}
|
||||
bool is_hidden(const Site_2 &p, const Site_2 &q) const;
|
||||
|
||||
// returns:
|
||||
// ON_POSITIVE_SIDE if q is closer to p1
|
||||
|
|
|
|||
|
|
@ -490,29 +490,6 @@ insert_third(const Site_2& p)
|
|||
return v1;
|
||||
}
|
||||
|
||||
#ifdef CGAL_APOLLONIUS_GRAPH_IS_HIDDEN_THREE_ARGUMENTS
|
||||
if ( Geom_traits::Is_hidden_2::Has_three_argument_operator ) {
|
||||
if ( is_hidden(v1->site(), v2->site(), p, Hidden_predicate_tag()) ) {
|
||||
// p is hidden by both v1 and v2
|
||||
v1->add_hidden_site(p);
|
||||
v2->add_hidden_site(p);
|
||||
return Vertex_handle();
|
||||
} else if ( is_hidden(p, v1->site(), v2->site(), Hidden_predicate_tag()) ) {
|
||||
// v2 is hidden by both v1 and p
|
||||
v1->add_hidden_site(v2->site());
|
||||
v2->add_hidden_site(v2->site());
|
||||
v2->set_site(p);
|
||||
return v2;
|
||||
} else if ( is_hidden(v2->site(), p, v1->site(), Hidden_predicate_tag()) ) {
|
||||
// v1 is hidden by both v2 and p
|
||||
v1->add_hidden_site(v1->site());
|
||||
v2->add_hidden_site(v1->site());
|
||||
v1->set_site(p);
|
||||
return v1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Conflict_type ct =
|
||||
finite_edge_conflict_type_degenerated(v1->site(), v2->site(), p);
|
||||
|
||||
|
|
@ -524,7 +501,6 @@ insert_third(const Site_2& p)
|
|||
}
|
||||
|
||||
|
||||
#ifndef CGAL_APOLLONIUS_GRAPH_IS_HIDDEN_THREE_ARGUMENTS
|
||||
Conflict_type ct1 =
|
||||
finite_edge_conflict_type_degenerated(v1->site(), p, v2->site());
|
||||
|
||||
|
|
@ -534,7 +510,7 @@ insert_third(const Site_2& p)
|
|||
if ( ct == NO_CONFLICT && ct1 == NO_CONFLICT && ct2 == NO_CONFLICT ) {
|
||||
return Vertex_handle();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Vertex_handle v = this->_tds.insert_dim_up(infinite_vertex());
|
||||
v->set_site(p);
|
||||
|
|
@ -573,11 +549,6 @@ insert_third(const Site_2& p)
|
|||
}
|
||||
} else {
|
||||
CGAL_assertion( ct == BOTH_VERTICES );
|
||||
#ifdef CGAL_APOLLONIUS_GRAPH_IS_HIDDEN_THREE_ARGUMENTS
|
||||
Conflict_type ct1 =
|
||||
finite_edge_conflict_type_degenerated(v1->site(), p, v2->site());
|
||||
#endif
|
||||
|
||||
Edge_circulator ec =
|
||||
( ct1 == INTERIOR ) ? incident_edges(v2) : incident_edges(v1);
|
||||
while ( true ) {
|
||||
|
|
@ -652,32 +623,15 @@ insert(const Site_2& p, Vertex_handle vnear)
|
|||
do {
|
||||
e = *ec;
|
||||
|
||||
#ifdef CGAL_APOLLONIUS_GRAPH_IS_HIDDEN_THREE_ARGUMENTS
|
||||
if ( Geom_traits::Is_hidden_2::Has_three_argument_operator ) {
|
||||
Vertex_handle v1( e.first->vertex(ccw(e.second)) );
|
||||
Vertex_handle v2( e.first->vertex( cw(e.second)) );
|
||||
if ( !is_infinite(v1) && !is_infinite(v2) &&
|
||||
is_hidden(v1->site(), v2->site(), p, Hidden_predicate_tag()) ) {
|
||||
v1->add_hidden_site(p);
|
||||
v2->add_hidden_site(p);
|
||||
return Vertex_handle();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
interior_in_conflict = edge_interior(e, p, false);
|
||||
|
||||
if ( interior_in_conflict ) { break; }
|
||||
++ec;
|
||||
} while ( ec != ec_start );
|
||||
|
||||
#ifdef CGAL_APOLLONIUS_GRAPH_IS_HIDDEN_THREE_ARGUMENTS
|
||||
if ( !interior_in_conflict ) {
|
||||
return Vertex_handle();
|
||||
}
|
||||
#else
|
||||
CGAL_assertion( interior_in_conflict );
|
||||
#endif
|
||||
|
||||
return insert_degree_2(e, p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,8 +72,6 @@ public:
|
|||
typedef bool result_type;
|
||||
typedef Site_2 argument_type;
|
||||
|
||||
enum { Has_three_argument_operator = false };
|
||||
|
||||
inline bool operator()(const Site_2 &p, const Site_2 &q) const {
|
||||
#ifdef AG2_PROFILE_PREDICATES
|
||||
ag2_predicate_profiler::is_trivial_counter++;
|
||||
|
|
|
|||
|
|
@ -289,14 +289,9 @@ public:
|
|||
Orientation_2;
|
||||
|
||||
|
||||
struct Is_hidden_2
|
||||
: public Filtered_predicate<EK_Is_hidden_2, FK_Is_hidden_2, C2E, C2F>
|
||||
{
|
||||
enum {
|
||||
Has_three_argument_operator =
|
||||
EK_Is_hidden_2::Has_three_argument_operator
|
||||
};
|
||||
};
|
||||
typedef
|
||||
Filtered_predicate<EK_Is_hidden_2, FK_Is_hidden_2, C2E, C2F>
|
||||
Is_hidden_2;
|
||||
|
||||
typedef
|
||||
Filtered_predicate<EK_Oriented_side_of_bisector_2,
|
||||
|
|
|
|||
Loading…
Reference in New Issue