Merge pull request #5407 from maxGimeno/T2-Document_projection_traits_3-maxGimeno

Triangulation_2 : Document the `Triangulation_2_projection_traits_3` class
This commit is contained in:
Sebastien Loriot 2021-08-31 19:01:33 +02:00 committed by GitHub
commit 6e4f55e1e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 263 additions and 90 deletions

View File

@ -1,4 +1,5 @@
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
#include <fstream>
#include <iostream>
#include <CGAL/Surface_mesh.h>

View File

@ -15,7 +15,7 @@
#include <CGAL/license/GraphicsView.h>
#include <CGAL/Triangulation_2_projection_traits_3.h>
#include <CGAL/Projection_traits_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <CGAL/Triangulation_face_base_with_info_2.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
@ -887,7 +887,7 @@ protected:
bool is_process;
};
typedef CGAL::Triangulation_2_projection_traits_3<CGAL::Exact_predicates_inexact_constructions_kernel> P_traits;
typedef CGAL::Projection_traits_3<CGAL::Exact_predicates_inexact_constructions_kernel> P_traits;
typedef CGAL::Triangulation_vertex_base_with_info_2<Vertex_info, P_traits> Vb;
typedef CGAL::Triangulation_face_base_with_info_2<Face_info, P_traits> Fb1;
typedef CGAL::Constrained_triangulation_face_base_2<P_traits, Fb1> Fb;

View File

@ -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,

View File

@ -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 K>
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

View File

@ -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 {

View File

@ -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,

View File

@ -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}

View File

@ -71,6 +71,7 @@
- `CGAL::Simple_cartesian<FieldNumberType>`
- `CGAL::Simple_homogeneous<RingNumberType>`
- `CGAL::Projection_traits_xy_3<K>`
- `CGAL::Projection_traits_3<K>`
\cgalCRPSection{Predefined Kernels}

View File

@ -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
*/

View File

@ -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 <CGAL/license/Triangulation_2.h>
#include <CGAL/Triangulation_2/internal/Triangulation_2_projection_traits_base_3.h>
#include <CGAL/Kernel_23/internal/Projection_traits_base_3.h>
#include <CGAL/Filtered_predicate_with_state.h>
namespace CGAL {
template < class Filtered_kernel >
class Triangulation_2_filtered_projection_traits_3
: public Triangulation_2_projection_traits_base_3<Filtered_kernel>
class Filtered_projection_traits_3
: public Projection_traits_base_3<Filtered_kernel>
{
typedef Filtered_kernel K;
typedef Triangulation_2_filtered_projection_traits_3<K> Self;
typedef Triangulation_2_projection_traits_base_3<K> Base;
typedef Filtered_projection_traits_3<K> Self;
typedef Projection_traits_base_3<K> 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_kernel> Exact_traits;
typedef Triangulation_2_projection_traits_base_3<Approximate_kernel> Filtering_traits;
typedef Projection_traits_base_3<Exact_kernel> Exact_traits;
typedef Projection_traits_base_3<Approximate_kernel> 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<Filtered_kernel>
}; // end class Projection_traits_base_3<Filtered_kernel>
} // end namespace CGAL
#endif // CGAL_INTERNAL_TRIANGULATION_2_FILTERED_PROJECTION_TRAITS_3_H
#endif // CGAL_INTERNAL_FILTERED_PROJECTION_TRAITS_3_H

View File

@ -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<K> (not in `internal`)
template < class R, int dim >
class Projection_traits_3 {
public:

View File

@ -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 <CGAL/license/Triangulation_2.h>
#ifndef CGAL_INTERNAL_PROJECTION_TRAITS_BASE_3_H
#define CGAL_INTERNAL_PROJECTION_TRAITS_BASE_3_H
#include <CGAL/Profile_timer.h>
#include <CGAL/intersections.h>
@ -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<Kernel> Self;
typedef Projection_traits_base_3<Kernel> 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<Kernel>
}; // end class Projection_traits_base_3<Kernel>
} // end namespace CGAL
#endif // CGAL_INTERNAL_TRIANGULATION_2_PROJECTION_TRAITS_BASE_3_H
#endif // CGAL_INTERNAL_PROJECTION_TRAITS_BASE_3_H

View File

