Fix & clean SDG_2

This commit is contained in:
Mael Rouxel-Labbé 2025-03-16 14:25:48 +01:00
parent c5d51c4909
commit e4f30b79fa
20 changed files with 107 additions and 159 deletions

View File

@ -96,9 +96,7 @@ namespace Internal {
template < class Node >
struct Project_site_2 {
typedef Node argument_type;
typedef typename Node::Site_2 Site;
typedef Site result_type;
Site operator()(const Node& x) const {
return x.site();
@ -108,9 +106,7 @@ namespace Internal {
template < class Node, class Site_t >
struct Project_input_to_site_2 {
typedef Node argument_type;
typedef Site_t Site;
typedef Site result_type;
Site operator()(const Node& x) const {
if ( boost::tuples::get<2>(x) /*x.third*/ ) { // it is a point

View File

@ -34,15 +34,13 @@ class Are_parallel_C2
public:
typedef typename K::Site_2 Site_2;
typedef typename K::Boolean Boolean;
typedef Boolean result_type;
typedef Site_2 argument_type;
private:
typedef typename K::Segment_2 Segment_2;
typedef typename K::FT FT;
private:
Boolean predicate(const Site_2& p, const Site_2& q) const {
Boolean predicate(const Site_2& p, const Site_2& q) const {
CGAL_precondition( p.is_segment() && q.is_segment() );
Segment_2 s1 = p.segment();
@ -64,7 +62,7 @@ private:
}
public:
result_type operator()(const Site_2& p, const Site_2& q) const
Boolean operator()(const Site_2& p, const Site_2& q) const
{
return predicate(p, q);
}

View File

@ -75,10 +75,7 @@ private:
}
public:
typedef Boolean result_type;
typedef Site_2 argument_type;
Boolean operator()(const Site_2& p, const Site_2& q) const
Boolean operator()(const Site_2& p, const Site_2& q) const
{
CGAL_precondition( p.is_point() && q.is_point() );

View File

@ -34,10 +34,9 @@ private:
public:
typedef typename K::Site_2 Site_2;
typedef bool result_type;
typedef Site_2 argument_type;
typedef typename K::Boolean Boolean;
bool operator()(const Site_2& p, const Site_2& q) const
Boolean operator()(const Site_2& p, const Site_2& q) const
{
CGAL_precondition( p.is_segment() && q.is_segment() );

View File

@ -70,13 +70,13 @@ private:
Are_same_points_2 same_points;
public:
typedef typename Enum::Arrangement_type result_type;
typedef typename Enum::Arrangement_type Arrangement_type;
private:
result_type compute_type_C2(const RT& x1, const RT& y1,
const RT& x2, const RT& y2,
const RT& x3, const RT& y3,
const RT& x4, const RT& y4) const
Arrangement_type compute_type_C2(const RT& x1, const RT& y1,
const RT& x2, const RT& y2,
const RT& x3, const RT& y3,
const RT& x4, const RT& y4) const
{
RT delta = -determinant<RT>(x2 - x1, x4 - x3, y2 - y1, y4 - y3);
@ -88,7 +88,7 @@ private:
}
}
result_type
Arrangement_type
non_parallel_C2(const RT& x1, const RT& y1, const RT& x2, const RT& y2,
const RT& x3, const RT& y3, const RT& x4, const RT& y4,
const RT& D) const
@ -159,7 +159,7 @@ private:
}
result_type
Arrangement_type
parallel_C2(const RT& x1, const RT& y1, const RT& x2, const RT& y2,
const RT& x3, const RT& y3, const RT& x4, const RT& y4) const
{
@ -326,7 +326,7 @@ private:
//------------------------------------------------------------------------
result_type
Arrangement_type
arrangement_type_same_point(const Site_2& p, const Site_2& q,
unsigned int ip, unsigned int iq) const
{
@ -368,7 +368,7 @@ private:
}
}
result_type
Arrangement_type
arrangement_type_ss(const Site_2& p, const Site_2& q) const
{
bool same_p1q1 = same_points(p.source_site(), q.source_site());
@ -393,17 +393,17 @@ private:
Segment_2 s1 = p.segment();
Segment_2 s2 = q.segment();
result_type res = compute_type_C2( s1.source().x(), s1.source().y(),
s1.target().x(), s1.target().y(),
s2.source().x(), s2.source().y(),
s2.target().x(), s2.target().y() );
Arrangement_type res = compute_type_C2(s1.source().x(), s1.source().y(),
s1.target().x(), s1.target().y(),
s2.source().x(), s2.source().y(),
s2.target().x(), s2.target().y() );
return res;
}
//--------------------------------------------------------------------
result_type
Arrangement_type
arrangement_type_ps(const Site_2& p, const Site_2& q) const
{
if ( same_points(p, q.source_site()) ) {
@ -419,7 +419,7 @@ private:
//--------------------------------------------------------------------
result_type
Arrangement_type
arrangement_type_pp(const Site_2& p, const Site_2& q) const
{
if ( same_points(p, q) ) {
@ -432,10 +432,7 @@ private:
//--------------------------------------------------------------------
public:
typedef Site_2 argument_type;
result_type
Arrangement_type
operator()(const Site_2& p, const Site_2& q) const
{
CGAL_precondition( p.is_defined() && q.is_defined() );

View File

@ -65,13 +65,13 @@ private:
Are_same_points_2 same_points;
public:
typedef typename Enum::Arrangement_type result_type;
typedef typename Enum::Arrangement_type Arrangement_type;
private:
//--------------------------------------------------------------------
result_type
Arrangement_type
arrangement_type_ss(const Site_2& p, const Site_2& q) const
{
bool same_p1q1 = same_points(p.source_site(), q.source_site());
@ -98,7 +98,7 @@ private:
//--------------------------------------------------------------------
result_type
Arrangement_type
arrangement_type_ps(const Site_2& p, const Site_2& q) const
{
if ( same_points(p, q.source_site()) ) {
@ -112,7 +112,7 @@ private:
//--------------------------------------------------------------------
result_type
Arrangement_type
arrangement_type_pp(const Site_2& p, const Site_2& q) const
{
if ( same_points(p, q) ) {
@ -128,7 +128,7 @@ public:
typedef Site_2 argument_type;
result_type
Arrangement_type
operator()(const Site_2& p, const Site_2& q) const
{
CGAL_precondition( p.is_defined() && q.is_defined() );

View File

@ -33,8 +33,7 @@ class Compare_x_2
public:
typedef typename K::Site_2 Site_2;
typedef typename K::Point_2 Point_2;
typedef typename K::Comparison_result result_type;
typedef typename K::Comparison_result Comparison_result;
private:
typedef typename K::Compare_x_2 Kernel_compare_x_2;
@ -42,13 +41,13 @@ private:
public:
inline
result_type operator()(const Point_2& p, const Point_2& q) const
Comparison_result operator()(const Point_2& p, const Point_2& q) const
{
return Kernel_compare_x_2()( p, q );
}
inline
result_type operator()(const Site_2& p, const Site_2& q) const
Comparison_result operator()(const Site_2& p, const Site_2& q) const
{
CGAL_precondition( p.is_point() && q.is_point() );
return Kernel_compare_x_2()( p.point(), q.point() );

View File

@ -34,21 +34,20 @@ class Compare_y_2
public:
typedef typename K::Site_2 Site_2;
typedef typename K::Point_2 Point_2;
typedef typename K::Comparison_result result_type;
typedef typename K::Comparison_result Comparison_result;
private:
typedef typename K::Compare_y_2 Kernel_compare_y_2;
public:
inline
result_type operator()(const Point_2& p, const Point_2& q) const
Comparison_result operator()(const Point_2& p, const Point_2& q) const
{
return Kernel_compare_y_2()( p, q );
}
inline
result_type operator()(const Site_2& p, const Site_2& q) const
Comparison_result operator()(const Site_2& p, const Site_2& q) const
{
CGAL_precondition( p.is_point() && q.is_point() );
return Kernel_compare_y_2()( p.point(), q.point() );

View File

@ -32,111 +32,109 @@ public:
typedef typename Storage_traits::Point_handle Point_handle;
typedef typename Storage_traits::Geom_traits Geom_traits;
typedef Storage_site_2 result_type;
protected:
typedef typename Geom_traits::Intersections_tag ITag;
result_type construct(const Point_handle& h1,
const Point_handle& h2,
const Point_handle& h3,
const Point_handle& h4, const Tag_true&) const {
Storage_site_2 construct(const Point_handle& h1,
const Point_handle& h2,
const Point_handle& h3,
const Point_handle& h4, const Tag_true&) const {
return Storage_site_2::construct_storage_site_2(h1, h2, h3, h4);
}
inline
result_type construct(const Point_handle& h1,
const Point_handle& h2,
const Point_handle& h3,
const Point_handle& h4,
const Point_handle& h5,
const Point_handle& h6, const Tag_true&) const {
Storage_site_2 construct(const Point_handle& h1,
const Point_handle& h2,
const Point_handle& h3,
const Point_handle& h4,
const Point_handle& h5,
const Point_handle& h6, const Tag_true&) const {
return Storage_site_2::construct_storage_site_2(h1, h2, h3, h4, h5, h6);
}
inline
result_type construct(const Point_handle& h1,
const Point_handle& h2,
const Point_handle& h3,
const Point_handle& h4,
bool is_first_exact, const Tag_true&) const {
Storage_site_2 construct(const Point_handle& h1,
const Point_handle& h2,
const Point_handle& h3,
const Point_handle& h4,
bool is_first_exact, const Tag_true&) const {
return Storage_site_2::construct_storage_site_2(h1, h2, h3, h4,
is_first_exact);
}
result_type construct(const Point_handle&,
const Point_handle&,
const Point_handle&,
const Point_handle&, const Tag_false&) const {
Storage_site_2 construct(const Point_handle&,
const Point_handle&,
const Point_handle&,
const Point_handle&, const Tag_false&) const {
CGAL_error();
return Storage_site_2();
}
inline
result_type construct(const Point_handle&,
const Point_handle&,
const Point_handle&,
const Point_handle&,
const Point_handle&,
const Point_handle&, const Tag_false&) const {
Storage_site_2 construct(const Point_handle&,
const Point_handle&,
const Point_handle&,
const Point_handle&,
const Point_handle&,
const Point_handle&, const Tag_false&) const {
CGAL_error();
return Storage_site_2();
}
inline
result_type construct(const Point_handle&,
const Point_handle&,
const Point_handle&,
const Point_handle&,
bool /* is_first_exact */, const Tag_false&) const {
Storage_site_2 construct(const Point_handle&,
const Point_handle&,
const Point_handle&,
const Point_handle&,
bool /* is_first_exact */, const Tag_false&) const {
CGAL_error();
return Storage_site_2();
}
public:
inline
result_type operator()(const Point_handle& h) const {
Storage_site_2 operator()(const Point_handle& h) const {
return Storage_site_2::construct_storage_site_2(h);
}
inline
result_type operator()(const Point_handle& h1,
const Point_handle& h2) const {
Storage_site_2 operator()(const Point_handle& h1,
const Point_handle& h2) const {
return Storage_site_2::construct_storage_site_2(h1, h2);
}
inline
result_type operator()(const Point_handle& h1,
const Point_handle& h2,
const Point_handle& h3,
const Point_handle& h4) const {
Storage_site_2 operator()(const Point_handle& h1,
const Point_handle& h2,
const Point_handle& h3,
const Point_handle& h4) const {
return construct(h1, h2, h3, h4, ITag());
}
inline
result_type operator()(const Point_handle& h1,
const Point_handle& h2,
const Point_handle& h3,
const Point_handle& h4,
const Point_handle& h5,
const Point_handle& h6) const {
Storage_site_2 operator()(const Point_handle& h1,
const Point_handle& h2,
const Point_handle& h3,
const Point_handle& h4,
const Point_handle& h5,
const Point_handle& h6) const {
return construct(h1, h2, h3, h4, h5, h6, ITag());
}
inline
result_type operator()(const Point_handle& h1,
const Point_handle& h2,
const Point_handle& h3,
const Point_handle& h4,
bool is_first_exact) const {
Storage_site_2 operator()(const Point_handle& h1,
const Point_handle& h2,
const Point_handle& h3,
const Point_handle& h4,
bool is_first_exact) const {
return construct(h1, h2, h3, h4, is_first_exact, ITag());
}
// constructs the point of intersection
inline
result_type operator()(const Storage_site_2& ss0,
const Storage_site_2& ss1) const {
Storage_site_2 operator()(const Storage_site_2& ss0,
const Storage_site_2& ss1) const {
CGAL_precondition( ss0.is_segment() && ss1.is_segment() );
return Storage_site_2::construct_storage_site_2
( ss0.source_of_supporting_site(),
@ -329,9 +327,9 @@ public:
// endpoints the point of intersection of ss1 and ss0; the boolean
// determines if the first or segment subsegment is constructed
inline
result_type operator()(const Storage_site_2& ss0,
const Storage_site_2& ss1,
bool first) const {
Storage_site_2 operator()(const Storage_site_2& ss0,
const Storage_site_2& ss1,
bool first) const {
// CGAL_precondition( ss0.is_segment() && ss1.is_segment() );
CGAL_precondition( ss0.is_segment() );
if ( ss1.is_point() ) {

View File

@ -33,8 +33,6 @@ public:
typedef typename Storage_traits::Storage_site_2 Storage_site_2;
typedef typename Storage_traits::Point_handle Point_handle;
typedef Storage_site_2 result_type;
protected:
typedef Construct_storage_site_2<Storage_traits> Base;
typedef typename Storage_traits::Info Info;
@ -42,10 +40,12 @@ protected:
typedef typename Storage_traits::Merge_info Merge_info;
public:
using Base::operator();
// constructs the point of intersection
inline
result_type operator()(const Storage_site_2& ss0,
const Storage_site_2& ss1) const {
Storage_site_2 operator()(const Storage_site_2& ss0,
const Storage_site_2& ss1) const {
Storage_site_2 ssx = Base::operator()(ss0, ss1);
Info infox = Merge_info()(ss0.info(), ss1.info());
ssx.set_info(infox);
@ -56,16 +56,14 @@ public:
// endpoints the point of intersection of ss1 and ss0; the boolean
// determines if the first or segment subsegment is constructed
inline
result_type operator()(const Storage_site_2& ss0,
const Storage_site_2& ss1,
bool first) const {
Storage_site_2 operator()(const Storage_site_2& ss0,
const Storage_site_2& ss1,
bool first) const {
Storage_site_2 s = Base::operator()(ss0, ss1, first);
Info is = Convert_info()(ss0.info(), ss1.info(), first);
s.set_info(is);
return s;
}
using Base::operator();
};

View File

@ -48,29 +48,28 @@ class Construct_sdg_site_2<Site,Tag_true>
public:
typedef Site Site_2;
typedef typename Site_2::Point_2 Point_2;
typedef Site_2 result_type;
public:
result_type operator()(const Point_2& p) const {
Site_2 operator()(const Point_2& p) const {
return Site_2(p);
}
result_type operator()(const Point_2& p0, const Point_2& p1) const {
Site_2 operator()(const Point_2& p0, const Point_2& p1) const {
return Site_2(p0, p1);
}
result_type operator()(const Point_2& p0, const Point_2& p1,
Site_2 operator()(const Point_2& p0, const Point_2& p1,
const Point_2& q0, const Point_2& q1) const {
return Site_2(p0, p1, q0, q1);
}
result_type operator()(const Point_2& p0, const Point_2& p1,
Site_2 operator()(const Point_2& p0, const Point_2& p1,
const Point_2& q0, const Point_2& q1,
bool b) const {
return Site_2(p0, p1, q0, q1, b);
}
result_type operator()(const Point_2& p0, const Point_2& p1,
Site_2 operator()(const Point_2& p0, const Point_2& p1,
const Point_2& q0, const Point_2& q1,
const Point_2& r0, const Point_2& r1) const {
return Site_2(p0, p1, q0, q1, r0, r1);
@ -84,14 +83,13 @@ class Construct_sdg_site_2<Site,Tag_false>
public:
typedef Site Site_2;
typedef typename Site_2::Point_2 Point_2;
typedef Site_2 result_type;
public:
result_type operator()(const Point_2& p) const {
Site_2 operator()(const Point_2& p) const {
return Site_2(p);
}
result_type operator()(const Point_2& p0, const Point_2& p1) const {
Site_2 operator()(const Point_2& p0, const Point_2& p1) const {
return Site_2(p0, p1);
}
};
@ -110,7 +108,6 @@ public:
typedef typename K::Site_2 Site_2;
typedef Voronoi_vertex_C2<K,M> Voronoi_vertex_2;
typedef typename K::Point_2 Point_2;
typedef Point_2 result_type;
public:
Point_2 operator()(const Site_2& s1, const Site_2& s2,
@ -134,7 +131,6 @@ public:
typedef typename Gt::Site_2 Site_2;
typedef Voronoi_vertex_C2<Gt,M> Voronoi_vertex_2;
typedef typename Gt::Circle_2 Circle_2;
typedef Circle_2 result_type;
public:
Circle_2 operator() (const Site_2& s1, const Site_2& s2,
@ -159,7 +155,6 @@ public:
typedef typename Gt::Site_2 Site_2;
typedef typename Gt::Point_2 Point_2;
typedef typename Gt::Line_2 Line_2;
typedef Line_2 result_type;
private:
static
@ -217,7 +212,6 @@ public:
typedef typename Gt::Ray_2 Ray_2;
typedef typename Gt::Construct_svd_vertex_2 Construct_svd_vertex_2;
typedef typename Gt::Equal_2 Equal_2;
typedef Ray_2 result_type;
Ray_2 operator()(const Site_2& p, const Site_2& q,
const Site_2& r) const
@ -268,10 +262,9 @@ public:
typedef typename Gt::Equal_2 Equal_2;
typedef CGAL::Object Object_2;
typedef Object_2 result_type;
result_type operator()(const Site_2& p, const Site_2& q,
const Site_2& r, const Site_2& s) const
Object_2 operator()(const Site_2& p, const Site_2& q,
const Site_2& r, const Site_2& s) const
{
Construct_svd_vertex_2 circumcenter;
Point_2 vpqr = circumcenter(p, q, r);

View File

@ -662,11 +662,8 @@ private:
//------------------------------------------------------------------------
public:
typedef Boolean result_type;
typedef Site_2 argument_type;
Boolean operator()(const Site_2& p, const Site_2& q, const Site_2& r,
const Site_2& s, const Site_2& t, Sign sgn) const
Boolean operator()(const Site_2& p, const Site_2& q, const Site_2& r,
const Site_2& s, const Site_2& t, Sign sgn) const
{
if ( sgn == POSITIVE ) {
return is_interior_in_conflict_none(p, q, r, s, t, Method_tag());

View File

@ -37,16 +37,13 @@ public:
typedef Are_same_points_C2<K> Are_same_points_2;
typedef Are_same_segments_C2<K> Are_same_segments_2;
typedef Boolean result_type;
struct argument_type {};
private:
Are_same_points_2 same_points;
Are_same_segments_2 same_segments;
public:
Boolean operator()(const Site_2& q, const Site_2& s, const Site_2& r,
const Site_2& t, Sign sgn) const
Boolean operator()(const Site_2& q, const Site_2& s, const Site_2& r,
const Site_2& t, Sign sgn) const
{
if ( t.is_segment() ) {
return false;

View File

@ -46,11 +46,8 @@ private:
}
public:
typedef Boolean result_type;
typedef Site_2 argument_type;
Boolean operator()(const Site_2& p, const Site_2& q,
const Site_2& r, const Site_2& s) const
Boolean operator()(const Site_2& p, const Site_2& q,
const Site_2& r, const Site_2& s) const
{
Voronoi_vertex_2 vpqr(p, q, r);
if ( vpqr.incircle_no_easy(s) == POSITIVE ) { return false; }

View File

@ -163,9 +163,6 @@ private:
}
public:
typedef Orientation result_type;
typedef Site_2 argument_type;
Orientation operator()(const Site_2& p, const Site_2& q,
const Site_2& r) const
{

View File

@ -52,8 +52,6 @@ private:
public:
typedef typename Base::Oriented_side Oriented_side;
typedef Oriented_side result_type;
typedef Site_2 argument_type;
// computes the oriented side of the Voronoi vertex of s1, s2, inf
// wrt the line that passes through the point p and its direction

View File

@ -301,10 +301,6 @@ private:
}
public:
typedef Oriented_side result_type;
typedef Site_2 argument_type;
Oriented_side
operator()(const Site_2& t1, const Site_2& t2, const Site_2& q) const
{

View File

@ -2545,8 +2545,6 @@ Segment_Delaunay_graph_2<Gt,ST,D_S,LTag>::
arrangement_type(const Site_2& p, const Site_2& q) const
{
typedef typename Geom_traits::Arrangement_type_2 AT2;
typedef typename AT2::result_type Arrangement_type;
Arrangement_type res = geom_traits().arrangement_type_2_object()(p, q);
// The values that have to be treated are the following:

View File

@ -443,10 +443,6 @@ private:
public:
typedef Site_2 argument_type;
typedef Sign result_type;
Sign operator()(const Site_2& p, const Site_2& q,
const Site_2& r, const Site_2& t) const
{

View File

@ -68,7 +68,6 @@ template<class Info_t>
struct Multi_info_convert_info
{
typedef Info_t Info;
typedef Multi_info<Info> result_type;
inline
Multi_info<Info> operator()(const Multi_info<Info>& minfo0, bool) const
@ -88,7 +87,6 @@ template<class Info_t>
struct Multi_info_merge_info
{
typedef Info_t Info;
typedef Multi_info<Info> result_type;
inline
Multi_info<Info> operator()(const Multi_info<Info>& minfo0,