From b9dd331b89c29e69b790cc291c2f75a9c2f9550f Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 28 Jan 2021 14:47:28 +0100 Subject: [PATCH 01/26] Document the `Triangulation_2_projection_traits_3` class. --- .../Triangulation_2_projection_traits_3.h | 79 +++++++++++++++++++ .../Triangulation_2/PackageDescription.txt | 2 + 2 files changed, 81 insertions(+) create mode 100644 Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h new file mode 100644 index 00000000000..232199ec165 --- /dev/null +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h @@ -0,0 +1,79 @@ +namespace CGAL{ + +/*! + \ingroup PkgTriangulation2TriangulationClasses + + The class `Triangulation_2_projection_traits_3` is an extension of the `Projection_traits_xy_3`, + `Projection_traits_xz_3` and `Projection_traits_yz_3` traits classes,that allows the use + of 2D algorithms on the projections of 3D data on any plane. + + \cgalHeading{Parameters} + The template parameter `K` has to + be instantiated by a model of the `K` concept. + `Triangulation_2_projection_traits_3` uses types + and predicates defined in `K`. + +\cgalModels `TriangulationTraits_2` +\cgalModels `DelaunayTriangulationTraits_2` +\cgalModels `ConstrainedTriangulationTraits_2` + + */ +template +class Triangulation_2_projection_traits_3 +{ +public: + ///\name Types + ///@{ + + //! + typedef typename K::Point_3 Point_2; + //! + typedef typename K::Segment_3 Segment_2; + //! + typedef typename K::Triangle_3 Triangle_2; + //! + typedef typename K::Line_3 Line_2; + + ///@} + + + /// \name Functors + /// The functors provided by this class are those listed in the + /// concepts. The functors operate on the 2D projection of their + /// arguments. They come with preconditions that projections of the + /// arguments are non-degenerate, eg. a line segment does not project + /// on a single point, two points do not project on the same point, etc. + /// The following functor is an addition to the concepts. + /// @{ + + /*! + \brief Projects a 3D point on a plane oriented by the traits. + + A construction object. + Provides the constructor: + + `Projection_to_plan(const Point_2& plane_point, const Triangulation_2_projection_traits_3& tr)` + + and the operator + + `Point_2 operator()(const Point_2& point) const` + + which returns the projection of a `point` to a plane passing through + the point 'plane_point' and with orthogonal vector `normal`, the vector given to the traits constructor. + */ + typedef unspecified_type Projection_to_plan; + ///@} + + /// \name Creation + ///@{ + + /*! + * \brief Constructor + * + * \param normal a vector orthogonal to the projection plane. + */ + Triangulation_2_projection_traits_3(const typename K::Vector_3& normal); + + ///@} +}; +} // end namespace CGAL diff --git a/Triangulation_2/doc/Triangulation_2/PackageDescription.txt b/Triangulation_2/doc/Triangulation_2/PackageDescription.txt index 333b051af09..85ec901659c 100644 --- a/Triangulation_2/doc/Triangulation_2/PackageDescription.txt +++ b/Triangulation_2/doc/Triangulation_2/PackageDescription.txt @@ -103,6 +103,8 @@ are described in Chapter \ref PkgTDS2Ref "2D Triangulation Data Structure". - `CGAL::Triangulation_cw_ccw_2` +- `CGAL::Triangulation_2_projection_traits_3` + \cgalCRPSection{Enum} - \link CGAL::Triangulation_2::Locate_type `CGAL::Triangulation_2::Locate_type` \endlink From b078418a85661aadea0b5b66d91473009bae6c12 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 28 Jan 2021 15:26:58 +0100 Subject: [PATCH 02/26] Add an example --- .../doc/Triangulation_2/examples.txt | 1 + .../Triangulation_2/projection_traits.cpp | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 Triangulation_2/examples/Triangulation_2/projection_traits.cpp diff --git a/Triangulation_2/doc/Triangulation_2/examples.txt b/Triangulation_2/doc/Triangulation_2/examples.txt index 459982e56a2..875b922e64e 100644 --- a/Triangulation_2/doc/Triangulation_2/examples.txt +++ b/Triangulation_2/doc/Triangulation_2/examples.txt @@ -22,4 +22,5 @@ \example Triangulation_2/segment_soup_to_polylines.cpp \example Triangulation_2/draw_triangulation_2.cpp \example Triangulation_2/low_dimensional.cpp +\example Triangulation_2/projection_traits.cpp */ diff --git a/Triangulation_2/examples/Triangulation_2/projection_traits.cpp b/Triangulation_2/examples/Triangulation_2/projection_traits.cpp new file mode 100644 index 00000000000..c4882ffac8a --- /dev/null +++ b/Triangulation_2/examples/Triangulation_2/projection_traits.cpp @@ -0,0 +1,39 @@ +#include +#include +#include + +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K1; +typedef CGAL::Triangulation_2_projection_traits_3 K; + +typedef CGAL::Exact_predicates_tag Itag; +typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; +typedef CDT::Point Point; +typedef CDT::Edge Edge; + +int main() +{ + //4 points on the diagonal plane of a cube + std::vector ps(4); + ps[0] = Point(0,0,0); + ps[1] = Point(3,1,-1); + ps[2] = Point(-1, 3, -3); + ps[3] = Point(1,0.5,-0.5); + + K gt{ { 0, 1, 1} }; + CDT cdt(gt); + for(int i = 0; i< 4; ++i) + cdt.insert(ps[i]); + + for (int i = 1; i < 3; ++i) + cdt.insert_constraint( ps[i], ps[i+1]); + + for (CDT::Face_handle f : cdt.all_face_handles()) + { + for(int i=0; i<3; ++i) + std::cout<vertex(i)->point()<<" "; + std::cout< Date: Wed, 17 Feb 2021 12:35:12 +0100 Subject: [PATCH 03/26] Apply reviewer's modifications --- .../Kernel_23/CGAL/Projection_traits_xy_3.h | 7 +---- .../Triangulation_2_projection_traits_3.h | 30 ++++++++----------- .../Triangulation_2/PackageDescription.txt | 2 +- .../Triangulation_2/projection_traits.cpp | 10 +++---- 4 files changed, 20 insertions(+), 29 deletions(-) diff --git a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h index 56b476d9735..dfbab97bff1 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h @@ -13,12 +13,7 @@ deal with projections on the `zx`- and the `zy`-plane, respectively. -\cgalHeading{Parameters} - -The template parameter `K` has to -be instantiated by a model of the `Kernel` concept. -`Projection_traits_xy_3` uses types -and predicates defined in `K`. +\tparam K must be a model of `Kernel`. \cgalModels The class is a model of several 2D triangulation traits class concepts, except that it does not provide the type and constructors diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h index 232199ec165..52c8a0ed4d4 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h @@ -4,14 +4,16 @@ namespace CGAL{ \ingroup PkgTriangulation2TriangulationClasses The class `Triangulation_2_projection_traits_3` is an extension of the `Projection_traits_xy_3`, - `Projection_traits_xz_3` and `Projection_traits_yz_3` traits classes,that allows the use - of 2D algorithms on the projections of 3D data on any plane. + `Projection_traits_xz_3` and `Projection_traits_yz_3` traits classes, that enables + using 2D algorithms on the projections of 3D data on any plane. - \cgalHeading{Parameters} - The template parameter `K` has to - be instantiated by a model of the `K` concept. - `Triangulation_2_projection_traits_3` uses types - and predicates defined in `K`. + \tparam K must be a model of `Kernel` + + \note Internal constructions (projections) are used in the predicate and +construction functors of this class. If `K` is a model of `Kernel` providing exact +constructions or if `K` is a `CGAL::Filtered_kernel` (such as for +`CGAL::Exact_predicates_inexact_constructions_kernel`), this class automatically +provides exact predicates. \cgalModels `TriangulationTraits_2` \cgalModels `DelaunayTriangulationTraits_2` @@ -27,12 +29,6 @@ public: //! typedef typename K::Point_3 Point_2; - //! - typedef typename K::Segment_3 Segment_2; - //! - typedef typename K::Triangle_3 Triangle_2; - //! - typedef typename K::Line_3 Line_2; ///@} @@ -47,21 +43,21 @@ public: /// @{ /*! - \brief Projects a 3D point on a plane oriented by the traits. + \brief projects a 3D point on a plane oriented by the traits. A construction object. Provides the constructor: `Projection_to_plan(const Point_2& plane_point, const Triangulation_2_projection_traits_3& tr)` - and the operator + and the operator: `Point_2 operator()(const Point_2& point) const` - which returns the projection of a `point` to a plane passing through + which returns the projection of the (3D) point `point` onto the plane passing through the point 'plane_point' and with orthogonal vector `normal`, the vector given to the traits constructor. */ - typedef unspecified_type Projection_to_plan; + typedef unspecified_type Projection_to_plane; ///@} /// \name Creation diff --git a/Triangulation_2/doc/Triangulation_2/PackageDescription.txt b/Triangulation_2/doc/Triangulation_2/PackageDescription.txt index 85ec901659c..5c79788e277 100644 --- a/Triangulation_2/doc/Triangulation_2/PackageDescription.txt +++ b/Triangulation_2/doc/Triangulation_2/PackageDescription.txt @@ -103,7 +103,7 @@ are described in Chapter \ref PkgTDS2Ref "2D Triangulation Data Structure". - `CGAL::Triangulation_cw_ccw_2` -- `CGAL::Triangulation_2_projection_traits_3` +- `CGAL::Triangulation_2_projection_traits_3` \cgalCRPSection{Enum} - \link CGAL::Triangulation_2::Locate_type `CGAL::Triangulation_2::Locate_type` \endlink diff --git a/Triangulation_2/examples/Triangulation_2/projection_traits.cpp b/Triangulation_2/examples/Triangulation_2/projection_traits.cpp index c4882ffac8a..32812a543c3 100644 --- a/Triangulation_2/examples/Triangulation_2/projection_traits.cpp +++ b/Triangulation_2/examples/Triangulation_2/projection_traits.cpp @@ -5,13 +5,13 @@ #include #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel K1; -typedef CGAL::Triangulation_2_projection_traits_3 K; +typedef CGAL::Exact_predicates_inexact_constructions_kernel K1; +typedef CGAL::Triangulation_2_projection_traits_3 K; -typedef CGAL::Exact_predicates_tag Itag; +typedef CGAL::Exact_predicates_tag Itag; typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; -typedef CDT::Point Point; -typedef CDT::Edge Edge; +typedef CDT::Point Point; +typedef CDT::Edge Edge; int main() { From 2e77ad352d7d248367ded606bfe30b4c1f336d26 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 17 Feb 2021 12:39:39 +0100 Subject: [PATCH 04/26] Fix plan to plane --- .../CGAL/Triangulation_2_projection_traits_3.h | 2 +- .../Triangulation_2_projection_traits_base_3.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h index 52c8a0ed4d4..f4b525e3f7f 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h @@ -48,7 +48,7 @@ public: A construction object. Provides the constructor: - `Projection_to_plan(const Point_2& plane_point, const Triangulation_2_projection_traits_3& tr)` + `Projection_to_plane(const Point_2& plane_point, const Triangulation_2_projection_traits_3& tr)` and the operator: diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h index 984d2381035..1cc4a49dae7 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h +++ b/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h @@ -463,14 +463,14 @@ public: // Special functor, not in the Kernel concept - class Projection_to_plan { + class Projection_to_plane { // Remeber: Point_2 is K::Point_3 const Point_2& plane_point; const Vector_3& normal; public: // Return the projection of a point to a plane passing through // the point 'plane_point' and with orthogonal vector normal(). - Projection_to_plan(const Point_2& plane_point_, const Self& self) + Projection_to_plane(const Point_2& plane_point_, const Self& self) : plane_point(plane_point_), normal(self.normal()) {} @@ -480,11 +480,11 @@ public: return point + ( ( (plane_point - point) * normal ) / (normal * normal) ) * normal; } - }; // end Projection_to_plan + }; // end Projection_to_plane - Projection_to_plan projection_to_plan_object(const Point_2& plane_point) const + Projection_to_plane projection_to_plane_object(const Point_2& plane_point) const { - return Projection_to_plan(plane_point, *this); + return Projection_to_plane(plane_point, *this); } }; // end class Triangulation_2_projection_traits_base_3 From 2de090c0334da42c25023fd816d69c1538242c7d Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 17 Feb 2021 13:18:07 +0100 Subject: [PATCH 05/26] fix 'plane_point' --- .../Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h index f4b525e3f7f..f00c2703910 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h @@ -55,7 +55,7 @@ public: `Point_2 operator()(const Point_2& point) const` which returns the projection of the (3D) point `point` onto the plane passing through - the point 'plane_point' and with orthogonal vector `normal`, the vector given to the traits constructor. + the point `plane_point` and with orthogonal vector `normal`, the vector given to the traits constructor. */ typedef unspecified_type Projection_to_plane; ///@} From b3ccd431f8e3fe8966fe2fcc7b22354fd89763f3 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 18 Feb 2021 11:38:31 +0100 Subject: [PATCH 06/26] Remove doc about functor --- .../Triangulation_2_projection_traits_3.h | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h index f00c2703910..92657703bc6 100644 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h +++ b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h @@ -39,25 +39,6 @@ public: /// arguments. They come with preconditions that projections of the /// arguments are non-degenerate, eg. a line segment does not project /// on a single point, two points do not project on the same point, etc. - /// The following functor is an addition to the concepts. - /// @{ - - /*! - \brief projects a 3D point on a plane oriented by the traits. - - A construction object. - Provides the constructor: - - `Projection_to_plane(const Point_2& plane_point, const Triangulation_2_projection_traits_3& tr)` - - and the operator: - - `Point_2 operator()(const Point_2& point) const` - - which returns the projection of the (3D) point `point` onto the plane passing through - the point `plane_point` and with orthogonal vector `normal`, the vector given to the traits constructor. - */ - typedef unspecified_type Projection_to_plane; ///@} /// \name Creation From d2ba62aa21a6991cdfbf5483a3c8b4562693037f Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 10 Mar 2021 12:25:24 +0100 Subject: [PATCH 07/26] Fixes in concepts and addition of missing functors for complyance to PolygonTraits_2. --- .../Concepts/FunctionObjectConcepts.h | 8 ++-- ...Triangulation_2_projection_traits_base_3.h | 40 +++++++++++++++++++ 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h index 44e13cfbbe4..552513babaf 100644 --- a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h +++ b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h @@ -8887,7 +8887,7 @@ public: /*! returns true iff the \f$ x\f$-coordinate of `p` is smaller than the - \f$ x\f$-coordinate of `q` or if the are the same and + \f$ x\f$-coordinate of `q` or if they are the same and the \f$ y\f$-coordinate of `p` is smaller than the \f$ y\f$-coordinate of `q`, or, if both \f$ x\f$- and \f$ y\f$- coordinate are identical and the \f$ z\f$-coordinate of `p` is smaller than the \f$ z\f$-coordinate of `q`. @@ -8917,7 +8917,7 @@ public: /*! returns true iff the \f$ x\f$-coordinate of `p` is smaller than the - \f$ x\f$-coordinate of `q` or if the are the same and + \f$ x\f$-coordinate of `q` or if they are the same and the \f$ y\f$-coordinate of `p` is smaller than the \f$ y\f$-coordinate of `q`. */ bool operator()(const Kernel::Point_2&p, @@ -8946,7 +8946,7 @@ public: /*! returns true iff the \f$ x\f$-coordinate of `p` is smaller than the - \f$ x\f$-coordinate of `q` or if the are the same and + \f$ x\f$-coordinate of `q` or if they are the same and the \f$ y\f$-coordinate of `p` is smaller than the \f$ y\f$-coordinate of `q`. */ bool operator()(const Kernel::Point_3&p, @@ -9029,7 +9029,7 @@ public: /*! returns true iff the \f$ y\f$-coordinate of `p` is smaller than the - \f$ y\f$-coordinate of `q` or if the are the same and + \f$ y\f$-coordinate of `q` or if they are the same and the \f$ x\f$-coordinate of `p` is smaller than the \f$ x\f$-coordinate of `q`. */ bool operator()(const Kernel::Point_2&p, diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h index 1cc4a49dae7..9776bbe7a8d 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h +++ b/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h @@ -260,6 +260,30 @@ public: } }; // end class Less_along_axis +template +class Less_along_2_axis +{ + // private members + typedef typename Traits::Vector_3 Vector_3; + typedef typename Traits::Point_2 Point; + Vector_3 base1; + Vector_3 base2; +public: + Less_along_2_axis(const Vector_3& base1, const Vector_3& base2) + : base1(base1), base2(base2) + { + CGAL_PROFILER("Construct Less_along_axis") + CGAL_TIME_PROFILER("Construct Less_along_axis") + } + + typedef bool result_type; + + bool operator() (const Point &p, const Point &q) const { + return base1 * (p - q) < 0 + || base1 * (p - q) == 0 && base2 * (p - q) < 0; + } +}; // end class Less_along_axis + template class Compare_along_axis { @@ -345,6 +369,10 @@ public: Less_along_axis Less_x_2; typedef TriangulationProjectionTraitsCartesianFunctors:: Less_along_axis Less_y_2; + typedef TriangulationProjectionTraitsCartesianFunctors:: + Less_along_2_axis Less_xy_2; + typedef TriangulationProjectionTraitsCartesianFunctors:: + Less_along_2_axis Less_yx_2; typedef TriangulationProjectionTraitsCartesianFunctors:: Projected_orientation_with_normal_3 Orientation_2; @@ -385,6 +413,18 @@ public: return Less_y_2(this->base2()); } + Less_xy_2 + less_xy_2_object() const + { + return Less_xy_2(this->base1(), this->base2()); + } + + Less_yx_2 + less_yx_2_object() const + { + return Less_yx_2(this->base2(), this->base1()); + } + Compare_x_2 compare_x_2_object() const { From 7f334a0133e36826842e3d048e83331966bbc3ec Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 10 Mar 2021 13:33:01 +0100 Subject: [PATCH 08/26] save intermediary result to avoid computing it up to 3 times in Less_along_2_axis --- .../internal/Triangulation_2_projection_traits_base_3.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h index 9776bbe7a8d..0de71bfc7c0 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h +++ b/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h @@ -279,8 +279,9 @@ public: typedef bool result_type; bool operator() (const Point &p, const Point &q) const { - return base1 * (p - q) < 0 - || base1 * (p - q) == 0 && base2 * (p - q) < 0; + auto proj = base1 * (p - q); + return proj < 0 + || proj == 0 && proj < 0; } }; // end class Less_along_axis From 6bcdda823d969d03a71df7f36589e26ba3f53110 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 10 Mar 2021 14:11:10 +0100 Subject: [PATCH 09/26] Remove unnecessary requirements from 2 concepts --- .../ConstrainedTriangulationTraits_2.h | 5 ---- .../Concepts/TriangulationTraits_2.h | 23 ------------------- 2 files changed, 28 deletions(-) diff --git a/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h b/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h index 0a26f8ee02d..75b3132af61 100644 --- a/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h +++ b/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h @@ -50,11 +50,6 @@ typedef unspecified_type Intersect_2; /// When the constrained triangulation is instantiated with the intersection tag `CGAL::Exact_predicates_tag`, the used algorithm needs to be able to compare some distances between points and lines and the following types are further required. /// @{ -/*! -A number type supporting the comparison operator `<`. -*/ -typedef unspecified_type RT; - /*! The line type. */ diff --git a/Triangulation_2/doc/Triangulation_2/Concepts/TriangulationTraits_2.h b/Triangulation_2/doc/Triangulation_2/Concepts/TriangulationTraits_2.h index 0329639d1aa..f7158d6679c 100644 --- a/Triangulation_2/doc/Triangulation_2/Concepts/TriangulationTraits_2.h +++ b/Triangulation_2/doc/Triangulation_2/Concepts/TriangulationTraits_2.h @@ -187,29 +187,6 @@ typedef unspecified_type Construct_circumcenter_2; /// @} -/// \name Creation -/// Only a default constructor, copy constructor and an assignment -/// operator are required. Note that further constructors can be -/// provided. -/// @{ - -/*! -default constructor. -*/ -TriangulationTraits_2(); - -/*! -Copy constructor -*/ -TriangulationTraits_2(TriangulationTraits_2 gtr); - -/*! -Assignment operator. -*/ -TriangulationTraits_2 operator=(TriangulationTraits_2 gtr); - -/// @} - /// \name Predicate Functions /// The following functions give access to the predicate and /// constructor objects. From 93e060591c3e1c2137e0a4835fde14a7dcd55322 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 10 Mar 2021 14:44:56 +0100 Subject: [PATCH 10/26] Move the traits class in Kernel_23 --- Kernel_23/doc/Kernel_23/Doxyfile.in | 1 + .../doc/Kernel_23/PackageDescription.txt | 1 + Kernel_23/doc/Kernel_23/examples.txt | 1 + .../Triangulation_2_projection_traits_3.h | 56 -- .../Triangulation_2/PackageDescription.txt | 2 - .../doc/Triangulation_2/Triangulation_2.txt | 4 +- .../doc/Triangulation_2/examples.txt | 1 - ...ngulation_2_filtered_projection_traits_3.h | 81 --- ...Triangulation_2_projection_traits_base_3.h | 535 ------------------ .../Triangulation_2_projection_traits_3.h | 52 -- 10 files changed, 6 insertions(+), 728 deletions(-) delete mode 100644 Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h delete mode 100644 Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_filtered_projection_traits_3.h delete mode 100644 Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h delete mode 100644 Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h diff --git a/Kernel_23/doc/Kernel_23/Doxyfile.in b/Kernel_23/doc/Kernel_23/Doxyfile.in index 14a2e4d6328..b78b82fb7d0 100644 --- a/Kernel_23/doc/Kernel_23/Doxyfile.in +++ b/Kernel_23/doc/Kernel_23/Doxyfile.in @@ -2,3 +2,4 @@ PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - 2D and 3D Linear Geometry Kernel" EXAMPLE_PATH += ${CGAL_Filtered_kernel_EXAMPLE_DIR} +EXAMPLE_PATH += ${CGAL_Triangulation_2_EXAMPLE_DIR} diff --git a/Kernel_23/doc/Kernel_23/PackageDescription.txt b/Kernel_23/doc/Kernel_23/PackageDescription.txt index 54fa6580087..40d72ba9db2 100644 --- a/Kernel_23/doc/Kernel_23/PackageDescription.txt +++ b/Kernel_23/doc/Kernel_23/PackageDescription.txt @@ -71,6 +71,7 @@ - `CGAL::Simple_cartesian` - `CGAL::Simple_homogeneous` - `CGAL::Projection_traits_xy_3` +- `CGAL::Triangulation_2_projection_traits_3` \cgalCRPSection{Predefined Kernels} diff --git a/Kernel_23/doc/Kernel_23/examples.txt b/Kernel_23/doc/Kernel_23/examples.txt index 6b38afbd27a..f368c37477f 100644 --- a/Kernel_23/doc/Kernel_23/examples.txt +++ b/Kernel_23/doc/Kernel_23/examples.txt @@ -13,4 +13,5 @@ \example Kernel_23/points_and_segment.cpp \example Kernel_23/surprising.cpp \example Kernel_23/exact.cpp +\example Triangulation_2/projection_traits.cpp */ diff --git a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h b/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h deleted file mode 100644 index 92657703bc6..00000000000 --- a/Triangulation_2/doc/Triangulation_2/CGAL/Triangulation_2_projection_traits_3.h +++ /dev/null @@ -1,56 +0,0 @@ -namespace CGAL{ - -/*! - \ingroup PkgTriangulation2TriangulationClasses - - The class `Triangulation_2_projection_traits_3` is an extension of the `Projection_traits_xy_3`, - `Projection_traits_xz_3` and `Projection_traits_yz_3` traits classes, that enables - using 2D algorithms on the projections of 3D data on any plane. - - \tparam K must be a model of `Kernel` - - \note Internal constructions (projections) are used in the predicate and -construction functors of this class. If `K` is a model of `Kernel` providing exact -constructions or if `K` is a `CGAL::Filtered_kernel` (such as for -`CGAL::Exact_predicates_inexact_constructions_kernel`), this class automatically -provides exact predicates. - -\cgalModels `TriangulationTraits_2` -\cgalModels `DelaunayTriangulationTraits_2` -\cgalModels `ConstrainedTriangulationTraits_2` - - */ -template -class Triangulation_2_projection_traits_3 -{ -public: - ///\name Types - ///@{ - - //! - typedef typename K::Point_3 Point_2; - - ///@} - - - /// \name Functors - /// The functors provided by this class are those listed in the - /// concepts. The functors operate on the 2D projection of their - /// arguments. They come with preconditions that projections of the - /// arguments are non-degenerate, eg. a line segment does not project - /// on a single point, two points do not project on the same point, etc. - ///@} - - /// \name Creation - ///@{ - - /*! - * \brief Constructor - * - * \param normal a vector orthogonal to the projection plane. - */ - Triangulation_2_projection_traits_3(const typename K::Vector_3& normal); - - ///@} -}; -} // end namespace CGAL diff --git a/Triangulation_2/doc/Triangulation_2/PackageDescription.txt b/Triangulation_2/doc/Triangulation_2/PackageDescription.txt index 5c79788e277..333b051af09 100644 --- a/Triangulation_2/doc/Triangulation_2/PackageDescription.txt +++ b/Triangulation_2/doc/Triangulation_2/PackageDescription.txt @@ -103,8 +103,6 @@ are described in Chapter \ref PkgTDS2Ref "2D Triangulation Data Structure". - `CGAL::Triangulation_cw_ccw_2` -- `CGAL::Triangulation_2_projection_traits_3` - \cgalCRPSection{Enum} - \link CGAL::Triangulation_2::Locate_type `CGAL::Triangulation_2::Locate_type` \endlink diff --git a/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt b/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt index 009f3845620..43e0475b859 100644 --- a/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt +++ b/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt @@ -487,7 +487,9 @@ See Section \ref Section_2D_Triangulations_Delaunay for an example. `Projection_traits_xz_3` to deal with projections on the `yz` plane and `xz`-plane, -respectively. +respectively, as well as the geometric traits class +`Triangulation_2_projection_traits_3` that deals with projections on an +arbitrary plane, defined by its orthogonal vector. \subsection Subsection_2D_Triangulations_Basic_Example Example of a Basic Triangulation diff --git a/Triangulation_2/doc/Triangulation_2/examples.txt b/Triangulation_2/doc/Triangulation_2/examples.txt index 875b922e64e..459982e56a2 100644 --- a/Triangulation_2/doc/Triangulation_2/examples.txt +++ b/Triangulation_2/doc/Triangulation_2/examples.txt @@ -22,5 +22,4 @@ \example Triangulation_2/segment_soup_to_polylines.cpp \example Triangulation_2/draw_triangulation_2.cpp \example Triangulation_2/low_dimensional.cpp -\example Triangulation_2/projection_traits.cpp */ diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_filtered_projection_traits_3.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_filtered_projection_traits_3.h deleted file mode 100644 index 5bf5849d485..00000000000 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_filtered_projection_traits_3.h +++ /dev/null @@ -1,81 +0,0 @@ - // Copyright (c) 2009 GeometryFactory (France) -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Laurent Rineau - - -#ifndef CGAL_INTERNAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H -#define CGAL_INTERNAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H - -#include - - -#include -#include - -namespace CGAL { - -template < class Filtered_kernel > -class Triangulation_2_filtered_projection_traits_3 - : public Triangulation_2_projection_traits_base_3 -{ - typedef Filtered_kernel K; - typedef Triangulation_2_filtered_projection_traits_3 Self; - typedef Triangulation_2_projection_traits_base_3 Base; - - typedef typename K::Exact_kernel Exact_kernel; - typedef typename K::Approximate_kernel Approximate_kernel; - typedef typename K::C2E C2E; - typedef typename K::C2F C2F; - -public: - typedef Triangulation_2_projection_traits_base_3 Exact_traits; - typedef Triangulation_2_projection_traits_base_3 Filtering_traits; - -public: - explicit Triangulation_2_filtered_projection_traits_3(const typename K::Vector_3& n) - : Base(n) - { - } - -#define CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(P, Pf, ACCESSOR) \ - typedef Filtered_predicate_with_state< \ - typename Exact_traits::P, \ - typename Filtering_traits::P, \ - C2E, \ - C2F, \ - typename K::Vector_3> P; \ - P Pf() const { \ - return P(this->ACCESSOR()); \ - } - CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Orientation_2, - orientation_2_object, - normal) - CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Side_of_oriented_circle_2, - side_of_oriented_circle_2_object, - normal) - CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Less_x_2, - less_x_2_object, - base1) - CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Less_y_2, - less_y_2_object, - base2) - CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Compare_x_2, - compare_x_2_object, - base1) - CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Compare_y_2, - compare_y_2_object, - base2) -}; // end class Triangulation_2_projection_traits_base_3 - -} // end namespace CGAL - - -#endif // CGAL_INTERNAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h b/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h deleted file mode 100644 index 0de71bfc7c0..00000000000 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h +++ /dev/null @@ -1,535 +0,0 @@ -// Copyright (c) 2009 GeometryFactory (France) -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Laurent Rineau - - -#ifndef CGAL_INTERNAL_TRIANGULATION_2_PROJECTION_TRAITS_BASE_3_H -#define CGAL_INTERNAL_TRIANGULATION_2_PROJECTION_TRAITS_BASE_3_H - -#include - - -#include -#include -#include - -namespace CGAL { - -namespace TriangulationProjectionTraitsCartesianFunctors { - -template -class Projected_orientation_with_normal_3 -{ - // private members - typename Traits::Vector_3 normal; - - // private type aliases - typedef typename Traits::K K; - typedef typename Traits::Point_2 Point; - typedef typename Traits::Vector_3 Vector_3; -public: - typedef typename K::Orientation Orientation; - typedef Orientation result_type; - - Projected_orientation_with_normal_3(const Vector_3& normal_) - : normal(normal_) - { - CGAL_PROFILER("Construct Projected_orientation_with_normal_3.") - CGAL_TIME_PROFILER("Construct Projected_orientation_with_normal_3") - } - - Orientation operator()(const Point& p, - const Point& q, - const Point& r) const - { - CGAL_PROFILER("Projected_orientation_with_normal_3::operator()"); - CGAL_TIME_PROFILER("Projected_orientation_with_normal_3::operator()"); - return orientation(q-p, r-p, normal); - } -}; // end class Projected_orientation_with_normal_3 - -template -class Projected_side_of_oriented_circle_with_normal_3 -{ - // private members - typename Traits::Vector_3 normal; - - // private types aliases - typedef typename Traits::K K; - typedef typename Traits::Point_2 Point; - typedef typename Traits::Vector_3 Vector_3; - typedef typename Traits::FT FT; - - typedef Projected_side_of_oriented_circle_with_normal_3 Self; - -public: - typedef typename K::Oriented_side Oriented_side; - typedef Oriented_side result_type; - - Projected_side_of_oriented_circle_with_normal_3(const Vector_3& normal_) - : normal(normal_) - { - CGAL_PROFILER("Construct Projected_side_of_oriented_circle_with_normal_3.") - CGAL_TIME_PROFILER("Construct Projected_side_of_oriented_circle_with_normal_3.") - } - - Oriented_side operator()(const Point& p, - const Point& q, - const Point& r, - const Point& t) const - { - CGAL_PROFILER("Projected_side_of_oriented_circle_with_normal_3::operator()") - CGAL_TIME_PROFILER("Projected_side_of_oriented_circle_with_normal_3::operator()") - const Vector_3& u = normal; - - const Vector_3 tp = p - t; - const Vector_3 tq = q - t; - const Vector_3 tr = r - t; - - const FT tp2 = tp * tp; - const FT tq2 = tq * tq; - const FT tr2 = tr * tr; - const FT u2 = u * u; - - const FT k_p = tp * u; - const FT k_q = tq * u; - const FT k_r = tr * u; - - return sign_of_determinant( - tp.x(), tp.y(), tp.z(), (tp2 + k_p) * u2 - k_p * k_p, - tr.x(), tr.y(), tr.z(), (tr2 + k_r) * u2 - k_r * k_r, - tq.x(), tq.y(), tq.z(), (tq2 + k_q) * u2 - k_q * k_q, - u.x(), u.y(), u.z(), u2 * u2); - // Note that q and r have been swapped in the determinant above, to - // inverse its sign. - } -}; // end class Projected_side_of_oriented_circle_with_normal_3 - -template -class Projected_squared_distance_with_normal_3 -{ - // private members - typename Traits::Vector_3 normal; - - // private types aliases - typedef typename Traits::K K; - typedef typename Traits::Point_2 Point; - typedef typename Traits::Line_2 Line; - typedef typename Traits::Vector_3 Vector_3; - typedef typename Traits::FT FT; - -public: - Projected_squared_distance_with_normal_3(const Vector_3& normal_) - : normal(normal_) - { - CGAL_PROFILER("Construct Projected_squared_distance_with_normal_3.") - CGAL_TIME_PROFILER("Construct Projected_squared_distance_with_normal_3") - } - - FT operator()(const Point& p, const Point& q) - { - return squared_distance(p, q); - } - - FT operator()(const Line& line, const Point& p) - { - CGAL_PROFILER("Projected_squared_distance_with_normal_3::operator()") - CGAL_TIME_PROFILER("Projected_squared_distance_with_normal_3::operator()") - const Vector_3& vl = line.to_vector(); - const Point& pl = line.point(); - const Vector_3 v = cross_product(normal, - vl); - if(v == NULL_VECTOR) { - // den == 0 if the line is vertical - // In that case, the distance is the distance to the line - const Vector_3 w = cross_product(pl - p, - vl); - return (w * w) / (vl * vl); - } - else { - const FT det = determinant(normal, - vl, - pl - p); - return (det * det) / ( v * v ); - } - } -}; // end class Projected_squared_distance_with_normal_3 - -template -class Projected_intersect_3 -{ - // private members - typename Traits::Vector_3 normal; - - // private types aliases - typedef typename Traits::K K; - typedef typename Traits::Point_2 Point; - typedef typename Traits::Line_2 Line; - typedef typename Traits::Segment_2 Segment; - typedef typename K::Plane_3 Plane_3; - typedef typename Traits::Vector_3 Vector_3; - typedef typename Traits::FT FT; -public: - Projected_intersect_3(const Vector_3& normal_) - : normal(normal_) - { - CGAL_PROFILER("Construct Projected_intersect_3") - CGAL_TIME_PROFILER("Construct Projected_intersect_3") - } - - Object operator()(const Segment& s1, const Segment& s2) - { - CGAL_PROFILER("Projected_intersect_3::operator()") - CGAL_TIME_PROFILER("Projected_intersect_3::operator()") - const Vector_3 u1 = cross_product(s1.to_vector(), normal); - if(u1 == NULL_VECTOR) - return K().intersect_3_object()(s1.supporting_line(), s2); - - const Vector_3 u2 = cross_product(s2.to_vector(), normal); - if(u2 == NULL_VECTOR) - return K().intersect_3_object()(s1, s2.supporting_line()); - - const Plane_3 plane_1(s1.source(), u1); - const Plane_3 plane_2(s2.source(), u2); - - Object planes_intersection = intersection(plane_1, plane_2); - if(planes_intersection.empty()) { - std::cerr << "planes_intersection is empty\n"; - return planes_intersection; - } - if(const Line* line = object_cast(&planes_intersection)) - { - const Point& pi = line->point(0); - if(cross_product(normal, pi - s1.source()) - * cross_product(normal, pi - s1.target()) > FT(0) - || - cross_product(normal, pi - s2.source()) - * cross_product(normal, pi - s2.target()) > FT(0) ) - { - // the intersection of the lines is not inside the segments - std::cerr << "intersection not inside\n"; - return Object(); - } - else - { - // Let the plane passing through s1.source() and with normal - // the cross product of s1.to_vector() and s2.to_vector(). That - // plane should intersect *l, now. - return intersection(*line, Plane_3(s1.source(), - cross_product(s1.to_vector(), - s2.to_vector()))); - } - } - if(object_cast(&planes_intersection)) - { - std::cerr << "coplanar lines\n"; - CGAL_error(); - return Object(); - } - return Object(); - } -}; // end class Projected_intersect_3 - - -template -class Less_along_axis -{ - // private members - typedef typename Traits::Vector_3 Vector_3; - typedef typename Traits::Point_2 Point; - Vector_3 base; -public: - Less_along_axis(const Vector_3& base) : base(base) - { - CGAL_PROFILER("Construct Less_along_axis") - CGAL_TIME_PROFILER("Construct Less_along_axis") - } - - typedef bool result_type; - - bool operator() (const Point &p, const Point &q) const { - return base * (p - q) < 0; - } -}; // end class Less_along_axis - -template -class Less_along_2_axis -{ - // private members - typedef typename Traits::Vector_3 Vector_3; - typedef typename Traits::Point_2 Point; - Vector_3 base1; - Vector_3 base2; -public: - Less_along_2_axis(const Vector_3& base1, const Vector_3& base2) - : base1(base1), base2(base2) - { - CGAL_PROFILER("Construct Less_along_axis") - CGAL_TIME_PROFILER("Construct Less_along_axis") - } - - typedef bool result_type; - - bool operator() (const Point &p, const Point &q) const { - auto proj = base1 * (p - q); - return proj < 0 - || proj == 0 && proj < 0; - } -}; // end class Less_along_axis - -template -class Compare_along_axis -{ - // private members - typedef typename Traits::Vector_3 Vector_3; - typedef typename Traits::Point_2 Point; - Vector_3 base; -public: - Compare_along_axis(const Vector_3& base) : base(base) - { - CGAL_PROFILER("Construct Compare_along_axis") - CGAL_TIME_PROFILER("Construct Compare_along_axis") - } - - typedef Comparison_result result_type; - - Comparison_result operator() (const Point &p, const Point &q) const { - return compare(base * (p - q), 0); - } -}; // end class Compare_along_axis - -} // end namespace TriangulationProjectionTraitsCartesianFunctors - - -template < class Kernel > -class Triangulation_2_projection_traits_base_3 -{ - typedef Triangulation_2_projection_traits_base_3 Self; - - typename Kernel::Vector_3 n, b1, b2; - -public: - typedef typename Kernel::Vector_3 Vector_3; - - - explicit Triangulation_2_projection_traits_base_3(const Vector_3& n_) - : n(n_) - { - typedef typename Kernel::FT FT; - typedef typename Kernel::Vector_3 Vector_3; - - const FT& nx = n.x(); - const FT& ny = n.y(); - const FT& nz = n.z(); - if(CGAL::abs(nz) >= CGAL::abs(ny)) { - b1 = Vector_3(nz, 0, -nx); - } - else { - b1 = Vector_3(ny, -nx, 0); - } - b2 = cross_product(n, b1); - } - - const Vector_3& normal() const - { - return n; - } - - const Vector_3& base1() const{ - return b1; - } - - const Vector_3& base2() const{ - return b2; - } - - typedef Kernel K; - typedef typename K::FT FT; - typedef typename K::Point_3 Point_2; - typedef typename K::Segment_3 Segment_2; - typedef typename K::Vector_3 Vector_2; - typedef typename K::Triangle_3 Triangle_2; - typedef typename K::Line_3 Line_2; - - typedef typename K::Angle_3 Angle_2; - - typedef TriangulationProjectionTraitsCartesianFunctors:: - Compare_along_axis Compare_x_2; - typedef TriangulationProjectionTraitsCartesianFunctors:: - Compare_along_axis Compare_y_2; - - typedef TriangulationProjectionTraitsCartesianFunctors:: - Less_along_axis Less_x_2; - typedef TriangulationProjectionTraitsCartesianFunctors:: - Less_along_axis Less_y_2; - typedef TriangulationProjectionTraitsCartesianFunctors:: - Less_along_2_axis Less_xy_2; - typedef TriangulationProjectionTraitsCartesianFunctors:: - Less_along_2_axis Less_yx_2; - - typedef TriangulationProjectionTraitsCartesianFunctors:: - Projected_orientation_with_normal_3 Orientation_2; - - typedef TriangulationProjectionTraitsCartesianFunctors:: - Projected_side_of_oriented_circle_with_normal_3 Side_of_oriented_circle_2; - - typedef TriangulationProjectionTraitsCartesianFunctors:: - Projected_squared_distance_with_normal_3 Compute_squared_distance_2; - - typedef TriangulationProjectionTraitsCartesianFunctors:: - Projected_intersect_3 Intersect_2; - - typedef typename K::Construct_point_3 Construct_point_2; - typedef typename K::Construct_weighted_point_3 Construct_weighted_point_2; - typedef typename K::Construct_segment_3 Construct_segment_2; - typedef typename K::Construct_vector_3 Construct_vector_2; - typedef typename K::Construct_line_3 Construct_line_2; - typedef typename K::Construct_triangle_3 Construct_triangle_2; - - typedef typename K::Construct_scaled_vector_3 Construct_scaled_vector_2; - typedef typename K::Construct_translated_point_3 Construct_translated_point_2; - typedef typename K::Construct_midpoint_3 Construct_midpoint_2; - typedef typename K::Construct_circumcenter_3 Construct_circumcenter_2; - - typedef typename K::Compute_area_3 Compute_area_2; - typedef typename K::Construct_bbox_3 Construct_bbox_2; - - Less_x_2 - less_x_2_object() const - { - return Less_x_2(this->base1()); - } - - Less_y_2 - less_y_2_object() const - { - return Less_y_2(this->base2()); - } - - Less_xy_2 - less_xy_2_object() const - { - return Less_xy_2(this->base1(), this->base2()); - } - - Less_yx_2 - less_yx_2_object() const - { - return Less_yx_2(this->base2(), this->base1()); - } - - Compare_x_2 - compare_x_2_object() const - { - return Compare_x_2(this->base1()); - } - - Compare_y_2 - compare_y_2_object() const - { - return Compare_y_2(this->base2()); - } - - Orientation_2 - orientation_2_object() const - { - return Orientation_2(this->normal()); - } - - Side_of_oriented_circle_2 - side_of_oriented_circle_2_object() const - { - return Side_of_oriented_circle_2(this->normal()); - } - - Compute_squared_distance_2 - compute_squared_distance_2_object() const - { - return Compute_squared_distance_2(this->normal()); - } - - Intersect_2 - intersect_2_object () const - { - return Intersect_2(this->normal()); - } - - Angle_2 angle_2_object() const - {return Angle_2();} - - Construct_point_2 construct_point_2_object() const - {return Construct_point_2();} - - Construct_weighted_point_2 construct_weighted_point_2_object() const - {return Construct_weighted_point_2();} - - Construct_segment_2 construct_segment_2_object() const - {return Construct_segment_2();} - - Construct_vector_2 construct_vector_2_object() const - {return Construct_vector_2();} - - Construct_scaled_vector_2 construct_scaled_vector_2_object() const - {return Construct_scaled_vector_2();} - - Construct_midpoint_2 construct_midpoint_2_object() const - {return Construct_midpoint_2();} - - Construct_circumcenter_2 construct_circumcenter_2_object() const - {return Construct_circumcenter_2();} - - Construct_translated_point_2 construct_translated_point_2_object() const - {return Construct_translated_point_2();} - - Construct_line_2 construct_line_2_object() const - {return Construct_line_2();} - - Construct_triangle_2 construct_triangle_2_object() const - {return Construct_triangle_2();} - - Compute_area_2 compute_area_2_object() const - {return Compute_area_2();} - - - Construct_bbox_2 construct_bbox_2_object() const - {return Construct_bbox_2();} - - - // Special functor, not in the Kernel concept - class Projection_to_plane { - // Remeber: Point_2 is K::Point_3 - const Point_2& plane_point; - const Vector_3& normal; - public: - // Return the projection of a point to a plane passing through - // the point 'plane_point' and with orthogonal vector normal(). - Projection_to_plane(const Point_2& plane_point_, const Self& self) - : plane_point(plane_point_), - normal(self.normal()) - {} - - Point_2 operator()(const Point_2& point) const - { - return point + - ( ( (plane_point - point) * normal ) / (normal * normal) ) * normal; - } - }; // end Projection_to_plane - - Projection_to_plane projection_to_plane_object(const Point_2& plane_point) const - { - return Projection_to_plane(plane_point, *this); - } - -}; // end class Triangulation_2_projection_traits_base_3 - -} // end namespace CGAL - -#endif // CGAL_INTERNAL_TRIANGULATION_2_PROJECTION_TRAITS_BASE_3_H diff --git a/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h b/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h deleted file mode 100644 index de475d6f44c..00000000000 --- a/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) 2009 GeometryFactory (France) -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// Author(s) : Laurent Rineau - - -#ifndef CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H -#define CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H - -#include - - -#include - -namespace CGAL{ - -// This declaration is needed to break the cyclic dependency. -template < class Filtered_kernel > -class Triangulation_2_filtered_projection_traits_3; - -template -class Triangulation_2_projection_traits_3 - : public Triangulation_2_projection_traits_base_3 -{ -public: - explicit - Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_) - : Triangulation_2_projection_traits_base_3(n_) - {} -}; - -template -class Triangulation_2_projection_traits_3 - : public Triangulation_2_filtered_projection_traits_3 -{ -public: - explicit - Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_) - : Triangulation_2_filtered_projection_traits_3(n_) - {} -}; - -} // end namespace CGAL - -#endif // CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H From 6c82c4b09d6ec3992a3e57ee2372f7e189cc7a9c Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 10 Mar 2021 15:06:53 +0100 Subject: [PATCH 11/26] Add misisng files --- .../Triangulation_2_projection_traits_3.h | 57 ++ .../Triangulation_2_projection_traits_3.h | 52 ++ ...ngulation_2_filtered_projection_traits_3.h | 81 +++ ...Triangulation_2_projection_traits_base_3.h | 537 ++++++++++++++++++ 4 files changed, 727 insertions(+) create mode 100644 Kernel_23/doc/Kernel_23/CGAL/Triangulation_2_projection_traits_3.h create mode 100644 Kernel_23/include/CGAL/Triangulation_2_projection_traits_3.h create mode 100644 Kernel_23/include/CGAL/internal/Triangulation_2_filtered_projection_traits_3.h create mode 100644 Kernel_23/include/CGAL/internal/Triangulation_2_projection_traits_base_3.h diff --git a/Kernel_23/doc/Kernel_23/CGAL/Triangulation_2_projection_traits_3.h b/Kernel_23/doc/Kernel_23/CGAL/Triangulation_2_projection_traits_3.h new file mode 100644 index 00000000000..019e4d15169 --- /dev/null +++ b/Kernel_23/doc/Kernel_23/CGAL/Triangulation_2_projection_traits_3.h @@ -0,0 +1,57 @@ +namespace CGAL{ + +/*! + \ingroup PkgTriangulation2TriangulationClasses + + The class `Triangulation_2_projection_traits_3` works similarly as the `Projection_traits_xy_3`, + `Projection_traits_xz_3` and `Projection_traits_yz_3` traits classes, by enabling + the use of 2D algorithms on the projections of 3D data on an arbitrary plane. + + \tparam K must be a model of `Kernel` + + \note Internal constructions (projections) are used in the predicate and +construction functors of this class. If `K` is a model of `Kernel` providing exact +constructions or if `K` is a `CGAL::Filtered_kernel` (such as for +`CGAL::Exact_predicates_inexact_constructions_kernel`), this class automatically +provides exact predicates. + +\cgalModels `TriangulationTraits_2` +\cgalModels `DelaunayTriangulationTraits_2` +\cgalModels `ConstrainedTriangulationTraits_2` +\cgalModels `PolygonTraits_2` + + */ +template +class Triangulation_2_projection_traits_3 +{ +public: + ///\name Types + ///@{ + + //! + typedef typename K::Point_3 Point_2; + + ///@} + + + /// \name Functors + /// The functors provided by this class are those listed in the + /// concepts. The functors operate on the 2D projection of their + /// arguments. They come with preconditions that projections of the + /// arguments are non-degenerate, eg. a line segment does not project + /// on a single point, two points do not project on the same point, etc. + ///@} + + /// \name Creation + ///@{ + + /*! + * \brief Constructor + * + * \param normal a vector orthogonal to the projection plane. + */ + Triangulation_2_projection_traits_3(const typename K::Vector_3& normal); + + ///@} +}; +} // end namespace CGAL diff --git a/Kernel_23/include/CGAL/Triangulation_2_projection_traits_3.h b/Kernel_23/include/CGAL/Triangulation_2_projection_traits_3.h new file mode 100644 index 00000000000..043c810fa6c --- /dev/null +++ b/Kernel_23/include/CGAL/Triangulation_2_projection_traits_3.h @@ -0,0 +1,52 @@ +// Copyright (c) 2009 GeometryFactory (France) +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Laurent Rineau + + +#ifndef CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H +#define CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H + +#include + + +#include + +namespace CGAL{ + +// This declaration is needed to break the cyclic dependency. +template < class Filtered_kernel > +class Triangulation_2_filtered_projection_traits_3; + +template +class Triangulation_2_projection_traits_3 + : public Triangulation_2_projection_traits_base_3 +{ +public: + explicit + Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_) + : Triangulation_2_projection_traits_base_3(n_) + {} +}; + +template +class Triangulation_2_projection_traits_3 + : public Triangulation_2_filtered_projection_traits_3 +{ +public: + explicit + Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_) + : Triangulation_2_filtered_projection_traits_3(n_) + {} +}; + +} // end namespace CGAL + +#endif // CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H diff --git a/Kernel_23/include/CGAL/internal/Triangulation_2_filtered_projection_traits_3.h b/Kernel_23/include/CGAL/internal/Triangulation_2_filtered_projection_traits_3.h new file mode 100644 index 00000000000..df7fea7e236 --- /dev/null +++ b/Kernel_23/include/CGAL/internal/Triangulation_2_filtered_projection_traits_3.h @@ -0,0 +1,81 @@ + // Copyright (c) 2009 GeometryFactory (France) +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Laurent Rineau + + +#ifndef CGAL_INTERNAL_FILTERED_PROJECTION_TRAITS_3_H +#define CGAL_INTERNAL_FILTERED_PROJECTION_TRAITS_3_H + +#include + + +#include +#include + +namespace CGAL { + +template < class Filtered_kernel > +class Triangulation_2_filtered_projection_traits_3 + : public Triangulation_2_projection_traits_base_3 +{ + typedef Filtered_kernel K; + typedef Triangulation_2_filtered_projection_traits_3 Self; + typedef Triangulation_2_projection_traits_base_3 Base; + + typedef typename K::Exact_kernel Exact_kernel; + typedef typename K::Approximate_kernel Approximate_kernel; + typedef typename K::C2E C2E; + typedef typename K::C2F C2F; + +public: + typedef Triangulation_2_projection_traits_base_3 Exact_traits; + typedef Triangulation_2_projection_traits_base_3 Filtering_traits; + +public: + explicit Triangulation_2_filtered_projection_traits_3(const typename K::Vector_3& n) + : Base(n) + { + } + +#define CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(P, Pf, ACCESSOR) \ + typedef Filtered_predicate_with_state< \ + typename Exact_traits::P, \ + typename Filtering_traits::P, \ + C2E, \ + C2F, \ + typename K::Vector_3> P; \ + P Pf() const { \ + return P(this->ACCESSOR()); \ + } + CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Orientation_2, + orientation_2_object, + normal) + CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Side_of_oriented_circle_2, + side_of_oriented_circle_2_object, + normal) + CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Less_x_2, + less_x_2_object, + base1) + CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Less_y_2, + less_y_2_object, + base2) + CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Compare_x_2, + compare_x_2_object, + base1) + CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Compare_y_2, + compare_y_2_object, + base2) +}; // end class Triangulation_2_projection_traits_base_3 + +} // end namespace CGAL + + +#endif // CGAL_INTERNAL_FILTERED_PROJECTION_TRAITS_3_H diff --git a/Kernel_23/include/CGAL/internal/Triangulation_2_projection_traits_base_3.h b/Kernel_23/include/CGAL/internal/Triangulation_2_projection_traits_base_3.h new file mode 100644 index 00000000000..b1b9291444b --- /dev/null +++ b/Kernel_23/include/CGAL/internal/Triangulation_2_projection_traits_base_3.h @@ -0,0 +1,537 @@ +// Copyright (c) 2009 GeometryFactory (France) +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Laurent Rineau + + +#ifndef CGAL_INTERNAL_PROJECTION_TRAITS_BASE_3_H +#define CGAL_INTERNAL_PROJECTION_TRAITS_BASE_3_H + +#include + + +#include +#include +#include + +namespace CGAL { + +namespace TriangulationProjectionTraitsCartesianFunctors { + +template +class Projected_orientation_with_normal_3 +{ + // private members + typename Traits::Vector_3 normal; + + // private type aliases + typedef typename Traits::K K; + typedef typename Traits::Point_2 Point; + typedef typename Traits::Vector_3 Vector_3; +public: + typedef typename K::Orientation Orientation; + typedef Orientation result_type; + + Projected_orientation_with_normal_3(const Vector_3& normal_) + : normal(normal_) + { + CGAL_PROFILER("Construct Projected_orientation_with_normal_3.") + CGAL_TIME_PROFILER("Construct Projected_orientation_with_normal_3") + } + + Orientation operator()(const Point& p, + const Point& q, + const Point& r) const + { + CGAL_PROFILER("Projected_orientation_with_normal_3::operator()"); + CGAL_TIME_PROFILER("Projected_orientation_with_normal_3::operator()"); + return orientation(q-p, r-p, normal); + } +}; // end class Projected_orientation_with_normal_3 + +template +class Projected_side_of_oriented_circle_with_normal_3 +{ + // private members + typename Traits::Vector_3 normal; + + // private types aliases + typedef typename Traits::K K; + typedef typename Traits::Point_2 Point; + typedef typename Traits::Vector_3 Vector_3; + typedef typename Traits::FT FT; + + typedef Projected_side_of_oriented_circle_with_normal_3 Self; + +public: + typedef typename K::Oriented_side Oriented_side; + typedef Oriented_side result_type; + + Projected_side_of_oriented_circle_with_normal_3(const Vector_3& normal_) + : normal(normal_) + { + CGAL_PROFILER("Construct Projected_side_of_oriented_circle_with_normal_3.") + CGAL_TIME_PROFILER("Construct Projected_side_of_oriented_circle_with_normal_3.") + } + + Oriented_side operator()(const Point& p, + const Point& q, + const Point& r, + const Point& t) const + { + CGAL_PROFILER("Projected_side_of_oriented_circle_with_normal_3::operator()") + CGAL_TIME_PROFILER("Projected_side_of_oriented_circle_with_normal_3::operator()") + const Vector_3& u = normal; + + const Vector_3 tp = p - t; + const Vector_3 tq = q - t; + const Vector_3 tr = r - t; + + const FT tp2 = tp * tp; + const FT tq2 = tq * tq; + const FT tr2 = tr * tr; + const FT u2 = u * u; + + const FT k_p = tp * u; + const FT k_q = tq * u; + const FT k_r = tr * u; + + return sign_of_determinant( + tp.x(), tp.y(), tp.z(), (tp2 + k_p) * u2 - k_p * k_p, + tr.x(), tr.y(), tr.z(), (tr2 + k_r) * u2 - k_r * k_r, + tq.x(), tq.y(), tq.z(), (tq2 + k_q) * u2 - k_q * k_q, + u.x(), u.y(), u.z(), u2 * u2); + // Note that q and r have been swapped in the determinant above, to + // inverse its sign. + } +}; // end class Projected_side_of_oriented_circle_with_normal_3 + +template +class Projected_squared_distance_with_normal_3 +{ + // private members + typename Traits::Vector_3 normal; + + // private types aliases + typedef typename Traits::K K; + typedef typename Traits::Point_2 Point; + typedef typename Traits::Line_2 Line; + typedef typename Traits::Vector_3 Vector_3; + typedef typename Traits::FT FT; + +public: + Projected_squared_distance_with_normal_3(const Vector_3& normal_) + : normal(normal_) + { + CGAL_PROFILER("Construct Projected_squared_distance_with_normal_3.") + CGAL_TIME_PROFILER("Construct Projected_squared_distance_with_normal_3") + } + + FT operator()(const Point& p, const Point& q) + { + return squared_distance(p, q); + } + + FT operator()(const Line& line, const Point& p) + { + CGAL_PROFILER("Projected_squared_distance_with_normal_3::operator()") + CGAL_TIME_PROFILER("Projected_squared_distance_with_normal_3::operator()") + const Vector_3& vl = line.to_vector(); + const Point& pl = line.point(); + const Vector_3 v = cross_product(normal, + vl); + if(v == NULL_VECTOR) { + // den == 0 if the line is vertical + // In that case, the distance is the distance to the line + const Vector_3 w = cross_product(pl - p, + vl); + return (w * w) / (vl * vl); + } + else { + const FT det = determinant(normal, + vl, + pl - p); + return (det * det) / ( v * v ); + } + } +}; // end class Projected_squared_distance_with_normal_3 + +template +class Projected_intersect_3 +{ + // private members + typename Traits::Vector_3 normal; + + // private types aliases + typedef typename Traits::K K; + typedef typename Traits::Point_2 Point; + typedef typename Traits::Line_2 Line; + typedef typename Traits::Segment_2 Segment; + typedef typename K::Plane_3 Plane_3; + typedef typename Traits::Vector_3 Vector_3; + typedef typename Traits::FT FT; +public: + Projected_intersect_3(const Vector_3& normal_) + : normal(normal_) + { + CGAL_PROFILER("Construct Projected_intersect_3") + CGAL_TIME_PROFILER("Construct Projected_intersect_3") + } + + boost::optional > + operator()(const Segment& s1, const Segment& s2) + { + CGAL_PROFILER("Projected_intersect_3::operator()") + CGAL_TIME_PROFILER("Projected_intersect_3::operator()") + const Vector_3 u1 = cross_product(s1.to_vector(), normal); + if(u1 == NULL_VECTOR) + return K().intersect_3_object()(s1.supporting_line(), s2); + + const Vector_3 u2 = cross_product(s2.to_vector(), normal); + if(u2 == NULL_VECTOR) + return K().intersect_3_object()(s1, s2.supporting_line()); + + const Plane_3 plane_1(s1.source(), u1); + const Plane_3 plane_2(s2.source(), u2); + + auto planes_intersection = intersection(plane_1, plane_2); + if(! planes_intersection) { + std::cerr << "planes_intersection is empty\n"; + return boost::none; + } + if(const Line* line = boost::get(&*planes_intersection)) + { + const Point& pi = line->point(0); + if(cross_product(normal, pi - s1.source()) + * cross_product(normal, pi - s1.target()) > FT(0) + || + cross_product(normal, pi - s2.source()) + * cross_product(normal, pi - s2.target()) > FT(0) ) + { + // the intersection of the lines is not inside the segments + std::cerr << "intersection not inside\n"; + return boost::none; + } + else + { + // Let the plane passing through s1.source() and with normal + // the cross product of s1.to_vector() and s2.to_vector(). That + // plane should intersect *l, now. + auto inter = intersection(*line, Plane_3(s1.source(), + cross_product(s1.to_vector(), + s2.to_vector()))); + if(! inter){ + return boost::none; + } + if(const Point* point = boost::get(&*inter)){ + typedef boost::variant variant_type; + return boost::make_optional(variant_type(*point)); + } + } + } + if(boost::get(&*planes_intersection)) + { + std::cerr << "coplanar lines\n"; + CGAL_error(); + return boost::none; + } + return boost::none; + } +}; // end class Projected_intersect_3 + + +template +class Less_along_axis +{ + // private members + typedef typename Traits::Vector_3 Vector_3; + typedef typename Traits::Point_2 Point; + Vector_3 base; +public: + Less_along_axis(const Vector_3& base) : base(base) + { + CGAL_PROFILER("Construct Less_along_axis") + CGAL_TIME_PROFILER("Construct Less_along_axis") + } + + typedef bool result_type; + + bool operator() (const Point &p, const Point &q) const { + return base * (p - q) < 0; + } +}; // end class Less_along_axis + +template +class Compare_along_axis +{ + // private members + typedef typename Traits::Vector_3 Vector_3; + typedef typename Traits::Point_2 Point; + Vector_3 base; +public: + Compare_along_axis(const Vector_3& base) : base(base) + { + CGAL_PROFILER("Construct Compare_along_axis") + CGAL_TIME_PROFILER("Construct Compare_along_axis") + } + + typedef Comparison_result result_type; + + Comparison_result operator() (const Point &p, const Point &q) const { + return compare(base * (p - q), 0); + } +}; // end class Compare_along_axis + +template +class Less_xy_along_axis +{ + // private members + typedef typename Traits::Vector_3 Vector_3; + typedef typename Traits::Point_2 Point; + Vector_3 base1, base2; +public: + Less_xy_along_axis(const Vector_3& base1, const Vector_3& base2) : base1(base1), base2(base2) + { + CGAL_PROFILER("Construct Less_xy_along_axis") + CGAL_TIME_PROFILER("Construct Less_xy_along_axis") + } + + typedef bool result_type; + + bool operator() (const Point &p, const Point &q) const { + + Compare_along_axis cx(base1); + Comparison_result crx = cx(p, q); + if (crx == SMALLER) { return true; } + if (crx == LARGER) { return false; } + Less_along_axis ly(base2); + return ly(p, q); + } +}; // end class Less_xy_along_axis + +} // end namespace TriangulationProjectionTraitsCartesianFunctors + + +template < class Kernel > +class Triangulation_2_projection_traits_base_3 +{ + typedef Triangulation_2_projection_traits_base_3 Self; + + typename Kernel::Vector_3 n, b1, b2; + +public: + typedef typename Kernel::Vector_3 Vector_3; + + + explicit Triangulation_2_projection_traits_base_3(const Vector_3& n_) + : n(n_) + { + typedef typename Kernel::FT FT; + typedef typename Kernel::Vector_3 Vector_3; + + const FT& nx = n.x(); + const FT& ny = n.y(); + const FT& nz = n.z(); + if(CGAL::abs(nz) >= CGAL::abs(ny)) { + b1 = Vector_3(nz, 0, -nx); + } + else { + b1 = Vector_3(ny, -nx, 0); + } + b2 = cross_product(n, b1); + } + + const Vector_3& normal() const + { + return n; + } + + const Vector_3& base1() const{ + return b1; + } + + const Vector_3& base2() const{ + return b2; + } + + typedef Kernel K; + typedef typename K::FT FT; + typedef typename K::Point_3 Point_2; + typedef typename K::Segment_3 Segment_2; + typedef typename K::Vector_3 Vector_2; + typedef typename K::Triangle_3 Triangle_2; + typedef typename K::Line_3 Line_2; + + typedef typename K::Angle_3 Angle_2; + + typedef TriangulationProjectionTraitsCartesianFunctors:: + Compare_along_axis Compare_x_2; + typedef TriangulationProjectionTraitsCartesianFunctors:: + Compare_along_axis Compare_y_2; + + typedef TriangulationProjectionTraitsCartesianFunctors:: + Less_along_axis Less_x_2; + typedef TriangulationProjectionTraitsCartesianFunctors:: + Less_along_axis Less_y_2; + typedef TriangulationProjectionTraitsCartesianFunctors:: + Less_xy_along_axis Less_xy_2; + + typedef TriangulationProjectionTraitsCartesianFunctors:: + Projected_orientation_with_normal_3 Orientation_2; + + typedef TriangulationProjectionTraitsCartesianFunctors:: + Projected_side_of_oriented_circle_with_normal_3 Side_of_oriented_circle_2; + + typedef TriangulationProjectionTraitsCartesianFunctors:: + Projected_squared_distance_with_normal_3 Compute_squared_distance_2; + + typedef TriangulationProjectionTraitsCartesianFunctors:: + Projected_intersect_3 Intersect_2; + + typedef typename K::Construct_point_3 Construct_point_2; + typedef typename K::Construct_weighted_point_3 Construct_weighted_point_2; + typedef typename K::Construct_segment_3 Construct_segment_2; + typedef typename K::Construct_vector_3 Construct_vector_2; + typedef typename K::Construct_line_3 Construct_line_2; + typedef typename K::Construct_triangle_3 Construct_triangle_2; + + typedef typename K::Construct_scaled_vector_3 Construct_scaled_vector_2; + typedef typename K::Construct_translated_point_3 Construct_translated_point_2; + typedef typename K::Construct_midpoint_3 Construct_midpoint_2; + typedef typename K::Construct_circumcenter_3 Construct_circumcenter_2; + + typedef typename K::Compute_area_3 Compute_area_2; + typedef typename K::Construct_bbox_3 Construct_bbox_2; + + Less_x_2 + less_x_2_object() const + { + return Less_x_2(this->base1()); + } + + Less_y_2 + less_y_2_object() const + { + return Less_y_2(this->base2()); + } + + Less_xy_2 + less_xy_2_object() const + { + return Less_xy_2(this->base1(), this->base2()); + } + + Compare_x_2 + compare_x_2_object() const + { + return Compare_x_2(this->base1()); + } + + Compare_y_2 + compare_y_2_object() const + { + return Compare_y_2(this->base2()); + } + + Orientation_2 + orientation_2_object() const + { + return Orientation_2(this->normal()); + } + + Side_of_oriented_circle_2 + side_of_oriented_circle_2_object() const + { + return Side_of_oriented_circle_2(this->normal()); + } + + Compute_squared_distance_2 + compute_squared_distance_2_object() const + { + return Compute_squared_distance_2(this->normal()); + } + + Intersect_2 + intersect_2_object () const + { + return Intersect_2(this->normal()); + } + + Angle_2 angle_2_object() const + {return Angle_2();} + + Construct_point_2 construct_point_2_object() const + {return Construct_point_2();} + + Construct_weighted_point_2 construct_weighted_point_2_object() const + {return Construct_weighted_point_2();} + + Construct_segment_2 construct_segment_2_object() const + {return Construct_segment_2();} + + Construct_vector_2 construct_vector_2_object() const + {return Construct_vector_2();} + + Construct_scaled_vector_2 construct_scaled_vector_2_object() const + {return Construct_scaled_vector_2();} + + Construct_midpoint_2 construct_midpoint_2_object() const + {return Construct_midpoint_2();} + + Construct_circumcenter_2 construct_circumcenter_2_object() const + {return Construct_circumcenter_2();} + + Construct_translated_point_2 construct_translated_point_2_object() const + {return Construct_translated_point_2();} + + Construct_line_2 construct_line_2_object() const + {return Construct_line_2();} + + Construct_triangle_2 construct_triangle_2_object() const + {return Construct_triangle_2();} + + Compute_area_2 compute_area_2_object() const + {return Compute_area_2();} + + + Construct_bbox_2 construct_bbox_2_object() const + {return Construct_bbox_2();} + + + // Special functor, not in the Kernel concept + class Projection_to_plan { + // Remeber: Point_2 is K::Point_3 + const Point_2& plane_point; + const Vector_3& normal; + public: + // Return the projection of a point to a plane passing through + // the point 'plane_point' and with orthogonal vector normal(). + Projection_to_plan(const Point_2& plane_point_, const Self& self) + : plane_point(plane_point_), + normal(self.normal()) + {} + + Point_2 operator()(const Point_2& point) const + { + return point + + ( ( (plane_point - point) * normal ) / (normal * normal) ) * normal; + } + }; // end Projection_to_plan + + Projection_to_plan projection_to_plan_object(const Point_2& plane_point) const + { + return Projection_to_plan(plane_point, *this); + } + +}; // end class Triangulation_2_projection_traits_base_3 + +} // end namespace CGAL + +#endif // CGAL_INTERNAL_PROJECTION_TRAITS_BASE_3_H From c2628c16e1af6ca90a451ffcf0d396b22578d245 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 10 Mar 2021 15:16:29 +0100 Subject: [PATCH 12/26] change licenses --- Kernel_23/include/CGAL/Triangulation_2_projection_traits_3.h | 4 +--- .../internal/Triangulation_2_filtered_projection_traits_3.h | 5 +---- .../CGAL/internal/Triangulation_2_projection_traits_base_3.h | 5 +---- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/Kernel_23/include/CGAL/Triangulation_2_projection_traits_3.h b/Kernel_23/include/CGAL/Triangulation_2_projection_traits_3.h index 043c810fa6c..e1998929fe6 100644 --- a/Kernel_23/include/CGAL/Triangulation_2_projection_traits_3.h +++ b/Kernel_23/include/CGAL/Triangulation_2_projection_traits_3.h @@ -5,7 +5,7 @@ // // $URL$ // $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // // Author(s) : Laurent Rineau @@ -14,8 +14,6 @@ #ifndef CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H #define CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H -#include - #include diff --git a/Kernel_23/include/CGAL/internal/Triangulation_2_filtered_projection_traits_3.h b/Kernel_23/include/CGAL/internal/Triangulation_2_filtered_projection_traits_3.h index df7fea7e236..dd7d4871ac2 100644 --- a/Kernel_23/include/CGAL/internal/Triangulation_2_filtered_projection_traits_3.h +++ b/Kernel_23/include/CGAL/internal/Triangulation_2_filtered_projection_traits_3.h @@ -5,7 +5,7 @@ // // $URL$ // $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // // Author(s) : Laurent Rineau @@ -14,9 +14,6 @@ #ifndef CGAL_INTERNAL_FILTERED_PROJECTION_TRAITS_3_H #define CGAL_INTERNAL_FILTERED_PROJECTION_TRAITS_3_H -#include - - #include #include diff --git a/Kernel_23/include/CGAL/internal/Triangulation_2_projection_traits_base_3.h b/Kernel_23/include/CGAL/internal/Triangulation_2_projection_traits_base_3.h index b1b9291444b..90db22f0805 100644 --- a/Kernel_23/include/CGAL/internal/Triangulation_2_projection_traits_base_3.h +++ b/Kernel_23/include/CGAL/internal/Triangulation_2_projection_traits_base_3.h @@ -5,7 +5,7 @@ // // $URL$ // $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial // // // Author(s) : Laurent Rineau @@ -14,9 +14,6 @@ #ifndef CGAL_INTERNAL_PROJECTION_TRAITS_BASE_3_H #define CGAL_INTERNAL_PROJECTION_TRAITS_BASE_3_H -#include - - #include #include #include From 735567531b51f906647f1dabe29d45cd737da7f1 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 19 Mar 2021 12:00:08 +0100 Subject: [PATCH 13/26] RENAME --- GraphicsView/include/CGAL/Buffer_for_vao.h | 4 ++-- .../CGAL/Triangulation_2_projection_traits_3.h | 6 +++--- Kernel_23/doc/Kernel_23/PackageDescription.txt | 2 +- ...projection_traits_3.h => Projection_traits_3.h} | 14 +++++++------- .../demo/Linear_cell_complex/typedefs.h | 4 ++-- .../examples/Linear_cell_complex/basic_viewer.h | 4 ++-- Mesh_2/test/Mesh_2/test_mesh_projection_traits.cpp | 4 ++-- .../graph/convert_nef_polyhedron_to_polygon_mesh.h | 4 ++-- .../internal/Corefinement/Visitor.h | 4 ++-- .../Hole_filling/Triangulate_hole_polyline.h | 4 ++-- .../Polygon_mesh_processing/triangulate_faces.h | 4 ++-- Polyhedron/demo/Polyhedron/Scene_lcc_item.cpp | 2 +- .../demo/Polyhedron/Scene_nef_polyhedron_item.cpp | 4 ++-- Polyhedron/demo/Polyhedron/triangulate_primitive.h | 4 ++-- .../doc/Triangulation_2/Triangulation_2.txt | 2 +- .../examples/Triangulation_2/projection_traits.cpp | 4 ++-- .../test_cdt_2_projection_traits_special_case.cpp | 8 ++++---- 17 files changed, 39 insertions(+), 39 deletions(-) rename Kernel_23/include/CGAL/{Triangulation_2_projection_traits_3.h => Projection_traits_3.h} (69%) diff --git a/GraphicsView/include/CGAL/Buffer_for_vao.h b/GraphicsView/include/CGAL/Buffer_for_vao.h index 2be331a35f5..cfc1a5d26ca 100644 --- a/GraphicsView/include/CGAL/Buffer_for_vao.h +++ b/GraphicsView/include/CGAL/Buffer_for_vao.h @@ -15,7 +15,7 @@ #include -#include +#include #include #include #include @@ -887,7 +887,7 @@ protected: bool is_process; }; - typedef CGAL::Triangulation_2_projection_traits_3 P_traits; + typedef CGAL::Projection_traits_3 P_traits; typedef CGAL::Triangulation_vertex_base_with_info_2 Vb; typedef CGAL::Triangulation_face_base_with_info_2 Fb1; typedef CGAL::Constrained_triangulation_face_base_2 Fb; diff --git a/Kernel_23/doc/Kernel_23/CGAL/Triangulation_2_projection_traits_3.h b/Kernel_23/doc/Kernel_23/CGAL/Triangulation_2_projection_traits_3.h index 019e4d15169..4ee6daf9baf 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Triangulation_2_projection_traits_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Triangulation_2_projection_traits_3.h @@ -3,7 +3,7 @@ namespace CGAL{ /*! \ingroup PkgTriangulation2TriangulationClasses - The class `Triangulation_2_projection_traits_3` works similarly as the `Projection_traits_xy_3`, + The class `Projection_traits_3` works similarly as the `Projection_traits_xy_3`, `Projection_traits_xz_3` and `Projection_traits_yz_3` traits classes, by enabling the use of 2D algorithms on the projections of 3D data on an arbitrary plane. @@ -22,7 +22,7 @@ provides exact predicates. */ template -class Triangulation_2_projection_traits_3 +class Projection_traits_3 { public: ///\name Types @@ -50,7 +50,7 @@ public: * * \param normal a vector orthogonal to the projection plane. */ - Triangulation_2_projection_traits_3(const typename K::Vector_3& normal); + Projection_traits_3(const typename K::Vector_3& normal); ///@} }; diff --git a/Kernel_23/doc/Kernel_23/PackageDescription.txt b/Kernel_23/doc/Kernel_23/PackageDescription.txt index 40d72ba9db2..873c5e089a1 100644 --- a/Kernel_23/doc/Kernel_23/PackageDescription.txt +++ b/Kernel_23/doc/Kernel_23/PackageDescription.txt @@ -71,7 +71,7 @@ - `CGAL::Simple_cartesian` - `CGAL::Simple_homogeneous` - `CGAL::Projection_traits_xy_3` -- `CGAL::Triangulation_2_projection_traits_3` +- `CGAL::Projection_traits_3` \cgalCRPSection{Predefined Kernels} diff --git a/Kernel_23/include/CGAL/Triangulation_2_projection_traits_3.h b/Kernel_23/include/CGAL/Projection_traits_3.h similarity index 69% rename from Kernel_23/include/CGAL/Triangulation_2_projection_traits_3.h rename to Kernel_23/include/CGAL/Projection_traits_3.h index e1998929fe6..f47faf41966 100644 --- a/Kernel_23/include/CGAL/Triangulation_2_projection_traits_3.h +++ b/Kernel_23/include/CGAL/Projection_traits_3.h @@ -11,8 +11,8 @@ // Author(s) : Laurent Rineau -#ifndef CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H -#define CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H +#ifndef CGAL_PROJECTION_TRAITS_3_H +#define CGAL_PROJECTION_TRAITS_3_H #include @@ -24,27 +24,27 @@ template < class Filtered_kernel > class Triangulation_2_filtered_projection_traits_3; template -class Triangulation_2_projection_traits_3 +class Projection_traits_3 : public Triangulation_2_projection_traits_base_3 { public: explicit - Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_) + Projection_traits_3(const typename Kernel::Vector_3& n_) : Triangulation_2_projection_traits_base_3(n_) {} }; template -class Triangulation_2_projection_traits_3 +class Projection_traits_3 : public Triangulation_2_filtered_projection_traits_3 { public: explicit - Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_) + Projection_traits_3(const typename Kernel::Vector_3& n_) : Triangulation_2_filtered_projection_traits_3(n_) {} }; } // end namespace CGAL -#endif // CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H +#endif // CGAL_PROJECTION_TRAITS_3_H diff --git a/Linear_cell_complex/demo/Linear_cell_complex/typedefs.h b/Linear_cell_complex/demo/Linear_cell_complex/typedefs.h index 17924ecca8d..02dbf3a129f 100644 --- a/Linear_cell_complex/demo/Linear_cell_complex/typedefs.h +++ b/Linear_cell_complex/demo/Linear_cell_complex/typedefs.h @@ -14,7 +14,7 @@ #include -#include +#include #include #include #include @@ -178,7 +178,7 @@ struct Face_info { bool is_process; }; -typedef CGAL::Triangulation_2_projection_traits_3 P_traits; +typedef CGAL::Projection_traits_3 P_traits; typedef CGAL::Triangulation_vertex_base_with_info_2 Vb; typedef CGAL::Triangulation_face_base_with_info_2 Fb1; diff --git a/Linear_cell_complex/examples/Linear_cell_complex/basic_viewer.h b/Linear_cell_complex/examples/Linear_cell_complex/basic_viewer.h index 6b7b97eb3c1..a40da37927e 100644 --- a/Linear_cell_complex/examples/Linear_cell_complex/basic_viewer.h +++ b/Linear_cell_complex/examples/Linear_cell_complex/basic_viewer.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include #include @@ -211,7 +211,7 @@ class Basic_viewer : public CGAL::QGLViewer, public QOpenGLFunctions bool is_process; }; - typedef CGAL::Triangulation_2_projection_traits_3 P_traits; + typedef CGAL::Projection_traits_3 P_traits; typedef CGAL::Triangulation_vertex_base_with_info_2 Vb; typedef CGAL::Triangulation_face_base_with_info_2 Fb1; diff --git a/Mesh_2/test/Mesh_2/test_mesh_projection_traits.cpp b/Mesh_2/test/Mesh_2/test_mesh_projection_traits.cpp index 030471c0295..63ed376d7af 100644 --- a/Mesh_2/test/Mesh_2/test_mesh_projection_traits.cpp +++ b/Mesh_2/test/Mesh_2/test_mesh_projection_traits.cpp @@ -3,12 +3,12 @@ #include #include #include -#include +#include #include typedef CGAL::Exact_predicates_inexact_constructions_kernel K1; -typedef CGAL::Triangulation_2_projection_traits_3 K; +typedef CGAL::Projection_traits_3 K; typedef CGAL::Triangulation_vertex_base_2 Vb; typedef CGAL::Delaunay_mesh_face_base_2 Fb; typedef CGAL::Triangulation_data_structure_2 Tds; diff --git a/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h b/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h index 5f651edb1ab..36608b5eade 100644 --- a/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h +++ b/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -211,7 +211,7 @@ struct Shell_polygons_visitor // cases where a cdt is needed typedef typename Nef_polyhedron::Kernel Kernel; - typedef Triangulation_2_projection_traits_3 P_traits; + typedef Projection_traits_3 P_traits; typedef Triangulation_vertex_base_with_info_2 Vb; typedef Triangulation_face_base_with_info_2 Fbb; typedef Constrained_triangulation_face_base_2 Fb; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h index a50deb6ae03..6fa77d69bed 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include @@ -389,7 +389,7 @@ private: typedef Intersection_nodes INodes; typedef typename INodes::Exact_kernel EK; - typedef Triangulation_2_projection_traits_3 CDT_traits; + typedef Projection_traits_3 CDT_traits; typedef Triangulation_vertex_base_with_info_2 Vb; typedef Constrained_triangulation_face_base_2 Fb; typedef Triangulation_data_structure_2 TDS_2; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h index e60dafba2b1..0f014dc5700 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #endif @@ -1374,7 +1374,7 @@ triangulate_hole_polyline_with_cdt(const PointRange& points, } // Checking the hole simplicity. - typedef Triangulation_2_projection_traits_3 P_traits; + typedef Projection_traits_3 P_traits; const P_traits p_traits(avg_normal); if (!is_simple_2(P.begin(), P.end() - 1, p_traits)) { // std::cerr << "WARNING: simplicity, cdt 2 falls back to the original solution!" << std::endl; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index a4c38c7b040..a2cc56ae520 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #else #include #endif @@ -152,7 +152,7 @@ public: #ifndef CGAL_TRIANGULATE_FACES_DO_NOT_USE_CDT2 if (use_cdt) { - typedef CGAL::Triangulation_2_projection_traits_3 P_traits; + typedef CGAL::Projection_traits_3 P_traits; typedef CGAL::Triangulation_vertex_base_with_info_2 Vb; typedef CGAL::Triangulation_face_base_with_info_2 P_traits; + typedef CGAL::Projection_traits_3 P_traits; typedef CGAL::Triangulation_vertex_base_with_info_2 Vb; typedef CGAL::Triangulation_face_base_with_info_2 Fb1; typedef CGAL::Constrained_triangulation_face_base_2 Fb; diff --git a/Polyhedron/demo/Polyhedron/Scene_nef_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Scene_nef_polyhedron_item.cpp index af27d7c18b2..2f3ee485b95 100644 --- a/Polyhedron/demo/Polyhedron/Scene_nef_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_nef_polyhedron_item.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include #include @@ -33,7 +33,7 @@ typedef Point_container Pc; typedef Nef_polyhedron::Traits Traits; typedef Nef_polyhedron::Halffacet Facet; -typedef CGAL::Triangulation_2_projection_traits_3 P_traits; +typedef CGAL::Projection_traits_3 P_traits; typedef Nef_polyhedron::Halfedge_const_handle Halfedge_handle; struct Face_info { Nef_polyhedron::Halfedge_const_handle e[3]; diff --git a/Polyhedron/demo/Polyhedron/triangulate_primitive.h b/Polyhedron/demo/Polyhedron/triangulate_primitive.h index bae5804da1b..a1f96c9f2bf 100644 --- a/Polyhedron/demo/Polyhedron/triangulate_primitive.h +++ b/Polyhedron/demo/Polyhedron/triangulate_primitive.h @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include @@ -20,7 +20,7 @@ class FacetTriangulator typedef typename Kernel::Vector_3 Vector; - typedef CGAL::Triangulation_2_projection_traits_3 P_traits; + typedef CGAL::Projection_traits_3 P_traits; typedef CGAL::Triangulation_vertex_base_with_info_2 Vb; diff --git a/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt b/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt index 299b4239965..8a1deae2c55 100644 --- a/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt +++ b/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt @@ -488,7 +488,7 @@ See Section \ref Section_2D_Triangulations_Delaunay for an example. deal with projections on the `yz` plane and `xz`-plane, respectively, as well as the geometric traits class -`Triangulation_2_projection_traits_3` that deals with projections on an +`Projection_traits_3` that deals with projections on an arbitrary plane, defined by its orthogonal vector. \subsection Subsection_2D_Triangulations_Basic_Example Example of a Basic Triangulation diff --git a/Triangulation_2/examples/Triangulation_2/projection_traits.cpp b/Triangulation_2/examples/Triangulation_2/projection_traits.cpp index 32812a543c3..37d691d6243 100644 --- a/Triangulation_2/examples/Triangulation_2/projection_traits.cpp +++ b/Triangulation_2/examples/Triangulation_2/projection_traits.cpp @@ -1,12 +1,12 @@ #include #include -#include +#include #include #include typedef CGAL::Exact_predicates_inexact_constructions_kernel K1; -typedef CGAL::Triangulation_2_projection_traits_3 K; +typedef CGAL::Projection_traits_3 K; typedef CGAL::Exact_predicates_tag Itag; typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; diff --git a/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp b/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp index 26693b95a28..6fcaca74953 100644 --- a/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp +++ b/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp @@ -1,8 +1,8 @@ #include #include #include -#include -#include +#include +#include #include #include @@ -69,11 +69,11 @@ int main() bool ok = true; ok = ok && test > + CGAL::Projection_traits_3 > ("CDT_2 in a 3D plane, with Epick"); ok = ok && test > + CGAL::Projection_traits_3 > ("CDT_2 in a 3D plane, with Epeck"); return ok ? 0 : 1; } From bd933ad308a635968bff58996cebd869cb568729 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 19 Mar 2021 13:10:34 +0100 Subject: [PATCH 14/26] rename doc file --- ...riangulation_2_projection_traits_3.h => Projection_traits_3.h} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Kernel_23/doc/Kernel_23/CGAL/{Triangulation_2_projection_traits_3.h => Projection_traits_3.h} (100%) diff --git a/Kernel_23/doc/Kernel_23/CGAL/Triangulation_2_projection_traits_3.h b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h similarity index 100% rename from Kernel_23/doc/Kernel_23/CGAL/Triangulation_2_projection_traits_3.h rename to Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h From 120ea6de99de1eb574000942fb2c0a633dd5cbab Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 19 Mar 2021 13:30:03 +0100 Subject: [PATCH 15/26] Re add a deprecated version of the original header and a test for it. --- .../Triangulation_2_projection_traits_3.h | 52 +++++++++++++++++++ .../test/Triangulation_2/CMakeLists.txt | 1 + .../test_deprecated_projection_traits.cpp | 34 ++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h create mode 100644 Triangulation_2/test/Triangulation_2/test_deprecated_projection_traits.cpp diff --git a/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h b/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h new file mode 100644 index 00000000000..a57c45df66f --- /dev/null +++ b/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h @@ -0,0 +1,52 @@ +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Laurent Rineau + + +#ifndef CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H +#define CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H + +#include + +#include + +#define CGAL_DEPRECATED_HEADER "" +#define CGAL_REPLACEMENT_HEADER "" +#include + +#include + +namespace CGAL{ + +template < class Filtered_kernel > +class Triangulation_2_filtered_projection_traits_3; + +template +class Triangulation_2_projection_traits_3 + : public Triangulation_2_projection_traits_base_3 +{ +public: + explicit + Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_) + : Triangulation_2_projection_traits_base_3(n_) + {} +}; + +template +class Triangulation_2_projection_traits_3 + : public Triangulation_2_filtered_projection_traits_3 +{ +public: + explicit + Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_) + : Triangulation_2_filtered_projection_traits_3(n_) + {} +}; + +} // end namespace CGAL + +#endif // CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H diff --git a/Triangulation_2/test/Triangulation_2/CMakeLists.txt b/Triangulation_2/test/Triangulation_2/CMakeLists.txt index e100aec6a6d..b7baf469961 100644 --- a/Triangulation_2/test/Triangulation_2/CMakeLists.txt +++ b/Triangulation_2/test/Triangulation_2/CMakeLists.txt @@ -29,5 +29,6 @@ if(BUILD_TESTING) execution___of__test_regular_triangulation_2 execution___of__test_const_del_triangulation_2 execution___of__test_regular_hierarchy_2 + execution___of__test_deprecated_projection_traits PROPERTIES RESOURCE_LOCK Triangulation_2_Tests_IO) endif() diff --git a/Triangulation_2/test/Triangulation_2/test_deprecated_projection_traits.cpp b/Triangulation_2/test/Triangulation_2/test_deprecated_projection_traits.cpp new file mode 100644 index 00000000000..df86daf7169 --- /dev/null +++ b/Triangulation_2/test/Triangulation_2/test_deprecated_projection_traits.cpp @@ -0,0 +1,34 @@ +#include + +#include +#include +#include + +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K1; +typedef CGAL::Triangulation_2_projection_traits_3 K; + +typedef CGAL::Exact_predicates_tag Itag; +typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; +typedef CDT::Point Point; +typedef CDT::Edge Edge; + +int main() +{ + //4 points on the diagonal plane of a cube + std::vector ps(4); + ps[0] = Point(0,0,0); + ps[1] = Point(3,1,-1); + ps[2] = Point(-1, 3, -3); + ps[3] = Point(1,0.5,-0.5); + + K gt{ { 0, 1, 1} }; + CDT cdt(gt); + for(int i = 0; i< 4; ++i) + cdt.insert(ps[i]); + + for (int i = 1; i < 3; ++i) + cdt.insert_constraint( ps[i], ps[i+1]); +} From d33a3622c823946ea16043c14115ef9b48ea9b2f Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 19 Mar 2021 13:51:27 +0100 Subject: [PATCH 16/26] Fix namespace error in Triangulate_hole_polyline.h --- .../internal/Hole_filling/Triangulate_hole_polyline.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h index 0f014dc5700..f0b05e230c7 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h @@ -1374,7 +1374,7 @@ triangulate_hole_polyline_with_cdt(const PointRange& points, } // Checking the hole simplicity. - typedef Projection_traits_3 P_traits; + typedef CGAL::Projection_traits_3 P_traits; const P_traits p_traits(avg_normal); if (!is_simple_2(P.begin(), P.end() - 1, p_traits)) { // std::cerr << "WARNING: simplicity, cdt 2 falls back to the original solution!" << std::endl; From 6205f26d097c5872277a119f69fa870c80d958b4 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 19 Mar 2021 13:57:02 +0100 Subject: [PATCH 17/26] license --- .../include/CGAL/Triangulation_2_projection_traits_3.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h b/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h index a57c45df66f..4d45393d5be 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h +++ b/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h @@ -1,3 +1,7 @@ +// Copyright (c) 2009 GeometryFactory (France) +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). // // $URL$ // $Id$ From 3795c5236a12104a162cf728caaf8fd37ab26e3f Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 18 May 2021 10:16:24 +0200 Subject: [PATCH 18/26] Changes after review --- .../doc/Kernel_23/CGAL/Projection_traits_3.h | 18 +++++++++--------- .../Kernel_23/CGAL/Projection_traits_xy_3.h | 6 ++++++ Kernel_23/include/CGAL/Projection_traits_3.h | 2 +- ...aits_3.h => Filtered_projection_traits_3.h} | 2 +- ...its_base_3.h => Projection_traits_base_3.h} | 0 .../convert_nef_polyhedron_to_polygon_mesh.h | 4 ++-- .../internal/Corefinement/Visitor.h | 4 ++-- .../doc/Triangulation_2/Triangulation_2.txt | 4 ++-- .../CGAL/Triangulation_2_projection_traits_3.h | 7 +++---- ...st_cdt_2_projection_traits_special_case.cpp | 1 - 10 files changed, 26 insertions(+), 22 deletions(-) rename Kernel_23/include/CGAL/internal/{Triangulation_2_filtered_projection_traits_3.h => Filtered_projection_traits_3.h} (97%) rename Kernel_23/include/CGAL/internal/{Triangulation_2_projection_traits_base_3.h => Projection_traits_base_3.h} (100%) diff --git a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h index 4ee6daf9baf..6e39fc842d1 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h @@ -1,15 +1,15 @@ namespace CGAL{ /*! - \ingroup PkgTriangulation2TriangulationClasses +\ingroup kernel_classes - The class `Projection_traits_3` works similarly as the `Projection_traits_xy_3`, - `Projection_traits_xz_3` and `Projection_traits_yz_3` traits classes, by enabling - the use of 2D algorithms on the projections of 3D data on an arbitrary plane. +The class `Projection_traits_3` works similarly to the `Projection_traits_xy_3`, +`Projection_traits_xz_3`, and `Projection_traits_yz_3` traits classes, by enabling +the use of 2D algorithms on the projections of 3D data onto an arbitrary plane. - \tparam K must be a model of `Kernel` +\tparam K must be a model of `Kernel` - \note Internal constructions (projections) are used in the predicate and +\note Internal constructions (projections) are used in the predicate and construction functors of this class. If `K` is a model of `Kernel` providing exact constructions or if `K` is a `CGAL::Filtered_kernel` (such as for `CGAL::Exact_predicates_inexact_constructions_kernel`), this class automatically @@ -20,7 +20,7 @@ provides exact predicates. \cgalModels `ConstrainedTriangulationTraits_2` \cgalModels `PolygonTraits_2` - */ +*/ template class Projection_traits_3 { @@ -36,9 +36,9 @@ public: /// \name Functors /// The functors provided by this class are those listed in the - /// concepts. The functors operate on the 2D projection of their + /// concepts. The functors operate on the 2D projections of their /// arguments. They come with preconditions that projections of the - /// arguments are non-degenerate, eg. a line segment does not project + /// arguments are non-degenerate, e.g. a line segment does not project /// on a single point, two points do not project on the same point, etc. ///@} diff --git a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h index 5f6c54d1ac0..b4979865d49 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h @@ -15,6 +15,12 @@ respectively. \tparam K must be a model of `Kernel`. +\note Internal constructions (projections) are used in the predicate and +construction functors of this class. If `K` is a model of `Kernel` providing exact +constructions or if `K` is a `CGAL::Filtered_kernel` (such as for +`CGAL::Exact_predicates_inexact_constructions_kernel`), this class automatically +provides exact predicates. + \cgalModels The class is a model of several 2D triangulation traits class concepts, except that it does not provide the type and constructors required to build the dual Voronoi diagram. diff --git a/Kernel_23/include/CGAL/Projection_traits_3.h b/Kernel_23/include/CGAL/Projection_traits_3.h index f47faf41966..a7bddcc5638 100644 --- a/Kernel_23/include/CGAL/Projection_traits_3.h +++ b/Kernel_23/include/CGAL/Projection_traits_3.h @@ -15,7 +15,7 @@ #define CGAL_PROJECTION_TRAITS_3_H -#include +#include namespace CGAL{ diff --git a/Kernel_23/include/CGAL/internal/Triangulation_2_filtered_projection_traits_3.h b/Kernel_23/include/CGAL/internal/Filtered_projection_traits_3.h similarity index 97% rename from Kernel_23/include/CGAL/internal/Triangulation_2_filtered_projection_traits_3.h rename to Kernel_23/include/CGAL/internal/Filtered_projection_traits_3.h index dd7d4871ac2..de40081e096 100644 --- a/Kernel_23/include/CGAL/internal/Triangulation_2_filtered_projection_traits_3.h +++ b/Kernel_23/include/CGAL/internal/Filtered_projection_traits_3.h @@ -14,7 +14,7 @@ #ifndef CGAL_INTERNAL_FILTERED_PROJECTION_TRAITS_3_H #define CGAL_INTERNAL_FILTERED_PROJECTION_TRAITS_3_H -#include +#include #include namespace CGAL { diff --git a/Kernel_23/include/CGAL/internal/Triangulation_2_projection_traits_base_3.h b/Kernel_23/include/CGAL/internal/Projection_traits_base_3.h similarity index 100% rename from Kernel_23/include/CGAL/internal/Triangulation_2_projection_traits_base_3.h rename to Kernel_23/include/CGAL/internal/Projection_traits_base_3.h diff --git a/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h b/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h index 36608b5eade..dd289b6d3f3 100644 --- a/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h +++ b/Nef_3/include/CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h @@ -210,8 +210,8 @@ struct Shell_polygons_visitor } // cases where a cdt is needed - typedef typename Nef_polyhedron::Kernel Kernel; - typedef Projection_traits_3 P_traits; + typedef typename Nef_polyhedron::Kernel Kernel; + typedef Projection_traits_3 P_traits; typedef Triangulation_vertex_base_with_info_2 Vb; typedef Triangulation_face_base_with_info_2 Fbb; typedef Constrained_triangulation_face_base_2 Fb; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h index 6fa77d69bed..80b505f031d 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Visitor.h @@ -387,9 +387,9 @@ private: typedef Non_manifold_feature_map NM_features_map; // typedef for the CDT typedef Intersection_nodes INodes; + Predicates_on_constructions_needed> INodes; typedef typename INodes::Exact_kernel EK; - typedef Projection_traits_3 CDT_traits; + typedef Projection_traits_3 CDT_traits; typedef Triangulation_vertex_base_with_info_2 Vb; typedef Constrained_triangulation_face_base_2 Fb; typedef Triangulation_data_structure_2 TDS_2; diff --git a/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt b/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt index 8a1deae2c55..ad52360f110 100644 --- a/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt +++ b/Triangulation_2/doc/Triangulation_2/Triangulation_2.txt @@ -488,8 +488,8 @@ See Section \ref Section_2D_Triangulations_Delaunay for an example. deal with projections on the `yz` plane and `xz`-plane, respectively, as well as the geometric traits class -`Projection_traits_3` that deals with projections on an -arbitrary plane, defined by its orthogonal vector. +`Projection_traits_3` that deals with projections onto an +arbitrary plane defined by its orthogonal vector. \subsection Subsection_2D_Triangulations_Basic_Example Example of a Basic Triangulation diff --git a/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h b/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h index 4d45393d5be..373f447c724 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h +++ b/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h @@ -16,14 +16,13 @@ #include -#include #define CGAL_DEPRECATED_HEADER "" #define CGAL_REPLACEMENT_HEADER "" #include -#include - +#include +#ifndef CGAL_NO_DEPRECATED_CODE namespace CGAL{ template < class Filtered_kernel > @@ -52,5 +51,5 @@ public: }; } // end namespace CGAL - +#endif //CGAL_NO_DEPRECATED_CODE #endif // CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H diff --git a/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp b/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp index 6fcaca74953..2c9caa0da82 100644 --- a/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp +++ b/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp @@ -2,7 +2,6 @@ #include #include #include -#include #include #include From 75db0292f662444db1ae865375496aae78ede6b0 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 19 May 2021 09:25:13 +0200 Subject: [PATCH 19/26] Rename internal classes --- Kernel_23/include/CGAL/Projection_traits_3.h | 10 +++++----- .../CGAL/internal/Filtered_projection_traits_3.h | 16 ++++++++-------- .../CGAL/internal/Projection_traits_base_3.h | 8 ++++---- .../CGAL/Triangulation_2_projection_traits_3.h | 10 +++++----- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Kernel_23/include/CGAL/Projection_traits_3.h b/Kernel_23/include/CGAL/Projection_traits_3.h index a7bddcc5638..e024e5b24e4 100644 --- a/Kernel_23/include/CGAL/Projection_traits_3.h +++ b/Kernel_23/include/CGAL/Projection_traits_3.h @@ -21,27 +21,27 @@ namespace CGAL{ // This declaration is needed to break the cyclic dependency. template < class Filtered_kernel > -class Triangulation_2_filtered_projection_traits_3; +class Filtered_projection_traits_3; template class Projection_traits_3 - : public Triangulation_2_projection_traits_base_3 + : public Projection_traits_base_3 { public: explicit Projection_traits_3(const typename Kernel::Vector_3& n_) - : Triangulation_2_projection_traits_base_3(n_) + : Projection_traits_base_3(n_) {} }; template class Projection_traits_3 - : public Triangulation_2_filtered_projection_traits_3 + : public Filtered_projection_traits_3 { public: explicit Projection_traits_3(const typename Kernel::Vector_3& n_) - : Triangulation_2_filtered_projection_traits_3(n_) + : Filtered_projection_traits_3(n_) {} }; diff --git a/Kernel_23/include/CGAL/internal/Filtered_projection_traits_3.h b/Kernel_23/include/CGAL/internal/Filtered_projection_traits_3.h index de40081e096..076cff2f2ab 100644 --- a/Kernel_23/include/CGAL/internal/Filtered_projection_traits_3.h +++ b/Kernel_23/include/CGAL/internal/Filtered_projection_traits_3.h @@ -20,12 +20,12 @@ namespace CGAL { template < class Filtered_kernel > -class Triangulation_2_filtered_projection_traits_3 - : public Triangulation_2_projection_traits_base_3 +class Filtered_projection_traits_3 + : public Projection_traits_base_3 { typedef Filtered_kernel K; - typedef Triangulation_2_filtered_projection_traits_3 Self; - typedef Triangulation_2_projection_traits_base_3 Base; + typedef Filtered_projection_traits_3 Self; + typedef Projection_traits_base_3 Base; typedef typename K::Exact_kernel Exact_kernel; typedef typename K::Approximate_kernel Approximate_kernel; @@ -33,11 +33,11 @@ class Triangulation_2_filtered_projection_traits_3 typedef typename K::C2F C2F; public: - typedef Triangulation_2_projection_traits_base_3 Exact_traits; - typedef Triangulation_2_projection_traits_base_3 Filtering_traits; + typedef Projection_traits_base_3 Exact_traits; + typedef Projection_traits_base_3 Filtering_traits; public: - explicit Triangulation_2_filtered_projection_traits_3(const typename K::Vector_3& n) + explicit Filtered_projection_traits_3(const typename K::Vector_3& n) : Base(n) { } @@ -70,7 +70,7 @@ public: CGAL_TRIANGULATION_2_PROJ_TRAITS_FILTER_PRED(Compare_y_2, compare_y_2_object, base2) -}; // end class Triangulation_2_projection_traits_base_3 +}; // end class Projection_traits_base_3 } // end namespace CGAL diff --git a/Kernel_23/include/CGAL/internal/Projection_traits_base_3.h b/Kernel_23/include/CGAL/internal/Projection_traits_base_3.h index 90db22f0805..cc69b9baa10 100644 --- a/Kernel_23/include/CGAL/internal/Projection_traits_base_3.h +++ b/Kernel_23/include/CGAL/internal/Projection_traits_base_3.h @@ -317,9 +317,9 @@ public: template < class Kernel > -class Triangulation_2_projection_traits_base_3 +class Projection_traits_base_3 { - typedef Triangulation_2_projection_traits_base_3 Self; + typedef Projection_traits_base_3 Self; typename Kernel::Vector_3 n, b1, b2; @@ -327,7 +327,7 @@ public: typedef typename Kernel::Vector_3 Vector_3; - explicit Triangulation_2_projection_traits_base_3(const Vector_3& n_) + explicit Projection_traits_base_3(const Vector_3& n_) : n(n_) { typedef typename Kernel::FT FT; @@ -527,7 +527,7 @@ public: return Projection_to_plan(plane_point, *this); } -}; // end class Triangulation_2_projection_traits_base_3 +}; // end class Projection_traits_base_3 } // end namespace CGAL diff --git a/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h b/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h index 373f447c724..47690013880 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h +++ b/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h @@ -26,27 +26,27 @@ namespace CGAL{ template < class Filtered_kernel > -class Triangulation_2_filtered_projection_traits_3; +class Filtered_projection_traits_3; template class Triangulation_2_projection_traits_3 - : public Triangulation_2_projection_traits_base_3 + : public Projection_traits_base_3 { public: explicit Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_) - : Triangulation_2_projection_traits_base_3(n_) + : Projection_traits_base_3(n_) {} }; template class Triangulation_2_projection_traits_3 - : public Triangulation_2_filtered_projection_traits_3 + : public Filtered_projection_traits_3 { public: explicit Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_) - : Triangulation_2_filtered_projection_traits_3(n_) + : Filtered_projection_traits_3(n_) {} }; From 3a0d1d005291e480408a1eef934f204aece0f000 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 27 May 2021 09:16:02 +0200 Subject: [PATCH 20/26] Untouch the triangulation concepts --- .../ConstrainedTriangulationTraits_2.h | 5 ++++ .../Concepts/TriangulationTraits_2.h | 23 +++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h b/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h index 1b08750c491..eae059ac51e 100644 --- a/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h +++ b/Triangulation_2/doc/Triangulation_2/Concepts/ConstrainedTriangulationTraits_2.h @@ -50,6 +50,11 @@ typedef unspecified_type Intersect_2; /// When the constrained triangulation is instantiated with the intersection tag `CGAL::Exact_predicates_tag`, the used algorithm needs to be able to compare some distances between points and lines and the following types are further required. /// @{ +/*! +A number type supporting the comparison operator `<`. +*/ +typedef unspecified_type RT; + /*! The line type. */ diff --git a/Triangulation_2/doc/Triangulation_2/Concepts/TriangulationTraits_2.h b/Triangulation_2/doc/Triangulation_2/Concepts/TriangulationTraits_2.h index f7158d6679c..0329639d1aa 100644 --- a/Triangulation_2/doc/Triangulation_2/Concepts/TriangulationTraits_2.h +++ b/Triangulation_2/doc/Triangulation_2/Concepts/TriangulationTraits_2.h @@ -187,6 +187,29 @@ typedef unspecified_type Construct_circumcenter_2; /// @} +/// \name Creation +/// Only a default constructor, copy constructor and an assignment +/// operator are required. Note that further constructors can be +/// provided. +/// @{ + +/*! +default constructor. +*/ +TriangulationTraits_2(); + +/*! +Copy constructor +*/ +TriangulationTraits_2(TriangulationTraits_2 gtr); + +/*! +Assignment operator. +*/ +TriangulationTraits_2 operator=(TriangulationTraits_2 gtr); + +/// @} + /// \name Predicate Functions /// The following functions give access to the predicate and /// constructor objects. From 7721f034a848c6ab7e024637de988c27ec7db329 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 8 Jul 2021 11:42:02 +0200 Subject: [PATCH 21/26] update README.md --- Installation/CHANGES.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index 53170b00ebc..fe899e8ea4f 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -1,5 +1,13 @@ Release History =============== +[Release 5.4](https://github.com/CGAL/cgal/releases/tag/v5.4) +----------- + +Release date: December 2021 + +### [2D and 3D Linear Geometry Kernel](https://doc.cgal.org/5.3/Manual/packages.html#PkgKernel23) + +- Added documentation for the class `Projection_traits_3`, that enables the use of 2D algorithms on the projections of 3D data into an arbitrary plane. [Release 5.3](https://github.com/CGAL/cgal/releases/tag/v5.3) ----------- From 5a30c321b8aabdccf109733b44a04a28ba243382 Mon Sep 17 00:00:00 2001 From: Mael Date: Wed, 4 Aug 2021 15:42:04 +0200 Subject: [PATCH 22/26] Misc cleaning --- Installation/CHANGES.md | 2 +- .../doc/Kernel_23/CGAL/Projection_traits_3.h | 4 ++-- Kernel_23/include/CGAL/Projection_traits_3.h | 11 ++++------- .../Triangulation_2/projection_traits.cpp | 18 +++++++++--------- .../test_deprecated_projection_traits.cpp | 12 ++++++------ 5 files changed, 22 insertions(+), 25 deletions(-) diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index fe899e8ea4f..3635adb04af 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -7,7 +7,7 @@ Release date: December 2021 ### [2D and 3D Linear Geometry Kernel](https://doc.cgal.org/5.3/Manual/packages.html#PkgKernel23) -- Added documentation for the class `Projection_traits_3`, that enables the use of 2D algorithms on the projections of 3D data into an arbitrary plane. +- Added documentation for the class `Projection_traits_3`, which enables the use of 2D algorithms on the projections of 3D data onto an arbitrary plane. [Release 5.3](https://github.com/CGAL/cgal/releases/tag/v5.3) ----------- diff --git a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h index 6e39fc842d1..aaeb6a4ad3b 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h @@ -4,7 +4,7 @@ namespace CGAL{ \ingroup kernel_classes The class `Projection_traits_3` works similarly to the `Projection_traits_xy_3`, -`Projection_traits_xz_3`, and `Projection_traits_yz_3` traits classes, by enabling +`Projection_traits_xz_3`, and `Projection_traits_yz_3` traits classes, enabling the use of 2D algorithms on the projections of 3D data onto an arbitrary plane. \tparam K must be a model of `Kernel` @@ -39,7 +39,7 @@ public: /// concepts. The functors operate on the 2D projections of their /// arguments. They come with preconditions that projections of the /// arguments are non-degenerate, e.g. a line segment does not project - /// on a single point, two points do not project on the same point, etc. + /// on a single point, two points do not project onto the same point, etc. ///@} /// \name Creation diff --git a/Kernel_23/include/CGAL/Projection_traits_3.h b/Kernel_23/include/CGAL/Projection_traits_3.h index e024e5b24e4..223e12f4d1b 100644 --- a/Kernel_23/include/CGAL/Projection_traits_3.h +++ b/Kernel_23/include/CGAL/Projection_traits_3.h @@ -14,10 +14,9 @@ #ifndef CGAL_PROJECTION_TRAITS_3_H #define CGAL_PROJECTION_TRAITS_3_H - #include -namespace CGAL{ +namespace CGAL { // This declaration is needed to break the cyclic dependency. template < class Filtered_kernel > @@ -28,8 +27,7 @@ class Projection_traits_3 : public Projection_traits_base_3 { public: - explicit - Projection_traits_3(const typename Kernel::Vector_3& n_) + explicit Projection_traits_3(const typename Kernel::Vector_3& n_) : Projection_traits_base_3(n_) {} }; @@ -39,12 +37,11 @@ class Projection_traits_3 : public Filtered_projection_traits_3 { public: - explicit - Projection_traits_3(const typename Kernel::Vector_3& n_) + explicit Projection_traits_3(const typename Kernel::Vector_3& n_) : Filtered_projection_traits_3(n_) {} }; -} // end namespace CGAL +} // namespace CGAL #endif // CGAL_PROJECTION_TRAITS_3_H diff --git a/Triangulation_2/examples/Triangulation_2/projection_traits.cpp b/Triangulation_2/examples/Triangulation_2/projection_traits.cpp index 37d691d6243..73662c0eba7 100644 --- a/Triangulation_2/examples/Triangulation_2/projection_traits.cpp +++ b/Triangulation_2/examples/Triangulation_2/projection_traits.cpp @@ -5,11 +5,11 @@ #include #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel K1; -typedef CGAL::Projection_traits_3 K; +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Projection_traits_3 GT; typedef CGAL::Exact_predicates_tag Itag; -typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; +typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; typedef CDT::Point Point; typedef CDT::Edge Edge; @@ -22,18 +22,18 @@ int main() ps[2] = Point(-1, 3, -3); ps[3] = Point(1,0.5,-0.5); - K gt{ { 0, 1, 1} }; + GT gt{ { 0, 1, 1} }; CDT cdt(gt); for(int i = 0; i< 4; ++i) cdt.insert(ps[i]); - for (int i = 1; i < 3; ++i) - cdt.insert_constraint( ps[i], ps[i+1]); + for(int i = 1; i < 3; ++i) + cdt.insert_constraint(ps[i], ps[i+1]); - for (CDT::Face_handle f : cdt.all_face_handles()) + for(CDT::Face_handle f : cdt.all_face_handles()) { for(int i=0; i<3; ++i) - std::cout<vertex(i)->point()<<" "; - std::cout<vertex(i)->point() << " "; + std::cout << std::endl; } } diff --git a/Triangulation_2/test/Triangulation_2/test_deprecated_projection_traits.cpp b/Triangulation_2/test/Triangulation_2/test_deprecated_projection_traits.cpp index df86daf7169..8b040bff74d 100644 --- a/Triangulation_2/test/Triangulation_2/test_deprecated_projection_traits.cpp +++ b/Triangulation_2/test/Triangulation_2/test_deprecated_projection_traits.cpp @@ -7,11 +7,11 @@ #include #include -typedef CGAL::Exact_predicates_inexact_constructions_kernel K1; -typedef CGAL::Triangulation_2_projection_traits_3 K; +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef CGAL::Triangulation_2_projection_traits_3 GT; typedef CGAL::Exact_predicates_tag Itag; -typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; +typedef CGAL::Constrained_Delaunay_triangulation_2 CDT; typedef CDT::Point Point; typedef CDT::Edge Edge; @@ -24,11 +24,11 @@ int main() ps[2] = Point(-1, 3, -3); ps[3] = Point(1,0.5,-0.5); - K gt{ { 0, 1, 1} }; + GT gt{ { 0, 1, 1} }; CDT cdt(gt); for(int i = 0; i< 4; ++i) cdt.insert(ps[i]); - for (int i = 1; i < 3; ++i) - cdt.insert_constraint( ps[i], ps[i+1]); + for(int i = 1; i < 3; ++i) + cdt.insert_constraint(ps[i], ps[i+1]); } From bcce76c0620fd863f89997045b9d57917ca75a8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 26 Aug 2021 11:08:16 +0200 Subject: [PATCH 23/26] Fix test & warnings --- BGL/test/BGL/test_deprecated_io.cpp | 1 + .../Triangulation_2_projection_traits_3.h | 18 +++++++-------- ...t_cdt_2_projection_traits_special_case.cpp | 23 +++++++------------ 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/BGL/test/BGL/test_deprecated_io.cpp b/BGL/test/BGL/test_deprecated_io.cpp index cd7981d324a..13472aeabd8 100644 --- a/BGL/test/BGL/test_deprecated_io.cpp +++ b/BGL/test/BGL/test_deprecated_io.cpp @@ -1,4 +1,5 @@ #include + #include #include #include diff --git a/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h b/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h index 47690013880..52db6cabf95 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h +++ b/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h @@ -10,31 +10,30 @@ // // Author(s) : Laurent Rineau - #ifndef CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H #define CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H #include - #define CGAL_DEPRECATED_HEADER "" #define CGAL_REPLACEMENT_HEADER "" #include -#include #ifndef CGAL_NO_DEPRECATED_CODE -namespace CGAL{ + +#include + +namespace CGAL { template < class Filtered_kernel > class Filtered_projection_traits_3; -template +template class Triangulation_2_projection_traits_3 : public Projection_traits_base_3 { public: - explicit - Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_) + explicit Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_) : Projection_traits_base_3(n_) {} }; @@ -44,12 +43,13 @@ class Triangulation_2_projection_traits_3 : public Filtered_projection_traits_3 { public: - explicit - Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_) + explicit Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_) : Filtered_projection_traits_3(n_) {} }; } // end namespace CGAL + #endif //CGAL_NO_DEPRECATED_CODE + #endif // CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H diff --git a/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp b/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp index 645184dca57..4b2151044fd 100644 --- a/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp +++ b/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp @@ -1,12 +1,15 @@ #include #include + #include #include +#include +#include + #include #include - typedef const double vec[3]; const vec input[10] = { { -0.37503900000000001, 0.5, 0.47710999999999998 }, @@ -127,20 +130,10 @@ int main() typedef CGAL::Exact_predicates_inexact_constructions_kernel Epick; bool ok = true; - ok = ok && - test > - ("CDT_2 in a 3D plane, with Epick"); - ok = ok && - test > - ("CDT_2 in a 3D plane, with Epeck"); - ok = ok && test_segment_intersections > - ("CDT_2 traits intersection with Epick"); - ok = ok && test_segment_intersections > - ("CDT_2 traits intersection with Epeck"); + ok = ok && test >("CDT_2 in a 3D plane, with Epick"); + ok = ok && test >("CDT_2 in a 3D plane, with Epeck"); + ok = ok && test_segment_intersections >("CDT_2 traits intersection with Epick"); + ok = ok && test_segment_intersections >("CDT_2 traits intersection with Epeck"); return ok ? 0 : 1; } From 71d88536b819982ca91e306e1f64d9f8742a6d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 26 Aug 2021 11:08:28 +0200 Subject: [PATCH 24/26] Fix doc --- Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h | 14 ++++---------- .../doc/Kernel_23/CGAL/Projection_traits_xy_3.h | 1 + .../include/CGAL/internal/Projection_traits_3.h | 2 ++ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h index aaeb6a4ad3b..36ee3865126 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h @@ -20,27 +20,20 @@ provides exact predicates. \cgalModels `ConstrainedTriangulationTraits_2` \cgalModels `PolygonTraits_2` +\sa `CGAL::Projection_traits_xy_3` +\sa `CGAL::Projection_traits_xz_3` +\sa `CGAL::Projection_traits_yz_3` */ template class Projection_traits_3 { public: - ///\name Types - ///@{ - - //! - typedef typename K::Point_3 Point_2; - - ///@} - - /// \name Functors /// The functors provided by this class are those listed in the /// concepts. The functors operate on the 2D projections of their /// arguments. They come with preconditions that projections of the /// arguments are non-degenerate, e.g. a line segment does not project /// on a single point, two points do not project onto the same point, etc. - ///@} /// \name Creation ///@{ @@ -54,4 +47,5 @@ public: ///@} }; + } // end namespace CGAL diff --git a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h index b4979865d49..00ccfe4c298 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_xy_3.h @@ -32,6 +32,7 @@ provides exact predicates. \cgalModels `ConvexHullTraits_2` \cgalModels `DelaunayMeshTraits_2` +\sa `CGAL::Projection_traits_3` */ template< typename K > class Projection_traits_xy_3 { diff --git a/Kernel_23/include/CGAL/internal/Projection_traits_3.h b/Kernel_23/include/CGAL/internal/Projection_traits_3.h index 0cb5624bc74..d8c230c546c 100644 --- a/Kernel_23/include/CGAL/internal/Projection_traits_3.h +++ b/Kernel_23/include/CGAL/internal/Projection_traits_3.h @@ -833,6 +833,8 @@ public: } }; +// This is for projection traits along a specific canonical plane (xy, yz, xz) +// The generic class for an arbitrary normal is CGAL::Projection_traits_3 (not in `internal`) template < class R, int dim > class Projection_traits_3 { public: From 1cbcc393707a57b68841b54a1bedd8814a66e952 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Thu, 26 Aug 2021 11:15:36 +0200 Subject: [PATCH 25/26] Rename example to avoid conflicts --- Kernel_23/doc/Kernel_23/examples.txt | 2 +- ...rojection_traits.cpp => triangulation_projection_traits.cpp} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Triangulation_2/examples/Triangulation_2/{projection_traits.cpp => triangulation_projection_traits.cpp} (100%) diff --git a/Kernel_23/doc/Kernel_23/examples.txt b/Kernel_23/doc/Kernel_23/examples.txt index f368c37477f..7a089e79115 100644 --- a/Kernel_23/doc/Kernel_23/examples.txt +++ b/Kernel_23/doc/Kernel_23/examples.txt @@ -13,5 +13,5 @@ \example Kernel_23/points_and_segment.cpp \example Kernel_23/surprising.cpp \example Kernel_23/exact.cpp -\example Triangulation_2/projection_traits.cpp +\example Triangulation_2/triangulation_projection_traits.cpp */ diff --git a/Triangulation_2/examples/Triangulation_2/projection_traits.cpp b/Triangulation_2/examples/Triangulation_2/triangulation_projection_traits.cpp similarity index 100% rename from Triangulation_2/examples/Triangulation_2/projection_traits.cpp rename to Triangulation_2/examples/Triangulation_2/triangulation_projection_traits.cpp From dacbd186d10e1cc218721114d2cdea16b188cf1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Mon, 30 Aug 2021 12:35:34 +0200 Subject: [PATCH 26/26] accomodate changes of internal -> Pkg/internal --- .../{ => Kernel_23}/internal/Filtered_projection_traits_3.h | 2 +- .../CGAL/{ => Kernel_23}/internal/Projection_traits_base_3.h | 0 Kernel_23/include/CGAL/Projection_traits_3.h | 2 +- .../include/CGAL/Triangulation_2_projection_traits_3.h | 4 ++-- .../test_cdt_2_projection_traits_special_case.cpp | 2 +- .../Triangulation_2/test_deprecated_projection_traits.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename Kernel_23/include/CGAL/{ => Kernel_23}/internal/Filtered_projection_traits_3.h (97%) rename Kernel_23/include/CGAL/{ => Kernel_23}/internal/Projection_traits_base_3.h (100%) diff --git a/Kernel_23/include/CGAL/internal/Filtered_projection_traits_3.h b/Kernel_23/include/CGAL/Kernel_23/internal/Filtered_projection_traits_3.h similarity index 97% rename from Kernel_23/include/CGAL/internal/Filtered_projection_traits_3.h rename to Kernel_23/include/CGAL/Kernel_23/internal/Filtered_projection_traits_3.h index 076cff2f2ab..968caae994b 100644 --- a/Kernel_23/include/CGAL/internal/Filtered_projection_traits_3.h +++ b/Kernel_23/include/CGAL/Kernel_23/internal/Filtered_projection_traits_3.h @@ -14,7 +14,7 @@ #ifndef CGAL_INTERNAL_FILTERED_PROJECTION_TRAITS_3_H #define CGAL_INTERNAL_FILTERED_PROJECTION_TRAITS_3_H -#include +#include #include namespace CGAL { diff --git a/Kernel_23/include/CGAL/internal/Projection_traits_base_3.h b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h similarity index 100% rename from Kernel_23/include/CGAL/internal/Projection_traits_base_3.h rename to Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h diff --git a/Kernel_23/include/CGAL/Projection_traits_3.h b/Kernel_23/include/CGAL/Projection_traits_3.h index 223e12f4d1b..4deb40f0bce 100644 --- a/Kernel_23/include/CGAL/Projection_traits_3.h +++ b/Kernel_23/include/CGAL/Projection_traits_3.h @@ -14,7 +14,7 @@ #ifndef CGAL_PROJECTION_TRAITS_3_H #define CGAL_PROJECTION_TRAITS_3_H -#include +#include namespace CGAL { diff --git a/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h b/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h index 52db6cabf95..683c6d42153 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h +++ b/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h @@ -17,11 +17,11 @@ #define CGAL_DEPRECATED_HEADER "" #define CGAL_REPLACEMENT_HEADER "" -#include +#include #ifndef CGAL_NO_DEPRECATED_CODE -#include +#include namespace CGAL { diff --git a/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp b/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp index 4b2151044fd..1f6638de00e 100644 --- a/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp +++ b/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include diff --git a/Triangulation_2/test/Triangulation_2/test_deprecated_projection_traits.cpp b/Triangulation_2/test/Triangulation_2/test_deprecated_projection_traits.cpp index 8b040bff74d..84a8465162d 100644 --- a/Triangulation_2/test/Triangulation_2/test_deprecated_projection_traits.cpp +++ b/Triangulation_2/test/Triangulation_2/test_deprecated_projection_traits.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include