diff --git a/BGL/test/BGL/test_deprecated_io.cpp b/BGL/test/BGL/test_deprecated_io.cpp index 0759dbc8f5b..65459a997fd 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/GraphicsView/include/CGAL/Buffer_for_vao.h b/GraphicsView/include/CGAL/Buffer_for_vao.h index e0af44f8e89..e1093da21a7 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/Installation/CHANGES.md b/Installation/CHANGES.md index 77edf0ad8b7..8454502f810 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -39,6 +39,8 @@ Release date: December 2021 - Added `construct_centroid_2_object()` and `compute_determinant_2_object()` in `Projection_traits_xy_3`, `Projection_traits_xz_3`, and`Projection_traits_yz_3` classes. +- 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. + ### [Polygon Mesh Processing](https://doc.cgal.org/5.4/Manual/packages.html#PkgPolygonMeshProcessing) - Added the function `CGAL::Polygon_mesh_processing::match_faces()`, which, given two polygon meshes, diff --git a/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h new file mode 100644 index 00000000000..36ee3865126 --- /dev/null +++ b/Kernel_23/doc/Kernel_23/CGAL/Projection_traits_3.h @@ -0,0 +1,51 @@ +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, enabling +the use of 2D algorithms on the projections of 3D data onto 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` + +\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 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 + ///@{ + + /*! + * \brief Constructor + * + * \param normal a vector orthogonal to the projection plane. + */ + Projection_traits_3(const typename K::Vector_3& normal); + + ///@} +}; + +} // 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 67c3a96b0bd..bdda2985723 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,13 @@ deal with projections on the `zx`- and the `zy`-plane, respectively. -\cgalHeading{Parameters} +\tparam K must be a model of `Kernel`. -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`. +\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 @@ -33,6 +34,7 @@ and predicates defined in `K`. \cgalModels `AnalyticWeightTraits_2` \cgalModels `BarycentricTraits_2` +\sa `CGAL::Projection_traits_3` */ template< typename K > class Projection_traits_xy_3 { diff --git a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h index e9a5d9f3058..b83e4c7aa02 100644 --- a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h +++ b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h @@ -8898,7 +8898,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`. @@ -8928,7 +8928,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, @@ -8957,7 +8957,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, @@ -9040,7 +9040,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/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..873c5e089a1 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::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..7a089e79115 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/triangulation_projection_traits.cpp */ diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_filtered_projection_traits_3.h b/Kernel_23/include/CGAL/Kernel_23/internal/Filtered_projection_traits_3.h similarity index 66% rename from Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_filtered_projection_traits_3.h rename to Kernel_23/include/CGAL/Kernel_23/internal/Filtered_projection_traits_3.h index 5bf5849d485..968caae994b 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_filtered_projection_traits_3.h +++ b/Kernel_23/include/CGAL/Kernel_23/internal/Filtered_projection_traits_3.h @@ -5,30 +5,27 @@ // // $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 -#ifndef CGAL_INTERNAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H -#define CGAL_INTERNAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H +#ifndef CGAL_INTERNAL_FILTERED_PROJECTION_TRAITS_3_H +#define CGAL_INTERNAL_FILTERED_PROJECTION_TRAITS_3_H -#include - - -#include +#include #include 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; @@ -36,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) { } @@ -73,9 +70,9 @@ 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 -#endif // CGAL_INTERNAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H +#endif // CGAL_INTERNAL_FILTERED_PROJECTION_TRAITS_3_H diff --git a/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h index 0cb5624bc74..d8c230c546c 100644 --- a/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_3.h +++ b/Kernel_23/include/CGAL/Kernel_23/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: diff --git a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h similarity index 96% rename from Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h rename to Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h index 5087c9516ae..6a59047bcec 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h +++ b/Kernel_23/include/CGAL/Kernel_23/internal/Projection_traits_base_3.h @@ -5,17 +5,14 @@ // // $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 -#ifndef CGAL_INTERNAL_TRIANGULATION_2_PROJECTION_TRAITS_BASE_3_H -#define CGAL_INTERNAL_TRIANGULATION_2_PROJECTION_TRAITS_BASE_3_H - -#include - +#ifndef CGAL_INTERNAL_PROJECTION_TRAITS_BASE_3_H +#define CGAL_INTERNAL_PROJECTION_TRAITS_BASE_3_H #include #include @@ -379,9 +376,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; @@ -389,7 +386,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; @@ -589,8 +586,8 @@ 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 -#endif // CGAL_INTERNAL_TRIANGULATION_2_PROJECTION_TRAITS_BASE_3_H +#endif // CGAL_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 new file mode 100644 index 00000000000..4deb40f0bce --- /dev/null +++ b/Kernel_23/include/CGAL/Projection_traits_3.h @@ -0,0 +1,47 @@ +// Copyright (c) 2009 GeometryFactory (France) +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org). +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial +// +// +// Author(s) : Laurent Rineau + + +#ifndef CGAL_PROJECTION_TRAITS_3_H +#define CGAL_PROJECTION_TRAITS_3_H + +#include + +namespace CGAL { + +// This declaration is needed to break the cyclic dependency. +template < class Filtered_kernel > +class Filtered_projection_traits_3; + +template +class Projection_traits_3 + : public Projection_traits_base_3 +{ +public: + explicit Projection_traits_3(const typename Kernel::Vector_3& n_) + : Projection_traits_base_3(n_) + {} +}; + +template +class Projection_traits_3 + : public Filtered_projection_traits_3 +{ +public: + explicit Projection_traits_3(const typename Kernel::Vector_3& n_) + : Filtered_projection_traits_3(n_) + {} +}; + +} // namespace CGAL + +#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 459c745f1b9..d3d334865de 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 cbc75458f95..9725e3d5960 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..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 @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include #include @@ -210,8 +210,8 @@ 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 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 77b5404b298..7e7bfd600a1 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 @@ -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 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 4f1e2b7fac8..a28b3e2c826 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 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; 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 0595dc7956b..27ec846f35c 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 417fcd94899..c80ceb08aca 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 a1c278c5a0b..6ad2276174e 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 +`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/examples/Triangulation_2/triangulation_projection_traits.cpp b/Triangulation_2/examples/Triangulation_2/triangulation_projection_traits.cpp new file mode 100644 index 00000000000..73662c0eba7 --- /dev/null +++ b/Triangulation_2/examples/Triangulation_2/triangulation_projection_traits.cpp @@ -0,0 +1,39 @@ +#include +#include +#include + +#include +#include + +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 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); + + 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(CDT::Face_handle f : cdt.all_face_handles()) + { + for(int i=0; i<3; ++i) + std::cout << f->vertex(i)->point() << " "; + std::cout << std::endl; + } +} 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 de475d6f44c..683c6d42153 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h +++ b/Triangulation_2/include/CGAL/Triangulation_2_projection_traits_3.h @@ -10,43 +10,46 @@ // // 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 { -// 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 +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_) + explicit Triangulation_2_projection_traits_3(const typename Kernel::Vector_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_) + 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/CMakeLists.txt b/Triangulation_2/test/Triangulation_2/CMakeLists.txt index 392f79e71b6..54c09717f8f 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_cdt_2_projection_traits_special_case.cpp b/Triangulation_2/test/Triangulation_2/test_cdt_2_projection_traits_special_case.cpp index bf163771380..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 @@ -1,13 +1,15 @@ #include #include + #include -#include +#include + +#include #include #include #include - typedef const double vec[3]; const vec input[10] = { { -0.37503900000000001, 0.5, 0.47710999999999998 }, @@ -128,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; } 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..84a8465162d --- /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 K; +typedef CGAL::Triangulation_2_projection_traits_3 GT; + +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); + + 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]); +}