@ -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 <CGAL/Kernel_23/internal/Filtered_projection_traits_3.h>
namespace CGAL {
// This declaration is needed to break the cyclic dependency.
template < class Filtered_kernel >
class Filtered_projection_traits_3;
template <class Kernel, bool Has_filtered_predicates=Kernel::Has_filtered_predicates>
class Projection_traits_3
: public Projection_traits_base_3<Kernel>
{
public:
explicit Projection_traits_3(const typename Kernel::Vector_3& n_)
: Projection_traits_base_3<Kernel>(n_)
{}
};
template <class Kernel>
class Projection_traits_3<Kernel, true>
: public Filtered_projection_traits_3<Kernel>
{
public:
explicit Projection_traits_3(const typename Kernel::Vector_3& n_)
: Filtered_projection_traits_3<Kernel>(n_)
{}
};
} // namespace CGAL
#endif // CGAL_PROJECTION_TRAITS_3_H

View File

@ -14,7 +14,7 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Triangulation_2_projection_traits_3.h>
#include <CGAL/Projection_traits_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <CGAL/Triangulation_face_base_with_info_2.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
@ -178,7 +178,7 @@ struct Face_info {
bool is_process;
};
typedef CGAL::Triangulation_2_projection_traits_3<CGAL::Exact_predicates_inexact_constructions_kernel> P_traits;
typedef CGAL::Projection_traits_3<CGAL::Exact_predicates_inexact_constructions_kernel> P_traits;
typedef CGAL::Triangulation_vertex_base_with_info_2<Vertex_info, P_traits> Vb;
typedef CGAL::Triangulation_face_base_with_info_2<Face_info,P_traits> Fb1;

View File

@ -22,7 +22,7 @@
#include <QGLBuffer>
#include <QOpenGLShaderProgram>
#include <CGAL/Triangulation_2_projection_traits_3.h>
#include <CGAL/Projection_traits_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <CGAL/Triangulation_face_base_with_info_2.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
@ -211,7 +211,7 @@ class Basic_viewer : public CGAL::QGLViewer, public QOpenGLFunctions
bool is_process;
};
typedef CGAL::Triangulation_2_projection_traits_3<CGAL::Exact_predicates_inexact_constructions_kernel> P_traits;
typedef CGAL::Projection_traits_3<CGAL::Exact_predicates_inexact_constructions_kernel> P_traits;
typedef CGAL::Triangulation_vertex_base_with_info_2<Vertex_info, P_traits> Vb;
typedef CGAL::Triangulation_face_base_with_info_2<Face_info, P_traits> Fb1;

View File

@ -3,12 +3,12 @@
#include <CGAL/Delaunay_mesher_2.h>
#include <CGAL/Delaunay_mesh_face_base_2.h>
#include <CGAL/Delaunay_mesh_size_criteria_2.h>
#include <CGAL/Triangulation_2_projection_traits_3.h>
#include <CGAL/Projection_traits_3.h>
#include <iostream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K1;
typedef CGAL::Triangulation_2_projection_traits_3<K1> K;
typedef CGAL::Projection_traits_3<K1> K;
typedef CGAL::Triangulation_vertex_base_2<K> Vb;
typedef CGAL::Delaunay_mesh_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> Tds;

View File

@ -22,7 +22,7 @@
#include <CGAL/Cartesian_converter.h>
#include <boost/unordered_map.hpp>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_2_projection_traits_3.h>
#include <CGAL/Projection_traits_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <CGAL/Triangulation_face_base_with_info_2.h>
#include <CGAL/Kernel/global_functions_3.h>
@ -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<Kernel> P_traits;
typedef typename Nef_polyhedron::Kernel Kernel;
typedef Projection_traits_3<Kernel> P_traits;
typedef Triangulation_vertex_base_with_info_2<std::size_t, P_traits> Vb;
typedef Triangulation_face_base_with_info_2<FaceInfo2,P_traits> Fbb;
typedef Constrained_triangulation_face_base_2<P_traits,Fbb> Fb;

View File

@ -23,7 +23,7 @@
#include <CGAL/Default.h>
#include <CGAL/boost/graph/Euler_operations.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_2_projection_traits_3.h>
#include <CGAL/Projection_traits_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <boost/container/flat_map.hpp>
@ -387,9 +387,9 @@ private:
typedef Non_manifold_feature_map<TriangleMesh> NM_features_map;
// typedef for the CDT
typedef Intersection_nodes<TriangleMesh, VertexPointMap1, VertexPointMap2,
Predicates_on_constructions_needed> INodes;
Predicates_on_constructions_needed> INodes;
typedef typename INodes::Exact_kernel EK;
typedef Triangulation_2_projection_traits_3<EK> CDT_traits;
typedef Projection_traits_3<EK> CDT_traits;
typedef Triangulation_vertex_base_with_info_2<Node_id,CDT_traits> Vb;
typedef Constrained_triangulation_face_base_2<CDT_traits> Fb;
typedef Triangulation_data_structure_2<Vb,Fb> TDS_2;

