More clean ups

This commit is contained in:
Efi Fogel 2025-08-26 22:04:00 +03:00
parent a74945062c
commit 81bb832333
15 changed files with 60 additions and 127 deletions

View File

@ -8,7 +8,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s): Baruch Zukerman <baruchzu@post.tau.ac.il>
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
// Simon Giraudot <simon.giraudot@geometryfactory.com>

View File

@ -7,7 +7,7 @@
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s): Baruch Zukerman <baruchzu@post.tau.ac.il>
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ophir Setter <ophir.setter@cs.tau.ac.il>
#ifndef CGAL_BSO_2_GPS_AGG_OP_H

View File

@ -71,7 +71,7 @@ public:
{}
/*! Perform the sweep. */
template <class CurveInputIterator>
template <typename CurveInputIterator>
void sweep(CurveInputIterator curves_begin, CurveInputIterator curves_end,
std::size_t lower, std::size_t upper, std::size_t jump,
std::vector<Arr_entry>& arr_vec) {

View File

@ -8,7 +8,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s): Baruch Zukerman <baruchzu@post.tau.ac.il>
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_BSO_2_GSP_AGG_OP_VISITOR_H
@ -31,8 +31,7 @@ class Gps_agg_op_base_visitor :
Helper_,
typename Default::Get<Visitor_, Gps_agg_op_base_visitor<Helper_,
Arrangement_,
Visitor_> >::type>
{
Visitor_> >::type> {
public:
using Helper = Helper_;
using Arrangement_2 = Arrangement_;
@ -70,8 +69,7 @@ public:
// TODO add mpl-warning
virtual Halfedge_handle insert_in_face_interior(const X_monotone_curve_2& cv,
Subcurve* sc)
{
Subcurve* sc) {
Halfedge_handle he = Base::insert_in_face_interior(cv, sc);
insert_edge_to_hash(he, cv);
return he;
@ -81,8 +79,7 @@ public:
Halfedge_handle hhandle,
Halfedge_handle prev,
Subcurve* sc,
bool& new_face_created)
{
bool& new_face_created) {
Halfedge_handle res_he =
Base::insert_at_vertices(cv, hhandle, prev, sc, new_face_created);
insert_edge_to_hash(res_he, cv);
@ -91,8 +88,7 @@ public:
virtual Halfedge_handle insert_from_right_vertex(const X_monotone_curve_2& cv,
Halfedge_handle he,
Subcurve* sc)
{
Subcurve* sc) {
Halfedge_handle res_he = Base::insert_from_right_vertex(cv, he, sc);
insert_edge_to_hash(res_he, cv);
return res_he;
@ -100,16 +96,14 @@ public:
virtual Halfedge_handle insert_from_left_vertex(const X_monotone_curve_2& cv,
Halfedge_handle he,
Subcurve* sc)
{
Subcurve* sc) {
Halfedge_handle res_he = Base::insert_from_left_vertex(cv, he, sc);
insert_edge_to_hash(res_he, cv);
return res_he;
}
private:
void insert_edge_to_hash(Halfedge_handle he, const X_monotone_curve_2& cv)
{
void insert_edge_to_hash(Halfedge_handle he, const X_monotone_curve_2& cv) {
const Comparison_result he_dir =
((Arr_halfedge_direction)he->direction() == ARR_LEFT_TO_RIGHT) ?
SMALLER : LARGER;
@ -131,10 +125,9 @@ private:
template <typename Helper_, typename Arrangement_, typename Visitor_ = Default>
class Gps_agg_op_visitor :
public Gps_agg_op_base_visitor<Helper_, Arrangement_,
Gps_agg_op_visitor<Helper_, Arrangement_,
Visitor_> >
{
public Gps_agg_op_base_visitor<
Helper_, Arrangement_,
Gps_agg_op_visitor<Helper_, Arrangement_, Visitor_>> {
public:
using Helper = Helper_;
using Arrangement_2 = Arrangement_;

View File

@ -27,7 +27,7 @@ namespace CGAL {
* which determines if we should mark the face as contained given the inside
* count of the face.
*/
template <class Arrangement_, class DerivedVisitor>
template <typename Arrangement_, typename DerivedVisitor>
class Gps_bfs_base_visitor {
using Arrangement = Arrangement_;
using Face_iterator = typename Arrangement::Face_iterator;

View File

@ -9,7 +9,7 @@
//
//
// Author(s): Baruch Zukerman <baruchzu@post.tau.ac.il>
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ophir Setter <ophir.setter@cs.tau.ac.il>
#ifndef CGAL_GPS_BFS_INTERSECTION_VISITOR_H
@ -21,7 +21,7 @@
namespace CGAL {
template <class Arrangement_>
template <typename Arrangement_>
class Gps_bfs_intersection_visitor :
public Gps_bfs_base_visitor<Arrangement_, Gps_bfs_intersection_visitor<Arrangement_>> {
using Arrangement = Arrangement_;

View File

@ -21,7 +21,7 @@
namespace CGAL {
template <class Arrangement_>
template <typename Arrangement_>
class Gps_bfs_xor_visitor :
public Gps_bfs_base_visitor<Arrangement_, Gps_bfs_xor_visitor<Arrangement_>> {
using Arrangement = Arrangement_;
@ -51,9 +51,9 @@ public:
//! after_scan postprocessing after bfs scan.
/*! The function fixes some of the curves, to be in the same direction as the
half-edges.
\param arr The given arrangement.
* half-edges.
*
* \param arr The given arrangement.
*/
void after_scan(Arrangement& arr) {
typedef typename Arrangement::Geometry_traits_2 Traits;
@ -63,9 +63,8 @@ public:
typedef typename Arrangement::Edge_iterator Edge_iterator;
Traits tr;
Compare_endpoints_xy_2 cmp_endpoints =
tr.compare_endpoints_xy_2_object();
Construct_opposite_2 ctr_opp = tr.construct_opposite_2_object();
auto cmp_endpoints = tr.compare_endpoints_xy_2_object();
auto ctr_opp = tr.construct_opposite_2_object();
for (auto eit = arr.edges_begin(); eit != arr.edges_end(); ++eit) {
Halfedge_iterator he = eit;

View File

@ -7,7 +7,7 @@
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s): Baruch Zukerman <baruchzu@post.tau.ac.il>
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
#ifndef CGAL_GPS_MERGE_H
#define CGAL_GPS_MERGE_H
@ -71,7 +71,7 @@ public:
/*! Join_merge is used to join two sets of polygons together in the D&C
* algorithm. It is a base merge with a visitor that joins faces.
*/
template <class Arrangement_>
template <typename Arrangement_>
class Join_merge : public Base_merge<Arrangement_, Gps_bfs_join_visitor<Arrangement_>>
{};
@ -79,7 +79,7 @@ class Join_merge : public Base_merge<Arrangement_, Gps_bfs_join_visitor<Arrangem
/*! Intersection_merge is used to merge two sets of polygons creating their
* intersection.
*/
template <class Arrangement_>
template <typename Arrangement_>
class Intersection_merge : public Base_merge<Arrangement_, Gps_bfs_intersection_visitor<Arrangement_>>
{};
@ -87,7 +87,7 @@ class Intersection_merge : public Base_merge<Arrangement_, Gps_bfs_intersection_
/*! Xor_merge is used to merge two sets of polygons creating their
* symmetric difference.
*/
template <class Arrangement_>
template <typename Arrangement_>
class Xor_merge : public Base_merge<Arrangement_, Gps_bfs_xor_visitor<Arrangement_>>
{};

View File

@ -7,7 +7,6 @@
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Efi Fogel <efifogel@gmail.com>
@ -214,8 +213,7 @@ public:
public:
void operator()(const X_monotone_curve_2& cv, const Point_2 & p,
X_monotone_curve_2& c1, X_monotone_curve_2& c2) const
{
X_monotone_curve_2& c1, X_monotone_curve_2& c2) const {
const auto* base_traits = m_traits.m_base_traits;
auto base_split = base_traits->split_2_object();
base_split(cv.base(), p.base(), c1.base(), c2.base());

View File

@ -8,7 +8,7 @@
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s): Baruch Zukerman <baruchzu@post.tau.ac.il>
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>
// Simon Giraudot <simon.giraudot@geometryfactory.com>

View File

@ -7,7 +7,6 @@
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>

View File

@ -7,7 +7,6 @@
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>

View File

@ -7,7 +7,6 @@
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Baruch Zukerman <baruchzu@post.tau.ac.il>
// Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efif@post.tau.ac.il>

View File

@ -1,48 +0,0 @@
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Boolean_set_operations_2.h>
#include <CGAL/Polygon_set_2.h>
#include <list>
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
int main()
{
CGAL::Polygon_2<K> ob;
ob.push_back(CGAL::Point_2<K>(1, 1));
ob.push_back(CGAL::Point_2<K>(1, 0));
ob.push_back(CGAL::Point_2<K>(6, 0));
ob.push_back(CGAL::Point_2<K>(6, 7));
ob.push_back(CGAL::Point_2<K>(0, 7));
ob.push_back(CGAL::Point_2<K>(0, 1));
CGAL::Polygon_2<K> h;
h.push_back(CGAL::Point_2<K>(2, 1));
h.push_back(CGAL::Point_2<K>(2, 2));
h.push_back(CGAL::Point_2<K>(3, 2));
h.push_back(CGAL::Point_2<K>(3, 3));
h.push_back(CGAL::Point_2<K>(2, 3));
h.push_back(CGAL::Point_2<K>(2, 4));
h.push_back(CGAL::Point_2<K>(3, 4));
h.push_back(CGAL::Point_2<K>(3, 5));
h.push_back(CGAL::Point_2<K>(4, 5));
h.push_back(CGAL::Point_2<K>(4, 1));
CGAL::Polygon_with_holes_2<K> ob_with_holes(ob);
ob_with_holes.add_hole(h);
CGAL::Polygon_set_2<K> inter(ob_with_holes);
CGAL::Polygon_2<K> new_poly;
new_poly.push_back(CGAL::Point_2<K>(1, 1));
new_poly.push_back(CGAL::Point_2<K>(2, 1));
new_poly.push_back(CGAL::Point_2<K>(2, 2));
new_poly.push_back(CGAL::Point_2<K>(2, 3));
new_poly.push_back(CGAL::Point_2<K>(2, 4));
new_poly.push_back(CGAL::Point_2<K>(2, 5));
new_poly.push_back(CGAL::Point_2<K>(3, 5));
new_poly.push_back(CGAL::Point_2<K>(4, 5));
new_poly.push_back(CGAL::Point_2<K>(4, 6));
new_poly.push_back(CGAL::Point_2<K>(1, 6));
inter.difference(new_poly);
}

View File

@ -1,4 +1,3 @@
#include <vector>
#include <CGAL/Simple_cartesian.h>
@ -13,30 +12,27 @@
#include <CGAL/Polygon_set_2.h>
//typedef CGAL::Quotient<CGAL::MP_Float> Number_type;
typedef int Number_type;
using Number_type = int;
typedef CGAL::Simple_cartesian<Number_type> Kernel;
using Kernel = CGAL::Simple_cartesian<Number_type>;
typedef CGAL::Gps_segment_traits_2<Kernel> Traits;
typedef CGAL::Polygon_set_2<Kernel> Ps;
using Traits = CGAL::Gps_segment_traits_2<Kernel>;
using Ps = CGAL::Polygon_set_2<Kernel>;
typedef CGAL::Arr_segment_traits_2<Kernel> Arr_traits;
typedef CGAL::Gps_traits_2<Arr_traits> General_traits;
typedef CGAL::General_polygon_set_2<General_traits> Gps;
using Arr_traits = CGAL::Arr_segment_traits_2<Kernel>;
using General_traits = CGAL::Gps_traits_2<Arr_traits>;
using Gps = CGAL::General_polygon_set_2<General_traits>;
typedef CGAL::Arr_non_caching_segment_traits_2<Kernel> Nc_traits;
typedef CGAL::Gps_segment_traits_2<Kernel,
std::vector<Kernel::Point_2>,
Nc_traits> Traits_non_caching;
typedef CGAL::General_polygon_set_2<Traits_non_caching> Gps_non_caching;
using Nc_traits = CGAL::Arr_non_caching_segment_traits_2<Kernel>;
using Traits_non_caching = CGAL::Gps_segment_traits_2<Kernel, std::vector<Kernel::Point_2>, Nc_traits>;
using Gps_non_caching = CGAL::General_polygon_set_2<Traits_non_caching>;
template <class GPS>
void test()
{
typedef typename GPS::Traits_2 Traits;
typedef typename Traits::Point_2 Point_2;
typedef typename Traits::Polygon_2 Polygon_2;
typedef typename Traits::Polygon_with_holes_2 Polygon_with_holes_2;
template <typename GPS>
void test() {
using Traits = typename GPS::Traits_2;
using Point_2 = typename Traits::Point_2;
using Polygon_2 = typename Traits::Polygon_2;
using Polygon_with_holes_2 = typename Traits::Polygon_with_holes_2;
Polygon_2 pgn1, pgn2;
Polygon_with_holes_2 pgn_with_holes1, pgn_with_holes2;
@ -242,8 +238,7 @@ void test()
GPS new_gps2 = gps;
}
void test_CGAL_Polygon_variants()
{
void test_CGAL_Polygon_variants() {
typedef CGAL::Polygon_2<Kernel> Polygon_2;
typedef CGAL::Polygon_with_holes_2<Kernel> Polygon_with_holes_2;
typedef CGAL::Gps_default_traits<Polygon_2>::Traits Traits;
@ -499,8 +494,7 @@ void test_CGAL_Polygon_variants()
CGAL::complement(pgn_with_holes1, std::back_inserter(result), tr);
}
int main()
{
int main() {
test<Gps>();
test<Ps>();
test<Gps_non_caching>();