View File

@ -28,7 +28,7 @@
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <CGAL/Triangulation_face_base_with_info_2.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_2_projection_traits_3.h>
#include <CGAL/Projection_traits_3.h>
#include <queue>
#endif
@ -1374,7 +1374,7 @@ triangulate_hole_polyline_with_cdt(const PointRange& points,
}
// Checking the hole simplicity.
typedef Triangulation_2_projection_traits_3<Traits> P_traits;
typedef CGAL::Projection_traits_3<Traits> 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;

View File

@ -24,7 +24,7 @@
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <CGAL/Triangulation_face_base_with_info_2.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_2_projection_traits_3.h>
#include <CGAL/Projection_traits_3.h>
#else
#include <CGAL/use.h>
#endif
@ -152,7 +152,7 @@ public:
#ifndef CGAL_TRIANGULATE_FACES_DO_NOT_USE_CDT2
if (use_cdt)
{
typedef CGAL::Triangulation_2_projection_traits_3<Traits> P_traits;
typedef CGAL::Projection_traits_3<Traits> P_traits;
typedef CGAL::Triangulation_vertex_base_with_info_2<halfedge_descriptor,
P_traits> Vb;
typedef CGAL::Triangulation_face_base_with_info_2<Face_info,

View File

@ -154,7 +154,7 @@ struct lcc_priv{
bool is_process;
};
typedef CGAL::Triangulation_2_projection_traits_3<CGAL::Exact_predicates_inexact_constructions_kernel> P_traits;
typedef CGAL::Projection_traits_3<CGAL::Exact_predicates_inexact_constructions_kernel> P_traits;
typedef CGAL::Triangulation_vertex_base_with_info_2<Vertex_info, P_traits> Vb;
typedef CGAL::Triangulation_face_base_with_info_2<Face_info, P_traits> Fb1;
typedef CGAL::Constrained_triangulation_face_base_2<P_traits, Fb1> Fb;

View File

@ -18,7 +18,7 @@
#include <CGAL/minkowski_sum_3.h>
#include <CGAL/convex_decomposition_3.h>
#include <CGAL/Triangulation_2_projection_traits_3.h>
#include <CGAL/Projection_traits_3.h>
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <CGAL/Triangulation_face_base_with_info_2.h>
#include <CGAL/boost/graph/convert_nef_polyhedron_to_polygon_mesh.h>
@ -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<Traits> P_traits;
typedef CGAL::Projection_traits_3<Traits> P_traits;
typedef Nef_polyhedron::Halfedge_const_handle Halfedge_handle;
struct Face_info {
Nef_polyhedron::Halfedge_const_handle e[3];

View File

@ -3,7 +3,7 @@
#include <CGAL/Triangulation_vertex_base_with_info_2.h>
#include <CGAL/Triangulation_face_base_with_info_2.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_2_projection_traits_3.h>
#include <CGAL/Projection_traits_3.h>
#include <CGAL/Three/Scene_item.h>
#include <queue>
@ -20,7 +20,7 @@ class FacetTriangulator
typedef typename Kernel::Vector_3 Vector;
typedef CGAL::Triangulation_2_projection_traits_3<Traits> P_traits;
typedef CGAL::Projection_traits_3<Traits> P_traits;
typedef CGAL::Triangulation_vertex_base_with_info_2<halfedge_descriptor,
P_traits> Vb;

View File

@ -487,7 +487,9 @@ See Section \ref Section_2D_Triangulations_Delaunay for an example.
`Projection_traits_xz_3<R>` to
deal with projections on the
`yz` plane and `xz`-plane,
respectively.
respectively, as well as the geometric traits class
`Projection_traits_3<R>` that deals with projections onto an
arbitrary plane defined by its orthogonal vector.
\subsection Subsection_2D_Triangulations_Basic_Example Example of a Basic Triangulation

View File

@ -0,0 +1,39 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Projection_traits_3.h>
#include <iostream>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Projection_traits_3<K> GT;
typedef CGAL::Exact_predicates_tag Itag;
typedef CGAL::Constrained_Delaunay_triangulation_2<GT, CGAL::Default, Itag> CDT;
typedef CDT::Point Point;
typedef CDT::Edge Edge;
int main()
{
//4 points on the diagonal plane of a cube
std::vector<Point> 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;
}
}

View File

@ -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 <CGAL/license/Triangulation_2.h>
#define CGAL_DEPRECATED_HEADER "<CGAL/Triangulation_2_projection_traits_3.h>"
#define CGAL_REPLACEMENT_HEADER "<CGAL/Projection_traits_3.h>"
#include <CGAL/Installation/internal/deprecation_warning.h>
#include <CGAL/Triangulation_2/internal/Triangulation_2_filtered_projection_traits_3.h>
#ifndef CGAL_NO_DEPRECATED_CODE
namespace CGAL{
#include <CGAL/Kernel_23/internal/Filtered_projection_traits_3.h>
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 Kernel, bool Has_filtered_predicates=Kernel::Has_filtered_predicates>
template <class Kernel, bool Has_filtered_predicates = Kernel::Has_filtered_predicates>
class Triangulation_2_projection_traits_3
: public Triangulation_2_projection_traits_base_3<Kernel>
: public Projection_traits_base_3<Kernel>
{
public:
explicit
Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_)
: Triangulation_2_projection_traits_base_3<Kernel>(n_)
explicit Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_)
: Projection_traits_base_3<Kernel>(n_)
{}
};
template <class Kernel>
class Triangulation_2_projection_traits_3<Kernel, true>
: public Triangulation_2_filtered_projection_traits_3<Kernel>
: public Filtered_projection_traits_3<Kernel>
{
public:
explicit
Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_)
: Triangulation_2_filtered_projection_traits_3<Kernel>(n_)
explicit Triangulation_2_projection_traits_3(const typename Kernel::Vector_3& n_)
: Filtered_projection_traits_3<Kernel>(n_)
{}
};
} // end namespace CGAL
#endif //CGAL_NO_DEPRECATED_CODE
#endif // CGAL_TRIANGULATION_2_PROJECTION_TRAITS_3_H

View File

@ -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()

View File

@ -1,13 +1,15 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_2_projection_traits_3.h>
#include <CGAL/Projection_traits_3.h>
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
#include <CGAL/Triangulation_2_projection_traits_3.h>
#include <string>
#include <fstream>
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<CGAL::Epick,
CGAL::Triangulation_2_projection_traits_3<Epick> >
("CDT_2 in a 3D plane, with Epick");
ok = ok &&
test<CGAL::Epeck,
CGAL::Triangulation_2_projection_traits_3<Epeck> >
("CDT_2 in a 3D plane, with Epeck");
ok = ok && test_segment_intersections<CGAL::Epick,
CGAL::Triangulation_2_projection_traits_3<Epick> >
("CDT_2 traits intersection with Epick");
ok = ok && test_segment_intersections<CGAL::Epeck,
CGAL::Triangulation_2_projection_traits_3<Epeck> >
("CDT_2 traits intersection with Epeck");
ok = ok && test<CGAL::Epick, CGAL::Projection_traits_3<Epick> >("CDT_2 in a 3D plane, with Epick");
ok = ok && test<CGAL::Epeck, CGAL::Projection_traits_3<Epeck> >("CDT_2 in a 3D plane, with Epeck");
ok = ok && test_segment_intersections<CGAL::Epick, CGAL::Triangulation_2_projection_traits_3<Epick> >("CDT_2 traits intersection with Epick");
ok = ok && test_segment_intersections<CGAL::Epeck, CGAL::Triangulation_2_projection_traits_3<Epeck> >("CDT_2 traits intersection with Epeck");
return ok ? 0 : 1;
}

View File

@ -0,0 +1,34 @@
#include <CGAL/Installation/internal/disable_deprecation_warnings_and_errors.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_2_projection_traits_3.h>
#include <iostream>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_2_projection_traits_3<K> GT;
typedef CGAL::Exact_predicates_tag Itag;
typedef CGAL::Constrained_Delaunay_triangulation_2<GT, CGAL::Default, Itag> CDT;
typedef CDT::Point Point;
typedef CDT::Edge Edge;
int main()
{
//4 points on the diagonal plane of a cube
std::vector<Point> 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]);
}