Merge branch 'master' into PMP-Add_split_to_clip-GF

This commit is contained in:
Mael 2020-03-17 19:47:28 +01:00 committed by GitHub
commit 8ee3ec8f7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
280 changed files with 28342 additions and 4253 deletions

View File

@ -5,11 +5,17 @@
DO_IGNORE=FALSE
cd $1
if [ ! -f "$2/package_info/$2/dependencies" ];then
if [ ! -d "$2" ]; then
echo "$2 : MISSING PACKAGE. Ignoring."
DO_IGNORE=TRUE
exit 1
fi
if [ ! -f "$2/package_info/$2/dependencies" ];then
echo "No dependencies found for $2"
bash Scripts/developer_scripts/cgal_check_dependencies.sh --check_headers /usr/bin/doxygen
bash Scripts/developer_scripts/cgal_check_dependencies.sh --check_headers /usr/bin/doxygen
exit 1
fi
LIST_OF_FILES=$(git diff --name-only origin/master... |cut -d/ -f1 |uniq |sort)

View File

@ -369,9 +369,9 @@ concept. The second template parameter is a tag that indicates what
operations are allowed in the computations that take place within the
traits class.
The two possible values of the `Method_tag` parameter are
`Ring_tag` and `Sqrt_field_tag`. When
`Ring_tag` is used, only ring operations are used during the
evaluation of the predicates, whereas if `Sqrt_field_tag` is
`Integral_domain_without_division_tag` and `Field_with_sqrt_tag`. When
`Integral_domain_without_division_tag` is used, only ring operations are used during the
evaluation of the predicates, whereas if `Field_with_sqrt_tag` is
chosen, all four field operations, as well as square roots, are used
during the predicate evaluation.
@ -379,32 +379,22 @@ The `Apollonius_graph_traits_2<K,Method_tag>` class provides exact
predicates if the number type in the kernel `K` is an exact number
type. This is to be associated with the type of operations allowed for
the predicate evaluation. For example `MP_Float` as number
type, with `Ring_tag` as tag will give exact predicates,
whereas `MP_Float` with `Sqrt_field_tag` will give
type, with `Integral_domain_without_division_tag` as tag will give exact predicates,
whereas `MP_Float` with `Field_with_sqrt_tag` will give
inexact predicates.
Since using an exact number type may be too slow, the
`Apollonius_graph_traits_2<K,Method_tag>` class is designed to
support the dynamic filtering of \cgal through the
`Filtered_exact<CT,ET>` mechanism. In particular if `CT`
is an inexact number type that supports the operations denoted by the
tag `Method_tag` and `ET` is an exact number type for these
operations, then kernel with number type
`Filtered_exact<CT,ET>` will yield exact predicates for the
Apollonius graph traits. To give a concrete example,
`CGAL::Filtered_exact<double,CGAL::MP_Float>` with
`Ring_tag` will produce exact predicates.
Another possibility for fast and exact predicate evaluation is to use
the
`Apollonius_graph_filtered_traits_2<CK,CM,EK,EM,FK,FM>`
class. This class is the analog of a filtered kernel. It takes a
Although exact number types provide exact predicates and constructions,
their use often results in unacceptably large runtimes.
The class `Apollonius_graph_filtered_traits_2<CK,CM,EK,EM,FK,FM>`
aims to paliate this shortcoming. Similar to a filtered kernel, it takes a
constructions kernel `CK`, a filtering kernel `FK` and an
exact kernel `EK`, as well as the corresponding tags
(`CM`, `FM` and `EM`, respectively).
It evaluates the predicates by first using the filtering kernel, and
if this fails the evaluation is performed using the exact kernel. The
constructions are done using the kernel `CK`, which means that
Predicates are evaluated by first using the filtering kernel, and
if this fails the evaluation is performed using the exact kernel,
thus yielding exact predicates at a generally much cheaper cost
than directly using an exact number type. The constructions
are done using the kernel `CK`, which means that
they are not necessarily exact. All template parameters except
`CK` have default values, which are explained in the reference
manual.

View File

@ -20,8 +20,8 @@ This class has six template parameters. The first, third and fifth
template parameters must be a models of the `Kernel` concept. The
second, fourth and sixth template parameters correspond to how
predicates are evaluated. There are two predefined possible values for
`Method_tag`, namely `CGAL::Sqrt_field_tag` and
`CGAL::Ring_tag`. The first one must be used when the number type
`Method_tag`, namely `CGAL::Field_with_sqrt_tag` and
`CGAL::Integral_domain_without_division_tag`. The first one must be used when the number type
used in the representation supports the exact evaluation of signs of
expressions involving all four basic operations and square roots,
whereas the second one requires the exact evaluation of signs of
@ -31,7 +31,7 @@ The way the predicates are evaluated is discussed in
\cgalCite{cgal:ke-ppawv-02}, \cgalCite{cgal:ke-rctac-03}.
The default values for the template parameters are as follows:
`CM = CGAL::Ring_tag`,
`CM = CGAL::Integral_domain_without_division_tag`,
`EK = CGAL::Simple_cartesian<CGAL::MP_Float>`,
`EM = CM`,
`FK = CGAL::Simple_cartesian<CGAL::Interval_nt<false> >`,
@ -41,8 +41,8 @@ The default values for the template parameters are as follows:
\sa `Kernel`
\sa `ApolloniusGraphTraits_2`
\sa `CGAL::Ring_tag`
\sa `CGAL::Sqrt_field_tag`
\sa `CGAL::Integral_domain_without_division_tag`
\sa `CGAL::Field_with_sqrt_tag`
\sa `CGAL::Apollonius_graph_2<Gt,Agds>`
\sa `CGAL::Apollonius_graph_traits_2<K,Method_tag>`

View File

@ -10,13 +10,13 @@ This class has two template parameters. The first template parameter
must be a model of the `Kernel` concept. The second template
parameter corresponds to how predicates are evaluated. There are two
predefined possible values for `Method_tag`, namely
`CGAL::Sqrt_field_tag` and `CGAL::Ring_tag`. The first one
`CGAL::Field_with_sqrt_tag` and `CGAL::Integral_domain_without_division_tag`. The first one
must be used when the number type used in the representation supports
the exact evaluation of signs of expressions involving all four basic
operations and square roots, whereas the second one requires the exact
evaluation of signs of ring-type expressions, i.e., expressions
involving only additions, subtractions and multiplications. The
default value for `Method_tag` is `CGAL::Ring_tag`.
default value for `Method_tag` is `CGAL::Integral_domain_without_division_tag`.
The way the predicates are evaluated is discussed in
\cgalCite{cgal:ke-ppawv-02}, \cgalCite{cgal:ke-rctac-03}.
@ -24,8 +24,8 @@ The way the predicates are evaluated is discussed in
\sa `Kernel`
\sa `ApolloniusGraphTraits_2`
\sa `CGAL::Ring_tag`
\sa `CGAL::Sqrt_field_tag`
\sa `CGAL::Integral_domain_without_division_tag`
\sa `CGAL::Field_with_sqrt_tag`
\sa `CGAL::Apollonius_graph_2<Gt,Agds>`
\sa `CGAL::Apollonius_graph_filtered_traits_2<CK,CM,EK,EM,FK,FM>`

View File

@ -5,5 +5,6 @@ Algebraic_foundations
Circulator
Stream_support
Voronoi_diagram_2
Number_types
TDS_2
Triangulation_2

View File

@ -1,38 +0,0 @@
// Copyright (c) 2003,2004 INRIA Sophia-Antipolis (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) : Menelaos Karavelas <mkaravel@iacm.forth.gr>
#ifndef CGAL_CHECK_FILTER_H
#define CGAL_CHECK_FILTER_H
#include <CGAL/license/Apollonius_graph_2.h>
#undef CGAL_IA_NEW_FILTERS
namespace CGAL {
template < class T>
void must_be_filtered(const T&)
{}
#if defined CGAL_ARITHMETIC_FILTER_H
template < class CT, class ET, class Type, bool Protection, class Cache>
void must_be_filtered(const Filtered_exact<CT, ET, Type, Protection,
Cache> &)
{ dont_compile(CT(), ET()); }
#endif
}
#endif

View File

@ -3,76 +3,31 @@
#include <fstream>
#include <cassert>
#define DONT_USE_FILTERED_EXACT
// choose number type
#include <CGAL/MP_Float.h>
#ifndef DONT_USE_FILTERED_EXACT
# include <CGAL/Filtered_exact.h>
#endif
typedef double inexact_type;
typedef CGAL::MP_Float exact_type;
#ifndef DONT_USE_FILTERED_EXACT
typedef CGAL::Filtered_exact<inexact_type,exact_type> number_t;
#endif
#include <CGAL/Simple_cartesian.h>
#ifndef DONT_USE_FILTERED_EXACT
typedef CGAL::Simple_cartesian<number_t> Kernel;
#endif
typedef CGAL::Integral_domain_without_division_tag Method_tag;
#include "./include/test.h"
typedef CGAL::Simple_cartesian<inexact_type> CK;
typedef CGAL::Simple_cartesian<exact_type> EK;
int main()
{
#ifndef DONT_USE_FILTERED_EXACT
{
std::ifstream ifs_algo("./data/algo.dat");
std::ifstream ifs_algo("./data/algo.dat");
assert( ifs_algo );
assert( ifs_algo );
std::cout << "testing the Apollonius graph class..." << std::flush;
bool algo_ok =
CGAL::test_algo<Kernel,Method_tag,std::ifstream>(ifs_algo);
assert( algo_ok );
std::cout << " done!" << std::endl;
ifs_algo.close();
std::cout << std::endl;
}
#endif
//------------------------------------------------------------------------
{
std::ifstream ifs_algo("./data/algo.dat");
assert( ifs_algo );
std::cout << "testing the Apollonius graph class"
<< " with filtered traits..." << std::flush;
bool algo_ok =
CGAL::test_filtered_traits_algo<CK,Method_tag,EK,Method_tag,
std::ifstream>(ifs_algo);
assert( algo_ok );
std::cout << " done!" << std::endl;
ifs_algo.close();
std::cout << std::endl;
}
std::cout << "testing the Apollonius graph class" << " with filtered traits..." << std::flush;
bool algo_ok = CGAL::test_filtered_traits_algo<CK,Method_tag,EK,Method_tag,std::ifstream>(ifs_algo);
assert( algo_ok );
std::cout << " done!" << std::endl;
return 0;
}

View File

@ -3,79 +3,31 @@
#include <fstream>
#include <cassert>
#define DNOT_USE_FILTERED_EXACT
// choose number type
#include <CGAL/MP_Float.h>
#ifndef DNOT_USE_FILTERED_EXACT
# include <CGAL/Filtered_exact.h>
#endif
typedef double inexact_type;
typedef CGAL::MP_Float exact_type;
#ifndef DNOT_USE_FILTERED_EXACT
typedef CGAL::Filtered_exact<inexact_type,exact_type> number_t;
#endif
#include <CGAL/Simple_cartesian.h>
#ifndef DNOT_USE_FILTERED_EXACT
typedef CGAL::Simple_cartesian<number_t> K;
#endif
typedef CGAL::Integral_domain_without_division_tag Method_tag;
#include "./include/test.h"
typedef CGAL::Simple_cartesian<inexact_type> CK;
typedef CGAL::Simple_cartesian<exact_type> EK;
int main()
{
#ifndef DNOT_USE_FILTERED_EXACT
{
std::ifstream ifs_hierarchy("./data/hierarchy.dat");
std::ifstream ifs_hierarchy("./data/hierarchy.dat");
assert( ifs_hierarchy );
assert( ifs_hierarchy );
std::cout << "testing the Apollonius graph hierarchy class" << " with filtered traits..." << std::flush;
bool hierarchy_ok = CGAL::test_filtered_traits_hierarchy_algo<CK,Method_tag,EK,Method_tag,std::ifstream>(ifs_hierarchy);
std::cout << "testing the Apollonius graph hierarchy class..."
<< std::flush;
bool hierarchy_ok =
CGAL::test_hierarchy_algo<Kernel,Method_tag,
std::ifstream>(ifs_hierarchy);
assert( hierarchy_ok );
std::cout << " done!" << std::endl;
ifs_hierarchy.close();
std::cout << std::endl;
}
#endif
//------------------------------------------------------------------------
{
std::ifstream ifs_hierarchy("./data/hierarchy.dat");
assert( ifs_hierarchy );
std::cout << "testing the Apollonius graph hierarchy class"
<< " with filtered traits..." << std::flush;
bool hierarchy_ok =
CGAL::test_filtered_traits_hierarchy_algo<CK,Method_tag,EK,
Method_tag,std::ifstream>(ifs_hierarchy);
assert( hierarchy_ok );
std::cout << " done!" << std::endl;
ifs_hierarchy.close();
std::cout << std::endl;
}
assert( hierarchy_ok );
std::cout << " done!" << std::endl;
return 0;
}

View File

@ -2,79 +2,33 @@
#include <fstream>
#include <cassert>
#define DONT_USE_FILTERED_EXACT
// choose number type
#include <CGAL/MP_Float.h>
#ifndef DONT_USE_FILTERED_EXACT
# include <CGAL/Filtered_exact.h>
#endif
typedef double inexact_type;
typedef CGAL::MP_Float exact_type;
#ifndef DONT_USE_FILTERED_EXACT
typedef CGAL::Filtered_exact<inexact_type,exact_type> number_t;
#endif
#include <CGAL/Simple_cartesian.h>
#ifndef DONT_USE_FILTERED_EXACT
typedef CGAL::Simple_cartesian<number_t> Kernel;
#endif
typedef CGAL::Integral_domain_without_division_tag Method_tag;
#include "./include/test.h"
typedef CGAL::Simple_cartesian<double> CK;
typedef CGAL::Simple_cartesian<CGAL::MP_Float> EK;
int main()
{
#ifndef DONT_USE_FILTERED_EXACT
{
std::ifstream ifs_traits("./data/traits.dat");
std::ifstream ifs_traits("./data/traits.dat");
assert( ifs_traits );
assert( ifs_traits );
std::cout << "testing the filtered traits class..." << std::flush;
// bool is_ok =
// CGAL::test_traits<Kernel,CGAL::Integral_domain_without_division_tag,std::ifstream>(ifs_traits);
CGAL::Filtered_traits_tester<CK,Method_tag,EK,Method_tag> test_traits;
bool traits_ok = test_traits();
assert( traits_ok );
std::cout << "testing the traits class..." << std::flush;
CGAL::Traits_tester<Kernel,Method_tag> test_traits;
bool traits_ok = test_traits();
assert( traits_ok );
std::cout << " done!" << std::endl;
ifs_traits.close();
std::cout << std::endl;
}
#endif
//------------------------------------------------------------------------
{
std::ifstream ifs_traits("./data/traits.dat");
assert( ifs_traits );
std::cout << "testing the filtered traits class..." << std::flush;
CGAL::Filtered_traits_tester<CK,Method_tag,EK,Method_tag> test_traits;
bool traits_ok = test_traits();
assert( traits_ok );
std::cout << " done!" << std::endl;
ifs_traits.close();
std::cout << std::endl;
}
std::cout << " done!" << std::endl;
return 0;
}

View File

@ -2,7 +2,7 @@
namespace CGAL {
/*!
\ingroup PkgBGLHelper
\ingroup BGLGraphExternalIndices
The class `HalfedgeDS_face_max_base_with_id` is a model of the `HalfedgeDSFace`
concept.

View File

@ -2,7 +2,7 @@
namespace CGAL {
/*!
\ingroup PkgBGLHelper
\ingroup BGLGraphExternalIndices
The class `HalfedgeDS_halfedge_max_base_with_id` is a model of the `HalfedgeDSHalfedge`
concept.

View File

@ -2,7 +2,7 @@
namespace CGAL {
/*!
\ingroup PkgBGLHelper
\ingroup BGLGraphExternalIndices
The class `HalfedgeDS_vertex_max_base_with_id` is a model of the `HalfedgeDSVertex`
concept. It is

View File

@ -2,7 +2,7 @@
namespace CGAL {
/*!
\ingroup PkgBGLHelper
\ingroup BGLGraphExternalIndices
The class `Linear_cell_complex_bgl_min_items` defines `void` as the information associated with darts, darts have ids and 0- and 2-attributes are enabled and have ids.

View File

@ -2,7 +2,7 @@
namespace CGAL {
/*!
\ingroup PkgBGLHelper
\ingroup BGLGraphExternalIndices
The class `Linear_cell_complex_for_bgl_combinatorial_map_helper` defines a `CGAL::Linear_cell_complex_for_combinatorial_map` as inner type, named `type`, having `CGAL::Linear_cell_complex_bgl_min_items` as items class. With this item class, no information are associated with darts, darts have ids and 0- and 2-attributes are enabled and have ids.

View File

@ -2,7 +2,7 @@
namespace CGAL {
/*!
\ingroup PkgBGLHelper
\ingroup BGLGraphExternalIndices
The class `Polyhedron_items_with_id_3` is a model of the `PolyhedronItems_3`
concept. It provides definitions for vertices with points, halfedges,
@ -63,7 +63,7 @@ public:
/*!
\ingroup PkgBGLHelper
\ingroup BGLGraphExternalIndices
Given a `CGAL::Polyhedron_3`,
for each simplex type (vertex, halfedge, facet) associates an index from

View File

@ -1,15 +1,16 @@
namespace CGAL {
/*!
\ingroup PkgBGLHelper
\ingroup BGLGraphExternalIndices
The class `Triangulation_face_base_with_id_2` is a model of the
concept `TriangulationFaceBase_2`, the base face of a
2D-triangulation. It provides an integer field that can be used to
2D-triangulation. It provides an integer field that can be used to
index faces for \sc{Bgl} algorithms.
Note that the user is in charge of setting indices correctly before
running a graph algorithm.
running a graph algorithm, by calling the function
`CGAL::set_triangulation_ids(Triangulation&)`.
\tparam TriangulationTraits_2 is the geometric traits class
and must be a model of `TriangulationTraits_2`.
@ -42,4 +43,19 @@ int& id();
/// @}
}; /* end Triangulation_face_base_with_id_2 */
/// \ingroup BGLGraphExternalIndices
///
/// This function initializes vertex, edge, and face indices of the triangulation `tr` and must
/// be called prior to using `tr` as a BGL graph in an algorithm that requires
/// vertex, halfedge, edge, or face indices.
///
/// \tparam Triangulation a 2D triangulation of \cgal, whose combinatorial data structure
/// has been initialized with the vertex and face classes `Triangulation_vertex_base_with_id_2`
/// and `Triangulation_face_base_with_id_2`.
///
/// \sa the \ref PkgTriangulation2 package
template <typename Triangulation>
void set_triangulation_ids(Triangulation& tr);
} /* end namespace CGAL */

View File

@ -1,7 +1,7 @@
namespace CGAL {
/*!
\ingroup PkgBGLHelper
\ingroup BGLGraphExternalIndices
The class `Triangulation_vertex_base_with_id_2` is a model of the
concept `TriangulationVertexBase_2`, the base vertex of a
@ -9,7 +9,8 @@ concept `TriangulationVertexBase_2`, the base vertex of a
index vertices for \sc{Bgl} algorithms.
Note that the user is in charge of setting indices correctly before
running a graph algorithm.
running a graph algorithm, by calling the function
`CGAL::set_triangulation_ids(Triangulation&)`.
\tparam TriangulationTraits_2 is the geometric traits class
and must be a model of `TriangulationTraits_2`.

View File

@ -1,14 +1,9 @@
/// Boost Namespace
namespace boost {
/// CGAL Namespace
namespace CGAL {
/// \ingroup PkgBGLProperties
/// @{
/// The constant `edge_index` is a property tag which identifies the <i>index</i> property of an edge of a \sc{Bgl}
/// <a href="https://www.boost.org/libs/graph/doc/Graph.html"><code>Graph</code></a>.
/// \cgalModels <a href="https://www.boost.org/libs/graph/doc/PropertyTag.html"><code>PropertyTag</code></a>
enum edge_index_t { edge_index};
/// The constant `vertex_index` is a property tag which identifies the <i>index</i> property of a vertex of a \sc{Bgl}
/// <a href="https://www.boost.org/libs/graph/doc/Graph.html"><code>Graph</code></a>.
/// \cgalModels <a href="https://www.boost.org/libs/graph/doc/PropertyTag.html"><code>PropertyTag</code></a>
@ -20,13 +15,17 @@ enum vertex_index_t { vertex_index };
/// \cgalModels <a href="https://www.boost.org/libs/graph/doc/PropertyTag.html"><code>PropertyTag</code></a>
enum halfedge_index_t { halfedge_index };
/// The constant `edge_index` is a property tag which identifies the <i>index</i> property of an edge of a \sc{Bgl}
/// <a href="https://www.boost.org/libs/graph/doc/Graph.html"><code>Graph</code></a>.
/// \cgalModels <a href="https://www.boost.org/libs/graph/doc/PropertyTag.html"><code>PropertyTag</code></a>
enum edge_index_t { edge_index };
/// The constant `face_index` is a property tag which identifies the <i>index</i> property of a face of a `FaceGraph`.
///
/// This is a property tag introduced by \cgal.
/// \cgalModels <a href="https://www.boost.org/libs/graph/doc/PropertyTag.html"><code>PropertyTag</code></a>
enum face_index_t { face_index };
/// The constant `vertex_point` is a property tag which refers to the geometric embedding property of
/// a vertex of a `HalfedgeGraph`.
///
@ -34,12 +33,22 @@ enum face_index_t { face_index };
/// \cgalModels <a href="https://www.boost.org/libs/graph/doc/PropertyTag.html"><code>PropertyTag</code></a>
enum vertex_point_t { vertex_point };
/// @}
} // namespace boost
namespace CGAL {
/// \ingroup PkgBGLProperties
///
/// \brief graph_has_property is used to indicate if a model of `HalfedgeGraph` or `FaceGraph`
/// has an internal property associated with the given `PropertyTag`.
///
/// It inherits from \link Tag_true `CGAL::Tag_true` \endlink if there is a
/// default internal property map for the corresponding property tag and from
/// \link Tag_false `CGAL::Tag_false` \endlink otherwise.
///
/// \tparam Graph a model of `HalfedgeGraph` or `FaceGraph`
/// \tparam PropertyTag the type of a property tag referring to the property of interest.
///
template<typename Graph, typename PropertyTag>
struct graph_has_property;
/// @{

View File

@ -38,38 +38,51 @@ a \cgal point type as value type. \n
\cgalNPEnd
\cgalNPBegin{vertex_index_map} \anchor BGL_vertex_index_map
is the property map containing the index of each vertex of the input polygon mesh.\n
is the property map associating a unique index to each vertex of a polygon mesh `g`,
between `0` and `num_vertices(g)-1`.
If this parameter is not passed, internal machinery will create and initialize a vertex index
property map, either using the internal property map if it exists or using an external map. The latter
might result in - slightly - worsened performance in case of non-constant complexity for index access.\n
<b>Type:</b> a class model of `ReadablePropertyMap` with
`boost::graph_traits<PolygonMesh>::%vertex_descriptor` as key type and the value type
\code typename boost::property_traits<typename boost::property_map<PolygonMesh, CGAL::vertex_index_t>::type>::value_type \endcode
<b>Default:</b> \code boost::get(CGAL::vertex_index, pmesh)\endcode
<b>Default:</b> an initialized vertex index property map
\cgalNPEnd
\cgalNPBegin{halfedge_index_map} \anchor BGL_halfedge_index_map
is the property map containing the index of each halfedge of the input polygon mesh.\n
is the property map associating a unique index to each halfedge of a polygon mesh,
between `0` and `num_halfedges(g)-1`.
If this parameter is not passed, internal machinery will create and initialize a halfedge index
property map, either using the internal property map if it exists or using an external map. The latter
might result in - slightly - worsened performance in case of non-constant complexity for index access.\n
<b>Type:</b> a class model of `ReadablePropertyMap` with
`boost::graph_traits<PolygonMesh>::%halfedge_descriptor` as key type and the value type:
\code typename boost::property_traits<typename boost::property_map<PolygonMesh, CGAL::halfedge_index_t>::type>::value_type \endcode
<b>Default:</b> \code boost::get(CGAL::halfedge_index, pmesh)\endcode
If this internal property map exists, its values should be initialized.
<b>Default:</b> an initialized halfedge index property map
\cgalNPEnd
\cgalNPBegin{edge_index_map} \anchor BGL_edge_index_map
is the property map containing the index of each edge of the input polygon mesh.\n
is the property map associating a unique index to each edge of a polygon mesh,
between `0` and `num_edges(g)-1`.
If this parameter is not passed, internal machinery will create and initialize a edge index
property map, either using the internal property map if it exists or using an external map. The latter
might result in - slightly - worsened performance in case of non-constant complexity for index access.\n
<b>Type:</b> a class model of `ReadablePropertyMap` with
`boost::graph_traits<PolygonMesh>::%edge_descriptor` as key type and the value type:
\code typename boost::property_traits<typename boost::property_map<PolygonMesh, CGAL::edge_index_t>::type>::value_type \endcode
<b>Default:</b> \code boost::get(CGAL::edge_index, pmesh)\endcode
If this internal property map exists, its values should be initialized.
<b>Default:</b> an initialized edge index property map
\cgalNPEnd
\cgalNPBegin{face_index_map} \anchor BGL_face_index_map
is the property map containing the index of each face of the input polygon mesh.\n
is the property map associating a unique index to each face of a polygon mesh,
between `0` and `num_faces(g)-1`.
If this parameter is not passed, internal machinery will create and initialize a face index
property map, either using the internal property map if it exists or using an external map. The latter
might result in - slightly - worsened performance in case of non-constant complexity for index access.\n
<b>Type:</b> a class model of `ReadablePropertyMap` with
`boost::graph_traits<PolygonMesh>::%face_descriptor` as key type and the value type:
\code typename boost::property_traits<typename boost::property_map<PolygonMesh, CGAL::face_index_t>::type>::value_type \endcode
<b>Default:</b> \code boost::get(CGAL::face_index, pmesh)\endcode
If this internal property map exists, its values should be initialized.
<b>Default:</b> an initialized face index property map
\cgalNPEnd
\cgalNPBegin{edge_is_constrained_map} \anchor BGL_edge_is_constrained_map

View File

@ -443,7 +443,7 @@ the requirement for traversal of all faces in a graph.
/// \defgroup PkgBGLPropertiesDynamic Dynamic Properties
/// \ingroup PkgBGLRef
/// \defgroup PkgBGLHelper Helper Classes
/// \defgroup PkgBGLGraphExternalIndices External Indices
/// \ingroup PkgBGLRef
/// \defgroup PkgBGLHelperFct Helper Functions
@ -473,8 +473,11 @@ The dynamic property tags enable to associate information to simplices of a `Fac
*/
/*!
\addtogroup PkgBGLHelper
Several classes that enable to store ids in vertices/halfedges/faces of a `CGAL::Polyhedron_3`, as well as adapters such as `CGAL::Dual`.
\addtogroup BGLGraphExternalIndices
A number of BGL and \cgal algorithms require the graph to have (initialized) integer-like indices
for its vertices, edges, or faces. However, not all graphs intrinsically offer a natural way
to attach a unique ID to each element. The following classes and functions paliate this
by attaching and initializing external IDs to the elements of the graph.
*/
/*!
@ -574,25 +577,25 @@ Methods to read and write graphs.
- `MutableFaceGraph`
\cgalCRPSection{Properties}
- `boost::vertex_index_t`
- `boost::halfedge_index_t`
- `boost::edge_index_t`
- `boost::face_index_t`
- `boost::vertex_point_t`
- `CGAL::vertex_index_t`
- `CGAL::halfedge_index_t`
- `CGAL::edge_index_t`
- `CGAL::face_index_t`
- `CGAL::vertex_point_t`
\cgalCRPSection{%CGAL Classes Adapted for the Graph API}
Different \cgal types have been adapted as graphs for the \sc{Bgl}. All
A number of \cgal structures have been adapted as graphs for the \sc{Bgl}. All
adapted types are listed here. The pages document which concepts they
model, the properties they support, and any possible caveats that a
user might encounter.
- \link BGLSMGT `boost::graph_traits< CGAL::Surface_mesh<P> >` \endlink
- \link BGLPolyGT `boost::graph_traits< CGAL::Polyhedron_3<T> >` \endlink
- \link BGLLCCGT `boost::graph_traits< CGAL::Linear_cell_complex_for_combinatorial_map<...> >` \endlink
- \link BGLSeam_meshGT `boost::graph_traits< CGAL::Seam_mesh<T> >` \endlink
- \link BGLT2GT `boost::graph_traits< CGAL::Triangulation_2<GT, TDS> >` \endlink
- \link BGLArgtGT `boost::graph_traits< CGAL::Arrangement_2<T,DC> >` \endlink
- \link BGLSMGT `boost::graph_traits<CGAL::Surface_mesh<P> >` \endlink
- \link BGLPolyGT `boost::graph_traits<CGAL::Polyhedron_3<T> >` \endlink
- \link BGLLCCGT `boost::graph_traits<CGAL::Linear_cell_complex_for_combinatorial_map<...> >` \endlink
- \link BGLSeam_meshGT `boost::graph_traits<CGAL::Seam_mesh<T> >` \endlink
- \link BGLT2GT `boost::graph_traits<CGAL::Triangulation_2<GT, TDS> >` \endlink and other 2D triangulations
- \link BGLArgtGT `boost::graph_traits<CGAL::Arrangement_2<T, DC> >` \endlink
- \link BGLOMPAK `boost::graph_traits<OpenMesh::PolyMesh_ArrayKernelT<K> >` \endlink
- \link BGLOMTMAK `boost::graph_traits<OpenMesh::TriMesh_ArrayKernelT<K> >` \endlink
@ -642,6 +645,8 @@ user might encounter.
- `CGAL::clear()`
- `CGAL::copy_face_graph()`
- `CGAL::set_triangulation_ids()`
\cgalCRPSection{Iterators}
- `CGAL::Halfedge_around_source_iterator`
- `CGAL::Halfedge_around_target_iterator`

View File

@ -702,19 +702,35 @@ add_face(const VertexRange& vr, Graph& g)
break;
case 3: // both are new
if (halfedge(v, g) == boost::graph_traits<Graph>::null_halfedge())
{
set_halfedge(v, outer_prev, g);
next_cache.push_back(NextCacheEntry(outer_prev, outer_next));
// try to pick a border halfedge with v as target
halfedge_descriptor hv = halfedge(v, g);
if (hv != boost::graph_traits<Graph>::null_halfedge() && !is_border(hv, g))
{
for(halfedge_descriptor h_around_v : halfedges_around_target(hv, g))
if (is_border(h_around_v, g))
{
hv = h_around_v;
break;
}
if (!is_border(hv, g))
hv = boost::graph_traits<Graph>::null_halfedge();
}
if (hv == boost::graph_traits<Graph>::null_halfedge())
{
set_halfedge(v, outer_prev, g);
next_cache.push_back(NextCacheEntry(outer_prev, outer_next));
}
else
{
border_prev = hv;
border_next = next(border_prev, g);
next_cache.push_back(NextCacheEntry(border_prev, outer_next));
next_cache.push_back(NextCacheEntry(outer_prev, border_next));
}
break;
}
else
{
border_prev = halfedge(v, g);
border_next = next(border_prev, g);
next_cache.push_back(NextCacheEntry(border_prev, outer_next));
next_cache.push_back(NextCacheEntry(outer_prev, border_next));
}
break;
}
// set inner link
@ -1323,7 +1339,7 @@ flip_edge(typename boost::graph_traits<Graph>::halfedge_descriptor h,
template<typename Graph>
bool
does_satisfy_link_condition(typename boost::graph_traits<Graph>::edge_descriptor e,
Graph& g)
const Graph& g)
{
typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
typedef typename boost::graph_traits<Graph>::halfedge_descriptor halfedge_descriptor;
@ -1423,7 +1439,7 @@ does_satisfy_link_condition(typename boost::graph_traits<Graph>::edge_descriptor
template<typename Graph>
bool
satisfies_link_condition(typename boost::graph_traits<Graph>::edge_descriptor e,
Graph& g)
const Graph& g)
{
return does_satisfy_link_condition(e, g);
}

View File

@ -16,23 +16,24 @@
#include <CGAL/boost/graph/properties.h>
#include <CGAL/boost/graph/iterator.h>
#include <CGAL/boost/graph/Named_function_parameters.h>
#include <CGAL/boost/graph/named_params_helper.h>
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/Dynamic_property_map.h>
#include <CGAL/assertions.h>
#include <boost/unordered_set.hpp>
#include <boost/graph/graph_traits.hpp>
#include <CGAL/boost/iterator/transform_iterator.hpp>
#include <boost/iterator/filter_iterator.hpp>
#include <CGAL/Default.h>
#include <CGAL/Dynamic_property_map.h>
#include <boost/dynamic_bitset.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/iterator/filter_iterator.hpp>
#include <boost/range/has_range_iterator.hpp>
#include <boost/unordered_set.hpp>
#ifdef DOXYGEN_RUNNING
#define CGAL_BGL_NP_TEMPLATE_PARAMETERS NamedParameters
#define CGAL_BGL_NP_CLASS NamedParameters
#endif
namespace CGAL
{
namespace CGAL {
/*!
* \ingroup PkgBGLAdaptors
@ -62,18 +63,18 @@ namespace CGAL
* missing if the default is fine.
*
* \tparam Graph must be a model of a `FaceListGraph`, `HalfedgeListGraph`, and \bgllink{VertexListGraph}.
* \tparam FIMap a model of `ReadablePropertyMap` with `face_descriptor` as key and `graph_traits<Graph>::%faces_size_type` as value
* \tparam VIMap a model of `ReadablePropertyMap` with `vertex_descriptor` as key and `graph_traits<Graph>::%vertices_size_type` as value
* \tparam HIMap a model of `ReadablePropertyMap` with `halfedge_descriptor` as key and `graph_traits<Graph>::%halfedges_size_type` as value
* \tparam FIMap a model of `ReadablePropertyMap` with `graph_traits<Graph>::%face_descriptor` as key and `graph_traits<Graph>::%faces_size_type` as value
* \tparam VIMap a model of `ReadablePropertyMap` with `graph_traits<Graph>::%vertex_descriptor` as key and `graph_traits<Graph>::%vertices_size_type` as value
* \tparam HIMap a model of `ReadablePropertyMap` with `graph_traits<Graph>::%halfedge_descriptor` as key and `graph_traits<Graph>::%halfedges_size_type` as value
*
* \cgalModels `FaceListGraph`
* \cgalModels `HalfedgeListGraph`
* \cgalModels \bgllink{VertexListGraph}
*/
template<typename Graph,
typename FIMap = typename boost::property_map<Graph, CGAL::face_index_t>::type,
typename VIMap = typename boost::property_map<Graph, boost::vertex_index_t>::type,
typename HIMap = typename boost::property_map<Graph, CGAL::halfedge_index_t>::type>
typename FIMap = Default,
typename VIMap = Default,
typename HIMap = Default>
struct Face_filtered_graph
{
typedef boost::graph_traits<Graph> gt;
@ -93,10 +94,15 @@ struct Face_filtered_graph
#endif
// non documented types
typedef typename boost::property_traits< FIMap >::value_type face_index_type;
typedef typename boost::property_traits< VIMap >::value_type vertex_index_type;
typedef typename boost::property_traits< HIMap >::value_type halfedge_index_type;
typedef Face_filtered_graph<Graph, FIMap, VIMap, HIMap> Self;
typedef typename Default::Get<FIMap, typename CGAL::GetInitializedFaceIndexMap<Graph>::const_type>::type FIM;
typedef typename Default::Get<VIMap, typename CGAL::GetInitializedVertexIndexMap<Graph>::const_type>::type VIM;
typedef typename Default::Get<HIMap, typename CGAL::GetInitializedHalfedgeIndexMap<Graph>::const_type>::type HIM;
typedef typename boost::property_traits<FIM>::value_type face_index_type;
typedef typename boost::property_traits<VIM>::value_type vertex_index_type;
typedef typename boost::property_traits<HIM>::value_type halfedge_index_type;
typedef Face_filtered_graph<Graph, FIMap, VIMap, HIMap> Self;
/*!
* \brief Constructor where the set of selected faces is specified as a range of patch ids.
@ -115,31 +121,31 @@ struct Face_filtered_graph
*
* \cgalNamedParamsBegin
* \cgalParamBegin{face_index_map}
* a property map containing an index for each face initialized from 0 to `num_vertices(graph)`
* a property map containing for each face of `graph` a unique index between `0` and `num_faces(graph)-1`
* \cgalParamEnd
* \cgalParamBegin{vertex_index_map}
* a property map containing an index for each vertex initialized 0 to `num_vertices(graph)`
* a property map containing for each vertex of `graph` a unique index between `0` and `num_vertices(graph)-1`
* \cgalParamEnd
* \cgalParamBegin{halfedge_index_map}
* a property map containing an index for each halfedge initialized 0 to `num_halfedges(graph)`
* a property map containing for each halfedge of `graph` a unique index between `0` and `num_halfedges(graph)-1`
* \cgalParamEnd
* \cgalNamedParamsEnd
*/
template <typename FacePatchIndexMap, class FacePatchIndexRange, class CGAL_BGL_NP_TEMPLATE_PARAMETERS>
Face_filtered_graph(const Graph& graph,
const FacePatchIndexRange& selected_face_patch_indices,
FacePatchIndexMap face_patch_index_map,
const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING
, typename boost::enable_if<
typename boost::has_range_const_iterator<FacePatchIndexRange>::type
>::type* = 0
#endif
)
: _graph(const_cast<Graph&>(graph))
, fimap(parameters::choose_parameter(parameters::get_parameter(np, internal_np::face_index), get_const_property_map(face_index, graph)))
, vimap(parameters::choose_parameter(parameters::get_parameter(np, internal_np::vertex_index), get_const_property_map(boost::vertex_index, graph)))
, himap(parameters::choose_parameter(parameters::get_parameter(np, internal_np::halfedge_index), get_const_property_map(halfedge_index, graph)))
FacePatchIndexMap face_patch_index_map,
const CGAL_BGL_NP_CLASS& np
#ifndef DOXYGEN_RUNNING
, typename boost::enable_if<
typename boost::has_range_const_iterator<FacePatchIndexRange>::type
>::type* = 0
#endif
)
: _graph(const_cast<Graph&>(graph)),
fimap(CGAL::get_initialized_face_index_map(graph, np)),
vimap(CGAL::get_initialized_vertex_index_map(graph, np)),
himap(CGAL::get_initialized_halfedge_index_map(graph, np))
{
set_selected_faces(selected_face_patch_indices, face_patch_index_map);
}
@ -152,10 +158,10 @@ struct Face_filtered_graph
typename boost::has_range_const_iterator<FacePatchIndexRange>::type
>::type* = 0
)
: _graph(const_cast<Graph&>(graph))
, fimap(get(CGAL::face_index, graph))
, vimap(get(boost::vertex_index, graph))
, himap(get(CGAL::halfedge_index, graph))
: _graph(const_cast<Graph&>(graph)),
fimap(CGAL::get_initialized_face_index_map(graph)),
vimap(CGAL::get_initialized_vertex_index_map(graph)),
himap(CGAL::get_initialized_halfedge_index_map(graph))
{
set_selected_faces(selected_face_patch_indices, face_patch_index_map);
}
@ -175,38 +181,37 @@ struct Face_filtered_graph
*
* \cgalNamedParamsBegin
* \cgalParamBegin{face_index_map}
* a property map containing an index for each face initialized from 0 to `num_vertices(graph)`
* a property map containing for each face of `graph` a unique index between `0` and `num_faces(graph)-1`
* \cgalParamEnd
* \cgalParamBegin{vertex_index_map}
* a property map containing an index for each vertex initialized 0 to `num_vertices(graph)`
* a property map containing for each vertex of `graph` a unique index between `0` and `num_vertices(graph)-1`
* \cgalParamEnd
* \cgalParamBegin{halfedge_index_map}
* a property map containing an index for each halfedge initialized 0 to `num_halfedges(graph)`
* a property map containing for each halfedge of `graph` a unique index between `0` and `num_halfedges(graph)-1`
* \cgalParamEnd
* \cgalNamedParamsEnd
*/
template <typename FacePatchIndexMap, class CGAL_BGL_NP_TEMPLATE_PARAMETERS>
Face_filtered_graph(const Graph& graph,
typename boost::property_traits<FacePatchIndexMap>::value_type selected_face_patch_index,
FacePatchIndexMap face_patch_index_map,
const CGAL_BGL_NP_CLASS& np
)
: _graph(const_cast<Graph&>(graph))
, fimap(parameters::choose_parameter(parameters::get_parameter(np, internal_np::face_index), get_const_property_map(face_index, graph)))
, vimap(parameters::choose_parameter(parameters::get_parameter(np, internal_np::vertex_index), get_const_property_map(boost::vertex_index, graph)))
, himap(parameters::choose_parameter(parameters::get_parameter(np, internal_np::halfedge_index), get_const_property_map(halfedge_index, graph)))
typename boost::property_traits<FacePatchIndexMap>::value_type selected_face_patch_index,
FacePatchIndexMap face_patch_index_map,
const CGAL_BGL_NP_CLASS& np)
: _graph(const_cast<Graph&>(graph)),
fimap(CGAL::get_initialized_face_index_map(graph, np)),
vimap(CGAL::get_initialized_vertex_index_map(graph, np)),
himap(CGAL::get_initialized_halfedge_index_map(graph, np))
{
set_selected_faces(selected_face_patch_index, face_patch_index_map);
}
template <typename FacePatchIndexMap>
Face_filtered_graph(const Graph& graph,
typename boost::property_traits<FacePatchIndexMap>::value_type pid,
FacePatchIndexMap face_patch_index_map)
: _graph(const_cast<Graph&>(graph))
, fimap(get(CGAL::face_index, graph))
, vimap(get(boost::vertex_index, graph))
, himap(get(CGAL::halfedge_index, graph))
typename boost::property_traits<FacePatchIndexMap>::value_type pid,
FacePatchIndexMap face_patch_index_map)
: _graph(const_cast<Graph&>(graph)),
fimap(CGAL::get_initialized_face_index_map(graph)),
vimap(CGAL::get_initialized_vertex_index_map(graph)),
himap(CGAL::get_initialized_halfedge_index_map(graph))
{
set_selected_faces(pid, face_patch_index_map);
}
@ -236,10 +241,10 @@ struct Face_filtered_graph
Face_filtered_graph(const Graph& graph,
const FaceRange& selected_faces,
const CGAL_BGL_NP_CLASS& np)
: _graph(const_cast<Graph&>(graph))
, fimap(parameters::choose_parameter(parameters::get_parameter(np, internal_np::face_index), get_const_property_map(face_index, graph)))
, vimap(parameters::choose_parameter(parameters::get_parameter(np, internal_np::vertex_index), get_const_property_map(boost::vertex_index, graph)))
, himap(parameters::choose_parameter(parameters::get_parameter(np, internal_np::halfedge_index), get_const_property_map(halfedge_index, graph)))
: _graph(const_cast<Graph&>(graph)),
fimap(CGAL::get_initialized_face_index_map(graph, np)),
vimap(CGAL::get_initialized_vertex_index_map(graph, np)),
himap(CGAL::get_initialized_halfedge_index_map(graph, np))
{
set_selected_faces(selected_faces);
}
@ -247,10 +252,10 @@ struct Face_filtered_graph
template <typename FaceRange>
Face_filtered_graph(const Graph& graph,
const FaceRange& selected_faces)
: _graph(const_cast<Graph&>(graph))
, fimap(get(CGAL::face_index, graph))
, vimap(get(boost::vertex_index, graph))
, himap(get(CGAL::halfedge_index, graph))
: _graph(const_cast<Graph&>(graph)),
fimap(CGAL::get_initialized_face_index_map(graph)),
vimap(CGAL::get_initialized_vertex_index_map(graph)),
himap(CGAL::get_initialized_halfedge_index_map(graph))
{
set_selected_faces(selected_faces);
}
@ -293,12 +298,12 @@ struct Face_filtered_graph
template<class FacePatchIndexRange, class FacePatchIndexMap>
void set_selected_faces(const FacePatchIndexRange& selected_face_patch_indices,
FacePatchIndexMap face_patch_index_map
#ifndef DOXYGEN_RUNNING
#ifndef DOXYGEN_RUNNING
, typename boost::enable_if<
typename boost::has_range_const_iterator<FacePatchIndexRange>::type
>::type* = 0
#endif
)
#endif
)
{
face_indices.clear();
vertex_indices.clear();
@ -407,7 +412,7 @@ struct Face_filtered_graph
return selected_halfedges.count();
}
Property_map_binder< FIMap, typename Pointer_property_map< typename boost::property_traits< FIMap >::value_type >::type >
Property_map_binder<FIM, typename Pointer_property_map<typename boost::property_traits<FIM>::value_type>::type>
get_face_index_map() const
{
if (face_indices.empty())
@ -422,7 +427,7 @@ struct Face_filtered_graph
return bind_property_maps(fimap, make_property_map(face_indices) );
}
Property_map_binder< VIMap, typename Pointer_property_map< typename boost::property_traits< VIMap >::value_type >::type >
Property_map_binder<VIM, typename Pointer_property_map<typename boost::property_traits<VIM>::value_type>::type>
get_vertex_index_map() const
{
if (vertex_indices.empty())
@ -437,7 +442,7 @@ struct Face_filtered_graph
return bind_property_maps(vimap, make_property_map(vertex_indices) );
}
Property_map_binder< HIMap, typename Pointer_property_map< typename boost::property_traits< HIMap >::value_type >::type >
Property_map_binder<HIM, typename Pointer_property_map<typename boost::property_traits<HIM>::value_type >::type>
get_halfedge_index_map() const
{
if (halfedge_indices.empty())
@ -510,9 +515,9 @@ struct Face_filtered_graph
private:
Graph& _graph;
FIMap fimap;
VIMap vimap;
HIMap himap;
FIM fimap;
VIM vimap;
HIM himap;
boost::dynamic_bitset<> selected_faces;
boost::dynamic_bitset<> selected_vertices;
boost::dynamic_bitset<> selected_halfedges;
@ -1142,38 +1147,40 @@ CGAL_FILTERED_FACE_GRAPH_DYNAMIC_PMAP_SPECIALIZATION(dynamic_face_property_t)
#undef CGAL_FILTERED_FACE_GRAPH_DYNAMIC_PMAP_SPECIALIZATION
//specializations for indices
template<typename Graph,
typename FIMap,
typename VIMap,
typename HIMap>
struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, CGAL::face_index_t>{
typedef typename CGAL::Property_map_binder< FIMap,
typename CGAL::Pointer_property_map< typename boost::property_traits< FIMap >::value_type >::type > type;
typedef type const_type;
template<typename Graph, typename FIMap, typename VIMap, typename HIMap>
struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, CGAL::face_index_t>
{
typedef typename CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>::FIM FIM;
typedef typename CGAL::Property_map_binder<FIM,
typename CGAL::Pointer_property_map<
typename boost::property_traits<FIM>::value_type>::type> type;
typedef type const_type;
};
template<typename Graph, typename FIMap, typename VIMap, typename HIMap>
struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, boost::vertex_index_t>
{
typedef typename CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>::VIM VIM;
typedef typename CGAL::Property_map_binder<VIM,
typename CGAL::Pointer_property_map<
typename boost::property_traits<VIM>::value_type>::type> type;
typedef type const_type;
};
template<typename Graph,
typename FIMap,
typename VIMap,
typename HIMap>
struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, boost::vertex_index_t>{
typedef typename CGAL::Property_map_binder< VIMap,
typename CGAL::Pointer_property_map< typename boost::property_traits< VIMap >::value_type >::type > type;
typedef type const_type;
struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, CGAL::halfedge_index_t>
{
typedef typename CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>::HIM HIM;
typedef typename CGAL::Property_map_binder<HIM,
typename CGAL::Pointer_property_map<
typename boost::property_traits<HIM>::value_type>::type> type;
typedef type const_type;
};
template<typename Graph,
typename FIMap,
typename VIMap,
typename HIMap>
} // namespace boost
struct property_map<CGAL::Face_filtered_graph<Graph, FIMap, VIMap, HIMap>, CGAL::halfedge_index_t>{
typedef typename CGAL::Property_map_binder< HIMap,
typename CGAL::Pointer_property_map< typename boost::property_traits< HIMap >::value_type >::type > type;
typedef type const_type;
};
}// namespace boost
#endif // CGAL_BOOST_GRAPH_FACE_FILTERED_GRAPH_H

View File

@ -42,17 +42,14 @@ void partition_dual_graph(const TriangleMesh& tm,
CGAL_precondition(CGAL::is_triangle_mesh(tm));
CGAL_precondition_msg(nparts > 1, ("Partitioning requires a number of parts > 1"));
using parameters::choose_parameter;
using parameters::get_parameter;
typedef typename boost::graph_traits<TriangleMesh>::vertex_descriptor vertex_descriptor;
typedef typename boost::graph_traits<TriangleMesh>::halfedge_descriptor halfedge_descriptor;
typedef typename boost::graph_traits<TriangleMesh>::face_iterator face_iterator;
// vertex index map
typedef typename CGAL::GetVertexIndexMap<TriangleMesh, NamedParameters>::type Indices;
Indices indices = choose_parameter(get_parameter(np, internal_np::vertex_index),
get_const_property_map(boost::vertex_index, tm));
typedef typename CGAL::GetInitializedVertexIndexMap<TriangleMesh, NamedParameters>::type Indices;
Indices indices = CGAL::get_initialized_vertex_index_map(tm, np);
idx_t nn = static_cast<idx_t>(num_vertices(tm));
idx_t ne = static_cast<idx_t>(num_faces(tm));
@ -136,9 +133,6 @@ void partition_dual_graph(const TriangleMesh& tm, int nparts,
/// based on the mesh's dual graph. The resulting partition is stored in the vertex and/or face
/// property maps that are passed as parameters using \ref bgl_namedparameters "Named Parameters".
///
/// Property map for `CGAL::vertex_index_t` should be either available
/// as an internal property map to `tm` or provided as \ref bgl_namedparameters "Named Parameters".
///
/// \param tm a triangle mesh
/// \param nparts the number of parts in the final partition
/// \param np optional \ref bgl_namedparameters "Named Parameters" described below
@ -148,7 +142,7 @@ void partition_dual_graph(const TriangleMesh& tm, int nparts,
///
/// \cgalNamedParamsBegin
/// \cgalParamBegin{vertex_index_map}
/// is a property map containing the index of each vertex of `tm` intialized from `0` to `num_vertices(tm)-1`.
/// is a property map containing for each vertex of `tm` a unique index between `0` and `num_vertices(tm)-1`.
/// \cgalParamEnd
/// \cgalParamBegin{METIS_options}
/// is a parameter used in to pass options to the METIS mesh

View File

@ -77,17 +77,14 @@ void partition_graph(const TriangleMesh& tm,
CGAL_precondition(CGAL::is_triangle_mesh(tm));
CGAL_precondition_msg(nparts > 1, ("Partitioning requires a number of parts > 1"));
using parameters::choose_parameter;
using parameters::get_parameter;
typedef typename boost::graph_traits<TriangleMesh>::vertex_descriptor vertex_descriptor;
typedef typename boost::graph_traits<TriangleMesh>::halfedge_descriptor halfedge_descriptor;
typedef typename boost::graph_traits<TriangleMesh>::face_iterator face_iterator;
//Vertex index map
typedef typename CGAL::GetVertexIndexMap<TriangleMesh, NamedParameters>::type Indices;
Indices indices = choose_parameter(get_parameter(np, internal_np::vertex_index),
get_const_property_map(boost::vertex_index, tm));
typedef typename CGAL::GetInitializedVertexIndexMap<TriangleMesh, NamedParameters>::type Indices;
Indices indices = CGAL::get_initialized_vertex_index_map(tm, np);
idx_t nn = static_cast<idx_t>(num_vertices(tm));
idx_t ne = static_cast<idx_t>(num_faces(tm));
@ -168,9 +165,6 @@ void partition_graph(const TriangleMesh& tm, int nparts,
/// mesh's nodal graph. The resulting partition is stored in the vertex and/or face
/// property maps that are passed as parameters using \ref bgl_namedparameters "Named Parameters".
///
/// Property map for `CGAL::vertex_index_t` should be either available
/// as an internal property map to `tm` or provided as \ref bgl_namedparameters "Named Parameters".
///
/// \param tm a triangle mesh
/// \param nparts the number of parts in the final partition
/// \param np optional \ref bgl_namedparameters "Named Parameters" described below
@ -180,7 +174,7 @@ void partition_graph(const TriangleMesh& tm, int nparts,
///
/// \cgalNamedParamsBegin
/// \cgalParamBegin{vertex_index_map}
/// is a property map containing the index of each vertex of `tm` intialized from `0` to `num_vertices(tm)-1`.
/// is a property map containing for each vertex of `tm` a unique index between `0` and `num_vertices(tm)-1`.
/// \cgalParamEnd
/// \cgalParamBegin{METIS_options}
/// is a parameter used in to pass options to the METIS mesh

View File

@ -124,8 +124,8 @@ public:
/// The type for the objects used to identify halfedges in the underlying mesh.
typedef typename boost::graph_traits<TM>::halfedge_descriptor TM_halfedge_descriptor;
/// The type for the iterators that traverse through the complete halfedge set of the underlying mesh.
typedef typename boost::graph_traits<TM>::halfedge_iterator TM_halfedge_iterator;
/// The type for the iterators that traverse through the complete halfedge set of the underlying mesh.
typedef typename boost::graph_traits<TM>::halfedge_iterator TM_halfedge_iterator;
/// The type for the objects used to identify edges in the underlying mesh.
typedef typename boost::graph_traits<TM>::edge_descriptor TM_edge_descriptor;
@ -439,6 +439,11 @@ public:
{
return ! (e1 == e2);
}
friend std::size_t hash_value(const edge_descriptor& ed)
{
return hash_value((std::min)(ed.hd, ed.mesh_->opposite(ed.hd)));
}
};
#ifndef DOXYGEN_RUNNING

View File

@ -199,13 +199,8 @@ void copy_face_graph(const SourceMesh& sm, TargetMesh& tm,
typedef typename boost::graph_traits<TargetMesh>::halfedge_descriptor tm_halfedge_descriptor;
std::vector<tm_halfedge_descriptor> hedges(num_halfedges(sm));
// init halfedge index map
/// \TODO shall we keep that?
helpers::init_halfedge_indices(const_cast<SourceMesh&>(sm),
get(boost::halfedge_index, sm));
copy_face_graph_impl(sm, tm,
bind_property_maps(get(boost::halfedge_index, sm),
bind_property_maps(get_initialized_halfedge_index_map(sm),
make_property_map(hedges)),
v2v, h2h, f2f,
sm_vpm, tm_vpm);

View File

@ -0,0 +1,307 @@
// Copyright (c) 2020 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) : Mael Rouxel-Labbé
// Maxime Gimeno
#ifndef CGAL_BOOST_GRAPH_INITIALIZED_INTERNAL_INDEX_MAPS_HELPERS
#define CGAL_BOOST_GRAPH_INITIALIZED_INTERNAL_INDEX_MAPS_HELPERS
#include <CGAL/assertions.h>
#include <CGAL/boost/graph/Named_function_parameters.h>
#include <CGAL/boost/graph/properties.h>
#include <CGAL/Dynamic_property_map.h>
#include <CGAL/use.h>
#include <vector>
#include <type_traits>
namespace CGAL {
namespace BGL {
namespace internal {
// Check that an index map has been correctly initialized
template <typename DescriptorRange, typename IndexMap>
bool is_index_map_valid(IndexMap idmap,
const std::size_t num_simplices,
const DescriptorRange& range)
{
typedef typename boost::property_traits<IndexMap>::value_type Id_type;
Id_type max_id = static_cast<Id_type>(num_simplices);
std::vector<bool> indices(max_id);
for(const auto& d : range)
{
const Id_type id = get(idmap, d);
if(id >= 0 && id < max_id && !indices[id])
{
indices[id] = true;
}
else
{
#ifdef CGAL_BGL_INDEX_MAP_DEBUG
std::cerr << "Invalid ID: " << id << " num_simplices: " << num_simplices << std::endl;
#endif
return false;
}
}
return true;
}
template <typename VertexIndexPropertyMap, typename Graph>
bool is_index_map_valid(const CGAL::internal_np::vertex_index_t, VertexIndexPropertyMap vertex_index_map, const Graph& g)
{
return is_index_map_valid(vertex_index_map, num_vertices(g), vertices(g));
}
template <typename HalfedgeIndexPropertyMap, typename Graph>
bool is_index_map_valid(const CGAL::internal_np::halfedge_index_t, HalfedgeIndexPropertyMap halfedge_index_map, const Graph& g)
{
return is_index_map_valid(halfedge_index_map, num_halfedges(g), halfedges(g));
}
template <typename EdgeIndexPropertyMap, typename Graph>
bool is_index_map_valid(const CGAL::internal_np::edge_index_t, EdgeIndexPropertyMap edge_index_map, const Graph& g)
{
return is_index_map_valid(edge_index_map, num_edges(g), edges(g));
}
template <typename FaceIndexPropertyMap, typename Graph>
bool is_index_map_valid(const CGAL::internal_np::face_index_t, FaceIndexPropertyMap face_index_map, const Graph& g)
{
return is_index_map_valid(face_index_map, num_faces(g), faces(g));
}
template <typename PropertyTag, typename IndexPropertyMap, typename Graph>
void initialize_index_map(const PropertyTag, IndexPropertyMap, const Graph&)
{
// Unknown parameter; should never be here.
CGAL_assertion(false);
}
template <typename IndexPropertyMap,
typename Graph,
bool is_writable = CGAL::internal::Is_writable_property_map<IndexPropertyMap>::value>
struct Index_map_initializer
{
void operator()(const CGAL::internal_np::vertex_index_t, IndexPropertyMap vertex_index_map, const Graph& g)
{
typename boost::property_traits<IndexPropertyMap>::value_type i = 0;
for(typename boost::graph_traits<Graph>::vertex_descriptor vd : vertices(g))
put(vertex_index_map, vd, i++);
}
void operator()(const CGAL::internal_np::halfedge_index_t, IndexPropertyMap halfedge_index_map, const Graph& g)
{
typename boost::property_traits<IndexPropertyMap>::value_type i = 0;
for(typename boost::graph_traits<Graph>::halfedge_descriptor hd : halfedges(g))
put(halfedge_index_map, hd, i++);
}
void operator()(const CGAL::internal_np::edge_index_t, IndexPropertyMap edge_index_map, const Graph& g)
{
typename boost::property_traits<IndexPropertyMap>::value_type i = 0;
for(typename boost::graph_traits<Graph>::edge_descriptor ed : edges(g))
put(edge_index_map, ed, i++);
}
void operator()(const CGAL::internal_np::face_index_t, IndexPropertyMap face_index_map, const Graph& g)
{
typename boost::property_traits<IndexPropertyMap>::value_type i = 0;
for(typename boost::graph_traits<Graph>::face_descriptor fd : faces(g))
put(face_index_map, fd, i++);
}
template <typename PropertyTag>
void operator()(const PropertyTag, IndexPropertyMap, const Graph&)
{
// Unknown parameter; should never be here.
CGAL_assertion(false);
}
};
template <typename IndexPropertyMap, typename Graph>
struct Index_map_initializer<IndexPropertyMap, Graph, false>
{
template <typename PropertyTag>
void operator()(const PropertyTag, IndexPropertyMap, const Graph&)
{
// The property map is not writable; should never be here.
CGAL_assertion_msg(false, "You are trying to initialize a non-writable property map");
}
};
// Just for convenience, define the following functions:
//
// BGL::internal::initialize_vertex_index_map()
// BGL::internal::initialize_halfedge_index_map()
// BGL::internal::initialize_edge_index_map()
// BGL::internal::initialize_face_index_map()
#define CGAL_DEF_INITIALIZE_ID_MAP_FUNCTION(TYPE) \
template <typename WritableIndexPropertyMap, typename Graph> \
void initialize_##TYPE##_index_map(WritableIndexPropertyMap index_map, \
const Graph& g) \
{ \
Index_map_initializer<WritableIndexPropertyMap, Graph> initializer; \
initializer(CGAL::internal_np::TYPE##_index_t{}, index_map, g); \
}
CGAL_DEF_INITIALIZE_ID_MAP_FUNCTION(vertex)
CGAL_DEF_INITIALIZE_ID_MAP_FUNCTION(halfedge)
CGAL_DEF_INITIALIZE_ID_MAP_FUNCTION(edge)
CGAL_DEF_INITIALIZE_ID_MAP_FUNCTION(face)
#undef CGAL_DEF_INITIALIZE_ID_FUCNTION
// Using the pmap passed in named parameters -------------------------------------------------------
template <typename IndexMap, typename PropertyTag, typename Tag, typename DynamicTag, typename Graph>
IndexMap get_initialized_index_map_const(const IndexMap index_map,
const PropertyTag p, Tag, DynamicTag,
const Graph& g)
{
CGAL_USE(g);
CGAL_USE(p);
// If you are passing a pmap via NPs, it must be initialized
CGAL_assertion(is_index_map_valid(p, index_map, g));
return index_map;
}
template <typename IndexMap, typename PropertyTag, typename Tag, typename DynamicTag, typename Graph>
IndexMap get_initialized_index_map(const IndexMap index_map,
const PropertyTag p, Tag, DynamicTag,
Graph& g)
{
CGAL_USE(g);
CGAL_USE(p);
// If you are passing a pmap via NPs, it must be initialized
CGAL_assertion(is_index_map_valid(p, index_map, g));
return index_map;
}
// Using the internal to the mesh ------------------------------------------------------------------
template <typename InternalIndexMap, typename PropertyTag, typename Graph>
InternalIndexMap
get_initialized_internal_index_map(InternalIndexMap index_map,
const PropertyTag p,
const Graph& g)
{
if(CGAL::internal::Is_writable_property_map<InternalIndexMap>::value)
{
if(!is_index_map_valid(p, index_map, g))
Index_map_initializer<InternalIndexMap, Graph>{}(p, index_map, g);
}
else // not writable
{
CGAL_assertion(is_index_map_valid(p, index_map, g));
}
return index_map;
}
template <typename PropertyTag, typename Tag, typename DynamicTag, typename Graph>
typename boost::property_map<Graph, Tag>::const_type
get_initialized_index_map_const(CGAL::internal_np::Param_not_found,
const PropertyTag p, const Tag tag, DynamicTag,
const Graph& g)
{
return get_initialized_internal_index_map(get(tag, g), p, g);
}
// same as above, non-const graph overload
template <typename PropertyTag, typename Tag, typename DynamicTag, typename Graph>
typename boost::property_map<Graph, Tag>::type
get_initialized_index_map(CGAL::internal_np::Param_not_found,
const PropertyTag p, const Tag tag, DynamicTag,
Graph& g)
{
// From now on the correct property map has been acquired
// and there is no need to distinguish between const and non-const mesh
return get_initialized_internal_index_map(get(tag, g), p, g);
}
// Create a dynamic property and initialize it -----------------------------------------------------
template <typename DynamicIndexMap, typename PropertyTag, typename Graph>
DynamicIndexMap
get_initialized_dynamic_index_map(DynamicIndexMap index_map,
const PropertyTag p,
const Graph& g)
{
#ifdef CGAL_PERFORMANCE_WARNINGS
std::cerr << "Warning: the automatically selected index map is a dynamic property map,"
<< " which might not have constant-time access complexity." << std::endl;
#endif
Index_map_initializer<DynamicIndexMap, Graph>{}(p, index_map, g);
return index_map;
}
template <typename PropertyTag, typename DynamicTag, typename Graph>
typename boost::property_map<Graph, DynamicTag>::const_type
get_initialized_index_map_const(CGAL::internal_np::Param_not_found,
const PropertyTag p, const DynamicTag dtag, DynamicTag,
const Graph& g)
{
return get_initialized_dynamic_index_map(get(dtag, g), p, g);
}
// same as above, non-const graph overload
template <typename PropertyTag, typename DynamicTag, typename Graph>
typename boost::property_map<Graph, DynamicTag>::type
get_initialized_index_map(CGAL::internal_np::Param_not_found,
const PropertyTag p, const DynamicTag dtag, DynamicTag,
Graph& g)
{
// From now on the correct property map has been acquired
// and there is no need to distinguish between const and non-const mesh
return get_initialized_dynamic_index_map(get(dtag, g), p, g);
}
template <typename PropertyTag, typename Tag, typename DynamicTag,
typename Graph,
typename NamedParameters = Named_function_parameters<bool, internal_np::all_default_t> >
class GetInitializedIndexMap
{
public:
// Check if there is an internal property map; if not, we must a dynamic property map
typedef typename boost::mpl::if_c<
CGAL::graph_has_property<Graph, Tag>::value, Tag, DynamicTag>::type Final_tag;
typedef typename internal_np::Lookup_named_param_def<
PropertyTag,
NamedParameters,
typename boost::property_map<Graph, Final_tag>::const_type>::type const_type;
typedef typename internal_np::Lookup_named_param_def<
PropertyTag,
NamedParameters,
typename boost::property_map<Graph, Final_tag>::type>::type type;
static const_type get_const(const PropertyTag p, const Graph& g, const NamedParameters& np)
{
return BGL::internal::get_initialized_index_map_const(parameters::get_parameter(np, p),
p, Final_tag{}, DynamicTag{}, g);
}
static type get(const PropertyTag p, Graph& g, const NamedParameters& np)
{
return BGL::internal::get_initialized_index_map(parameters::get_parameter(np, p),
p, Final_tag{}, DynamicTag{}, g);
}
};
} // namespace internal
} // namespace BGL
} // namespace CGAL
#endif // CGAL_BOOST_GRAPH_INITIALIZED_INTERNAL_INDEX_MAPS_HELPERS

View File

@ -417,13 +417,9 @@ write_polys(std::ostream& os,
{
typedef typename boost::graph_traits<Mesh>::vertex_descriptor vertex_descriptor;
typedef typename boost::graph_traits<Mesh>::face_iterator face_iterator;
typedef typename CGAL::GetVertexIndexMap<Mesh, NamedParameters>::type Vimap;
using parameters::get_parameter;
using parameters::choose_parameter;
Vimap V = choose_parameter(get_parameter(np, internal_np::vertex_index),
get_const_property_map(boost::vertex_index, mesh));
typedef typename CGAL::GetInitializedVertexIndexMap<Mesh, NamedParameters>::const_type Vimap;
Vimap V = CGAL::get_initialized_vertex_index_map(mesh, np);
std::vector<std::size_t> connectivity_table;
std::vector<std::size_t> offsets;
@ -456,13 +452,9 @@ write_polys_tag(std::ostream& os,
{
typedef typename boost::graph_traits<Mesh>::vertex_descriptor vertex_descriptor;
typedef typename boost::graph_traits<Mesh>::face_iterator face_iterator;
typedef typename CGAL::GetVertexIndexMap<Mesh, NamedParameters>::type Vimap;
using parameters::get_parameter;
using parameters::choose_parameter;
Vimap V = choose_parameter(get_parameter(np, internal_np::vertex_index),
get_const_property_map(boost::vertex_index, mesh));
typedef typename CGAL::GetInitializedVertexIndexMap<Mesh, NamedParameters>::const_type Vimap;
Vimap V = CGAL::get_initialized_vertex_index_map(mesh, np);
std::string formatattribute =
binary ? " format=\"appended\"" : " format=\"ascii\"";
@ -638,8 +630,7 @@ write_polys_points(std::ostream& os,
* `CGAL::vertex_point_t` must be available in `TriangleMesh`.
* \cgalParamEnd
* \cgalParamBegin{vertex_index_map} the property map with the indices associated to
* the vertices of `mesh`. If this parameter is omitted, an internal property map for
* `CGAL::vertex_index_t` must be available in `TriangleMesh`.
* the vertices of `mesh`.
* \cgalParamEnd
* \cgalNamedParamsEnd
*/

View File

@ -19,18 +19,19 @@
#ifndef CGAL_BOOST_GRAPH_NAMED_PARAMETERS_HELPERS_H
#define CGAL_BOOST_GRAPH_NAMED_PARAMETERS_HELPERS_H
#include <CGAL/boost/graph/internal/initialized_index_maps_helpers.h>
#include <CGAL/boost/graph/Named_function_parameters.h>
#include <CGAL/boost/graph/properties.h>
#include <CGAL/Dynamic_property_map.h>
#include <CGAL/Kernel_traits.h>
#include <CGAL/Origin.h>
#include <CGAL/property_map.h>
#include <CGAL/boost/graph/properties.h>
#include <boost/mpl/if.hpp>
#include <boost/mpl/has_xxx.hpp>
#include <boost/type_traits/is_same.hpp>
#include <type_traits>
namespace CGAL {
@ -40,8 +41,8 @@ namespace CGAL {
class Eigen_svd;
class Lapack_svd;
//
//helper classes
template<typename PolygonMesh, typename PropertyTag>
class property_map_selector
@ -104,7 +105,8 @@ namespace CGAL {
property_map_selector<PolygonMesh, PropertyTag> pms;
return pms.get_const_pmap(p, pmesh);
}
// shortcut for accessing the value type of the property map
// Shortcut for accessing the value type of the property map
template <class Graph, class Property>
class property_map_value {
typedef typename boost::property_map<Graph, Property>::const_type PMap;
@ -175,37 +177,105 @@ namespace CGAL {
> ::type type;
};
template<typename PolygonMesh, typename NamedParameters>
class GetFaceIndexMap
{
typedef typename property_map_selector<PolygonMesh, boost::face_index_t>::type DefaultMap;
typedef typename property_map_selector<PolygonMesh, boost::face_index_t>::const_type DefaultMap_const;
public:
typedef typename internal_np::Lookup_named_param_def <
internal_np::face_index_t,
NamedParameters,
DefaultMap
> ::type type;
typedef typename internal_np::Lookup_named_param_def <
internal_np::face_index_t,
NamedParameters,
DefaultMap_const
> ::type const_type;
typedef typename boost::is_same<type, DefaultMap>::type Is_internal_map;
typedef typename boost::is_same<const_type, DefaultMap_const>::type Is_internal_map_const;
};
// Define the following structs:
//
// GetInitializedVertexIndexMap
// GetInitializedHalfedgeIndexMap
// GetInitializedEdgeIndexMap
// GetInitializedFaceIndexMap
template<typename PolygonMesh, typename NamedParameters>
class GetVertexIndexMap
{
typedef typename property_map_selector<PolygonMesh, boost::vertex_index_t>::type DefaultMap;
public:
typedef typename internal_np::Lookup_named_param_def <
internal_np::vertex_index_t,
NamedParameters,
DefaultMap
> ::type type;
};
#define CGAL_DEF_GET_INDEX_TYPE(CTYPE, DTYPE, STYPE) \
template <typename Graph, \
typename NamedParameters = \
CGAL::Named_function_parameters<bool, CGAL::internal_np::all_default_t> > \
struct GetInitialized##CTYPE##IndexMap \
: public BGL::internal::GetInitializedIndexMap<internal_np::DTYPE##_index_t, \
boost::DTYPE##_index_t, \
CGAL::dynamic_##DTYPE##_property_t<STYPE>, \
Graph, NamedParameters> \
{ };
CGAL_DEF_GET_INDEX_TYPE(Vertex, vertex, typename boost::graph_traits<Graph>::vertices_size_type)
CGAL_DEF_GET_INDEX_TYPE(Halfedge, halfedge, typename boost::graph_traits<Graph>::halfedges_size_type)
CGAL_DEF_GET_INDEX_TYPE(Edge, edge, typename boost::graph_traits<Graph>::edges_size_type)
CGAL_DEF_GET_INDEX_TYPE(Face, face, typename boost::graph_traits<Graph>::faces_size_type)
#undef CGAL_DEF_GET_INDEX_TYPE
// Define the following functions:
//
// get_initialized_vertex_index_map()
// get_initialized_halfedge_index_map()
// get_initialized_edge_index_map()
// get_initialized_face_index_map()
//
// The function returns:
// - the index property map passed in the NPs, if passed in the NPs; it must be initialized by the user;
// - the internal index property map if it is the graph has one. It is initialized if needed and possible;
// - an initialized dynamic pmap otherwise.
#define CGAL_DEF_GET_INITIALIZED_INDEX_MAP(DTYPE, STYPE) \
template <typename Graph, \
typename NamedParameters> \
typename BGL::internal::GetInitializedIndexMap<CGAL::internal_np::DTYPE##_index_t, \
boost::DTYPE##_index_t, \
CGAL::dynamic_##DTYPE##_property_t<STYPE>, \
Graph, NamedParameters>::const_type \
get_initialized_##DTYPE##_index_map(const Graph& g, \
const NamedParameters& np) \
{ \
typedef BGL::internal::GetInitializedIndexMap<CGAL::internal_np::DTYPE##_index_t, \
boost::DTYPE##_index_t, \
CGAL::dynamic_##DTYPE##_property_t<STYPE>, \
Graph, NamedParameters> Index_map_getter; \
return Index_map_getter::get_const(CGAL::internal_np::DTYPE##_index_t{}, g, np); \
} \
template <typename Graph> \
typename BGL::internal::GetInitializedIndexMap<CGAL::internal_np::DTYPE##_index_t, \
boost::DTYPE##_index_t, \
CGAL::dynamic_##DTYPE##_property_t<STYPE>, \
Graph>::const_type \
get_initialized_##DTYPE##_index_map(const Graph& g) \
{ \
return get_initialized_##DTYPE##_index_map(g, CGAL::parameters::all_default()); \
} \
/* same as above, non-const version*/ \
template <typename Graph, \
typename NamedParameters, \
/*otherwise compilers will try to use 'Graph := const PM' and things will go badly*/ \
std::enable_if_t< \
!std::is_const<typename std::remove_reference<Graph>::type>::value, int> = 0> \
typename BGL::internal::GetInitializedIndexMap<CGAL::internal_np::DTYPE##_index_t, \
boost::DTYPE##_index_t, \
CGAL::dynamic_##DTYPE##_property_t<STYPE>, \
Graph, NamedParameters>::type \
get_initialized_##DTYPE##_index_map(Graph& g, \
const NamedParameters& np) \
{ \
typedef BGL::internal::GetInitializedIndexMap<CGAL::internal_np::DTYPE##_index_t, \
boost::DTYPE##_index_t, \
CGAL::dynamic_##DTYPE##_property_t<STYPE>, \
Graph, NamedParameters> Index_map_getter; \
return Index_map_getter::get(CGAL::internal_np::DTYPE##_index_t{}, g, np); \
} \
template <typename Graph, \
std::enable_if_t< \
!std::is_const<typename std::remove_reference<Graph>::type>::value, int> = 0> \
typename BGL::internal::GetInitializedIndexMap<CGAL::internal_np::DTYPE##_index_t, \
boost::DTYPE##_index_t, \
CGAL::dynamic_##DTYPE##_property_t<STYPE>, \
Graph>::type \
get_initialized_##DTYPE##_index_map(Graph& g) \
{ \
return get_initialized_##DTYPE##_index_map(g, CGAL::parameters::all_default()); \
}
CGAL_DEF_GET_INITIALIZED_INDEX_MAP(vertex, typename boost::graph_traits<Graph>::vertices_size_type)
CGAL_DEF_GET_INITIALIZED_INDEX_MAP(halfedge, typename boost::graph_traits<Graph>::halfedges_size_type)
CGAL_DEF_GET_INITIALIZED_INDEX_MAP(edge, typename boost::graph_traits<Graph>::edges_size_type)
CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits<Graph>::faces_size_type)
#undef CGAL_DEF_GET_INITIALIZED_INDEX_MAP
template<typename PolygonMesh, typename NamedParameters>
class GetFaceNormalMap
@ -244,7 +314,7 @@ namespace CGAL {
typedef std::random_access_iterator_tag iterator_category;
};
};
namespace parameters
{
template <typename PointRange>
@ -258,7 +328,7 @@ namespace CGAL {
namespace internal{
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_type_iterator, iterator, false)
}
template<typename PointRange, typename NamedParameters,
bool has_nested_iterator=internal::Has_nested_type_iterator<PointRange>::value>
class GetPointMap
@ -380,7 +450,7 @@ namespace CGAL {
DefaultPMap
> ::type const_type;
};
template<typename NamedParameters>
class GetPlaneIndexMap
{
@ -428,7 +498,7 @@ namespace CGAL {
};
} // namespace Point_set_processing_3
template<typename NamedParameters, typename DefaultSolver>
class GetSolver
{
@ -461,10 +531,10 @@ namespace CGAL {
typedef int Matrix;
static FT solve (const Matrix&, Vector&) { return 0.; }
};
public:
typedef DummySvdTraits NoTraits;
typedef typename internal_np::Lookup_named_param_def <
internal_np::svd_traits_t,
NamedParameters,
@ -477,6 +547,7 @@ namespace CGAL {
#endif
> ::type type;
};
} //namespace CGAL

View File

@ -93,7 +93,8 @@ CGAL_add_named_parameter(get_placement_policy_t, get_placement_policy, get_place
//to be documented
CGAL_add_named_parameter(face_normal_t, face_normal, face_normal_map)
CGAL_add_named_parameter(random_seed_t, random_seed, random_seed)
CGAL_add_named_parameter(tolerance_map_t, tolerance_map, tolerance_map)
CGAL_add_named_parameter(do_lock_mesh_t, do_lock_mesh, do_lock_mesh)
CGAL_add_named_parameter(do_simplify_border_t, do_simplify_border, do_simplify_border)
//internal
CGAL_add_named_parameter(weight_calculator_t, weight_calculator, weight_calculator)

View File

@ -14,72 +14,45 @@
#define CGAL_BOOST_GRAPH_BGL_PROPERTIES_H
#include <CGAL/property_map.h>
#include <CGAL/Dynamic_property_map.h>
#include <CGAL/basic.h>
#include <boost/graph/properties.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <CGAL/Dynamic_property_map.h>
#include <CGAL/basic.h>
#include <string>
#include <vector>
#include <type_traits>
namespace CGAL {
namespace CGAL{
/// \ingroup PkgBGLProperties
/// \brief graph_has_property is used to indicate if
/// a model of `HalfedgeGraph` or `FaceGraph`
/// has an internal property associated with the
/// given `PropertyTag`.
///
/// It inherits from `CGAL::Tag_true` if there is a
/// default internal property map for the
/// corresponding property tag and from
/// `CGAL::Tag_false` otherwise.
///
/// \tparam Graph a model of `HalfedgeGraph` or `FaceGraph`
/// \tparam PropertyTag the type of a property tag
/// referring to the property of interest.
///
template<typename Graph, typename PropertyTag>
struct graph_has_property
#ifndef DOXYGEN_RUNNING
: CGAL::Tag_false
#endif
{};
}
/// Boost Namespace
struct graph_has_property : CGAL::Tag_false { };
} // namespace CGAL
namespace boost {
/// \ingroup PkgBGLProperties
/// @{
/// A property tag which refers to the geometric embedding property
/// of a vertex of a \ref HalfedgeGraph.
enum vertex_point_t { vertex_point };
enum vertex_external_index_t { vertex_external_index } ;
/// A property tag which refers to the property
/// of a halfedge of being a border halfedge.
enum edge_external_index_t { edge_external_index } ;
// vertex_index_t is defined in boost
enum vertex_external_index_t { vertex_external_index };
/// A property tag which identifies the *index* property of
/// a halfedge of a \ref HalfedgeGraph.
enum halfedge_index_t { halfedge_index };
enum halfedge_external_index_t { halfedge_external_index } ;
enum halfedge_index_t { halfedge_index };
enum halfedge_external_index_t { halfedge_external_index };
// edge_index_t is defined in boost
enum edge_external_index_t { edge_external_index };
/// A property tag which identifies the *index* property of
/// a face of a \ref FaceGraph.
enum face_index_t { face_index };
enum face_external_index_t { face_external_index } ;
enum face_external_index_t { face_external_index };
struct cgal_no_property
{
typedef bool type;
typedef const bool const_type;
};
/// @}
// Introduce those two tags so we can use BOOST_INSTALL_PROPERTY
// macro. This is dangerous because we now rely on implementation
// details.
@ -97,12 +70,16 @@ BOOST_INSTALL_PROPERTY(face, external_index);
namespace CGAL {
using boost::vertex_point_t;
using boost::vertex_point;
using boost::vertex_index_t;
using boost::vertex_index;
using boost::vertex_external_index_t;
using boost::vertex_external_index;
using boost::halfedge_index_t;
using boost::halfedge_index;
using boost::halfedge_external_index_t;
using boost::halfedge_external_index;
using boost::edge_index_t;
using boost::edge_index;
using boost::edge_external_index_t;
using boost::edge_external_index;
using boost::face_index_t;
@ -111,128 +88,7 @@ using boost::face_external_index_t;
using boost::face_external_index;
} // CGAL
namespace CGAL{
namespace helpers {
// matches read-write property maps
template <class PolygonMesh, class FaceIndexMap, class Tag>
void init_face_indices(PolygonMesh& pm,
FaceIndexMap& fid,
boost::read_write_property_map_tag,
Tag)
{
typename boost::property_traits<FaceIndexMap>::value_type i = 0;
for(typename boost::graph_traits<PolygonMesh>::face_descriptor fd :
faces(pm))
{
put(fid, fd, i);
++i;
}
}
template <class PolygonMesh, class VertexIndexMap, class Tag>
void init_vertex_indices(PolygonMesh& pm,
VertexIndexMap& vid,
boost::read_write_property_map_tag,
Tag)
{
typename boost::property_traits<VertexIndexMap>::value_type i = 0;
for(typename boost::graph_traits<PolygonMesh>::vertex_descriptor vd :
vertices(pm))
{
put(vid, vd, i);
++i;
}
}
template <class PolygonMesh, class HalfedgeIndexMap, class Tag>
void init_halfedge_indices(PolygonMesh& pm,
HalfedgeIndexMap& hid,
boost::read_write_property_map_tag,
Tag)
{
typename boost::property_traits<HalfedgeIndexMap>::value_type i = 0;
for(typename boost::graph_traits<PolygonMesh>::halfedge_descriptor hd :
halfedges(pm))
{
put(hid, hd, i);
++i;
}
}
// matches mutable Lvalue property maps
template <class PolygonMesh, class FaceIndexMap>
void init_face_indices(PolygonMesh& pm,
FaceIndexMap& fid,
boost::lvalue_property_map_tag,
boost::false_type)
{
init_face_indices(pm, fid,
boost::read_write_property_map_tag(), boost::false_type());
}
template <class PolygonMesh, class VertexIndexMap>
void init_vertex_indices(PolygonMesh& pm,
VertexIndexMap& vid,
boost::lvalue_property_map_tag,
boost::false_type)
{
init_vertex_indices(pm, vid,
boost::read_write_property_map_tag(), boost::false_type());
}
template <class PolygonMesh, class HalfedgeIndexMap>
void init_halfedge_indices(PolygonMesh& pm,
HalfedgeIndexMap& hid,
boost::lvalue_property_map_tag,
boost::false_type)
{
init_halfedge_indices(pm, hid,
boost::read_write_property_map_tag(), boost::false_type());
}
// matches all other types of property map
template <class PolygonMesh, class FaceIndexMap, class MapTag, class Tag>
void init_face_indices(PolygonMesh&, FaceIndexMap, MapTag, Tag)
{}
template <class PolygonMesh, class VertexIndexMap, class MapTag, class Tag>
void init_vertex_indices(PolygonMesh&, VertexIndexMap, MapTag, Tag)
{}
template <class PolygonMesh, class HalfedgeIndexMap, class MapTag, class Tag>
void init_halfedge_indices(PolygonMesh&, HalfedgeIndexMap, MapTag, Tag)
{}
template <class PolygonMesh, class FaceIndexMap>
void init_face_indices(PolygonMesh& pm, FaceIndexMap fid)
{
init_face_indices(pm, fid,
typename boost::property_traits<FaceIndexMap>::category(),
typename boost::is_const<
typename boost::remove_reference<
typename boost::property_traits<FaceIndexMap>::reference
>::type >::type() );
}
template <class PolygonMesh, class VertexIndexMap>
void init_vertex_indices(PolygonMesh& pm, VertexIndexMap vid)
{
init_vertex_indices(pm, vid,
typename boost::property_traits<VertexIndexMap>::category(),
typename boost::is_const<
typename boost::remove_reference<
typename boost::property_traits<VertexIndexMap>::reference
>::type >::type() );
}
template <class PolygonMesh, class HalfedgeIndexMap>
void init_halfedge_indices(PolygonMesh& pm, HalfedgeIndexMap hid)
{
init_halfedge_indices(pm, hid,
typename boost::property_traits<HalfedgeIndexMap>::category(),
typename boost::is_const<
typename boost::remove_reference<
typename boost::property_traits<HalfedgeIndexMap>::reference
>::type >::type() );
}
} //namespace helpers
namespace CGAL {
namespace internal {
template<typename Polyhedron, typename Handle>
@ -260,8 +116,8 @@ struct Edge_index_accessor
};
template<typename Handle, typename ValueType, typename Reference,
bool is_const = boost::is_const<
typename boost::remove_reference<Reference>::type >::value>
bool is_const = std::is_const<
typename std::remove_reference<Reference>::type >::value>
struct Point_accessor
: boost::put_get_helper< Reference, Point_accessor<Handle, ValueType, Reference> >
{
@ -293,6 +149,32 @@ struct Point_accessor<Handle, ValueType, ConstReference, true>
reference operator[](Handle h) const { return h->point(); }
};
// this one is basically 'readable_property_map_tag'
template <typename PropertyMap,
typename PropertyMapCategory = typename boost::property_traits<PropertyMap>::category>
struct Is_writable_property_map : CGAL::Tag_false { };
template <typename PropertyMap>
struct Is_writable_property_map<PropertyMap, boost::writable_property_map_tag> : CGAL::Tag_true { };
template <typename PropertyMap>
struct Is_writable_property_map<PropertyMap, boost::read_write_property_map_tag> : CGAL::Tag_true { };
// 'lvalue_pmap_tag' is annoying, because the property map is allowed to be non-mutable,
// but boost::lvalue_property_map_tag is defined as:
// struct lvalue_property_map_tag : public read_write_property_map_tag
// so we can't just check that 'writable_property_map_tag' is a base of the the lvalue tag.
//
// This checks if the reference is non-const, which is not completely correct: map[key] returning
// a non-const reference doesn't mean that 'put(map, key, val)' exists, which is what a writable
// property map must define.
template <typename PropertyMap>
struct Is_writable_property_map<PropertyMap, boost::lvalue_property_map_tag>
: boost::mpl::if_c<std::is_const<typename std::remove_reference<
typename boost::property_traits<PropertyMap>::reference>::type>::value,
CGAL::Tag_false, CGAL::Tag_true>::type
{ };
} // namespace internal
// Needed by PMP::detec_features and Mesh_3
@ -303,12 +185,12 @@ enum vertex_time_stamp_t { vertex_time_stamp};
enum halfedge_time_stamp_t { halfedge_time_stamp};
enum face_time_stamp_t { face_time_stamp};
template <typename ID>
template<typename ID>
struct vertex_incident_patches_t {
typedef ID type;
};
template <typename ID>
template<typename ID>
struct face_patch_id_t {
typedef ID type;
};

View File

@ -112,6 +112,39 @@ struct property_map<CGAL::Seam_mesh<TM, SEM, SVM>, CGAL::vertex_point_t>
typedef CGAL::Seam_mesh_point_map<TM, SEM, SVM> type;
typedef type const_type;
};
template <class TM, class SEM, class SVM, typename T>
struct property_map<CGAL::Seam_mesh<TM, SEM, SVM>, CGAL::dynamic_vertex_property_t<T> >
{
typedef typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::vertex_descriptor vertex_descriptor;
typedef CGAL::internal::Dynamic_property_map<vertex_descriptor,T> type;
typedef type const_type;
};
template <class TM, class SEM, class SVM, typename T>
struct property_map<CGAL::Seam_mesh<TM, SEM, SVM>, CGAL::dynamic_halfedge_property_t<T> >
{
typedef typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::halfedge_descriptor halfedge_descriptor;
typedef CGAL::internal::Dynamic_property_map<halfedge_descriptor,T> type;
typedef type const_type;
};
template <class TM, class SEM, class SVM, typename T>
struct property_map<CGAL::Seam_mesh<TM, SEM, SVM>, CGAL::dynamic_edge_property_t<T> >
{
typedef typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::edge_descriptor edge_descriptor;
typedef CGAL::internal::Dynamic_property_map<edge_descriptor,T> type;
typedef type const_type;
};
template <class TM, class SEM, class SVM, typename T>
struct property_map<CGAL::Seam_mesh<TM, SEM, SVM>, CGAL::dynamic_face_property_t<T> >
{
typedef typename boost::graph_traits<CGAL::Seam_mesh<TM, SEM, SVM> >::face_descriptor face_descriptor;
typedef CGAL::internal::Dynamic_property_map<face_descriptor,T> type;
typedef type const_type;
};
} // namespace boost
namespace CGAL {

View File

@ -584,26 +584,38 @@ void expand_face_selection_for_removal(const FaceRange& faces_to_be_deleted,
{
// collect non-selected faces
std::vector<halfedge_descriptor> faces_traversed;
bool non_selected_face_range_has_boundary = false; // handle non-manifold situations when crossing a border
do
{
faces_traversed.push_back(next_around_vertex);
next_around_vertex = opposite( next(next_around_vertex, tm), tm);
if (is_border(next_around_vertex,tm))
{
next_around_vertex = opposite( next(next_around_vertex, tm), tm);
if (!get(is_selected, face(next_around_vertex, tm) ))
{
non_selected_face_range_has_boundary=true; // always non-manifold after removal of the selection
break;
}
}
CGAL_assertion(!is_border(next_around_vertex,tm));
}
while( !get(is_selected, face(next_around_vertex, tm) ) );
// go over the connected components of faces to remove
do{
if (!non_selected_face_range_has_boundary)
{
// go over the connected components of faces to remove
do{
if (next_around_vertex==start)
break;
next_around_vertex = opposite( next(next_around_vertex, tm), tm);
}
while(is_border(next_around_vertex,tm) || get(is_selected, face(next_around_vertex, tm) ) );
if (next_around_vertex==start)
break;
next_around_vertex = opposite( next(next_around_vertex, tm), tm);
}
while(is_border(next_around_vertex,tm) || get(is_selected, face(next_around_vertex, tm) ) );
if (next_around_vertex==start)
break;
// else we simply mark the range of traversed faces and start a new range after the border
for(halfedge_descriptor f_hd : faces_traversed)
{

View File

@ -0,0 +1,18 @@
OFF
9 7 0
0 0 0
1 0 0
2 0 0
2 1 0
2 2 0
1 2 0
0 2 0
0 1 0
1 1 0
3 0 1 8
3 1 2 8
3 2 3 8
3 3 4 8
3 5 6 8
3 6 7 8
3 7 0 8

View File

@ -402,6 +402,44 @@ test_swap_edges()
}
}
template <typename T>
void
add_face_bug()
{
typedef boost::graph_traits<T> GT;
typedef typename GT::vertex_descriptor vertex_descriptor;
typedef typename GT::halfedge_descriptor halfedge_descriptor;
T g;
std::vector<vertex_descriptor> vs;
vs.push_back( add_vertex(g) ); // Kernel::Point_3(0,1,0)
vs.push_back( add_vertex(g) ); // Kernel::Point_3(4,1,0)
vs.push_back( add_vertex(g) ); // Kernel::Point_3(5,2,0)
vs.push_back( add_vertex(g) ); // Kernel::Point_3(4,0,0)
CGAL::Euler::add_face(CGAL::make_array(vs[0], vs[1], vs[2]), g);
CGAL::Euler::add_face(CGAL::make_array(vs[1], vs[3], vs[2]), g);
// force vertex halfedge to not be a border halfedge
for(vertex_descriptor v : vertices(g))
{
halfedge_descriptor h = halfedge(v, g);
if ( CGAL::is_border(h, g) )
set_halfedge(v, prev(opposite(h, g), g), g);
assert(target(halfedge(v, g), g)==v);
}
vs.push_back( add_vertex(g) ); // Kernel::Point_3(0,0,0)
vs.push_back( add_vertex(g) ); // Kernel::Point_3(1,0,0)
CGAL::Euler::add_face(CGAL::make_array(vs[4],vs[5],vs[0]), g);
vs.push_back( add_vertex(g) ); // Kernel::Point_3(2,0,0)
vs.push_back( add_vertex(g) ); // Kernel::Point_3(3,0,0)
CGAL::Euler::add_face(CGAL::make_array(vs[6],vs[7],vs[1]), g);
CGAL::Euler::add_face(CGAL::make_array(vs[7],vs[3],vs[1]), g);
}
template <typename Graph>
void
test_Euler_operations()
@ -421,6 +459,7 @@ test_Euler_operations()
join_split_inverse<Graph>();
does_satisfy_link_condition<Graph>();
test_swap_edges<Graph>();
add_face_bug<Graph>();
}
int main()

View File

@ -491,13 +491,13 @@ int main()
typedef boost::graph_traits<Polyhedron> PolyTraits;
typedef boost::property_map<Polyhedron, boost::vertex_point_t>::type VPMap;
typedef boost::property_map<Polyhedron, boost::vertex_point_t>::const_type VPMap;
typedef PolyTraits::face_descriptor poly_face_descriptor;
typedef boost::associative_property_map< std::map<poly_face_descriptor,
PolyTraits::faces_size_type> > FCMap;
typedef boost::property_map<Polyhedron, CGAL::face_external_index_t>::type FIMap;
typedef boost::property_map<Polyhedron, CGAL::vertex_external_index_t>::type VIMap;
typedef boost::property_map<Polyhedron, CGAL::halfedge_external_index_t>::type HIMap;
typedef boost::property_map<Polyhedron, CGAL::face_external_index_t>::const_type FIMap;
typedef boost::property_map<Polyhedron, CGAL::vertex_external_index_t>::const_type VIMap;
typedef boost::property_map<Polyhedron, CGAL::halfedge_external_index_t>::const_type HIMap;
typedef CGAL::Face_filtered_graph<Polyhedron, FIMap, VIMap, HIMap> Poly_Adapter;
auto poly = std::make_unique<Polyhedron>();
CGAL::make_tetrahedron(
@ -516,14 +516,14 @@ int main()
FCMap poly_fccmap(fc_map);
VPMap vpmap = get(boost::vertex_point, *poly);
CGAL::Polygon_mesh_processing::connected_components(*poly, poly_fccmap, CGAL::Polygon_mesh_processing::parameters::
edge_is_constrained_map(Constraint<Polyhedron, VPMap >(*poly, vpmap)).
face_index_map(poly_fimap));
CGAL::Polygon_mesh_processing::connected_components(*poly, poly_fccmap,
CGAL::Polygon_mesh_processing::parameters::edge_is_constrained_map(Constraint<Polyhedron, VPMap >(*poly, vpmap))
.face_index_map(poly_fimap));
Poly_Adapter poly_adapter(*poly,
pids,
poly_fccmap,
CGAL::parameters::face_index_map(poly_fimap).
vertex_index_map(poly_vimap).
halfedge_index_map(poly_himap));
CGAL::parameters::face_index_map(poly_fimap)
.vertex_index_map(poly_vimap)
.halfedge_index_map(poly_himap));
test_mesh<Polyhedron, FCMap, Poly_Adapter>(poly_adapter);
}

View File

@ -14,6 +14,68 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef CGAL::Surface_mesh<Kernel::Point_3> SM;
typedef boost::graph_traits<SM>::face_descriptor face_descriptor;
void border_cases()
{
SM sm_ref;
std::ifstream input("data/nm_selection_removal.off");
input >> sm_ref;
{
SM sm = sm_ref;
std::vector<SM::Face_index> faces_to_remove;
faces_to_remove.push_back(SM::Face_index(5));
faces_to_remove.push_back(SM::Face_index(6));
SM::Property_map<SM::Face_index, bool> is_selected = sm.add_property_map<SM::Face_index, bool>("f:is_selected", false).first;
is_selected[SM::Face_index(5)]=true;
is_selected[SM::Face_index(6)]=true;
CGAL::expand_face_selection_for_removal(faces_to_remove,
sm,
is_selected);
int i=0;
for(face_descriptor fh : sm.faces())
if(!is_selected[fh]) ++i;
assert(i==4);
}
{
SM sm = sm_ref;
std::vector<SM::Face_index> faces_to_remove;
faces_to_remove.push_back(SM::Face_index(4));
faces_to_remove.push_back(SM::Face_index(6));
SM::Property_map<SM::Face_index, bool> is_selected = sm.add_property_map<SM::Face_index, bool>("f:is_selected", false).first;
is_selected[SM::Face_index(4)]=true;
is_selected[SM::Face_index(6)]=true;
CGAL::expand_face_selection_for_removal(faces_to_remove,
sm,
is_selected);
int i=0;
for(face_descriptor fh : sm.faces())
if(!is_selected[fh]) ++i;
assert(i==1 || i==4); // depends on the start point
}
{
SM sm = sm_ref;
std::vector<SM::Face_index> faces_to_remove;
faces_to_remove.push_back(SM::Face_index(4));
faces_to_remove.push_back(SM::Face_index(5));
faces_to_remove.push_back(SM::Face_index(6));
SM::Property_map<SM::Face_index, bool> is_selected = sm.add_property_map<SM::Face_index, bool>("f:is_selected", false).first;
is_selected[SM::Face_index(4)]=true;
is_selected[SM::Face_index(5)]=true;
is_selected[SM::Face_index(6)]=true;
CGAL::expand_face_selection_for_removal(faces_to_remove,
sm,
is_selected);
int i=0;
for(face_descriptor fh : sm.faces())
if(!is_selected[fh]) ++i;
assert(i==4); // depends on the start point
}
}
int main()
{
SM sm;
@ -60,6 +122,8 @@ int main()
assert( sm.number_of_faces()+30 < nb_input_faces);
assert(is_valid_polygon_mesh(sm));
border_cases();
return 0;
}

View File

@ -38,6 +38,7 @@
#include <CGAL/boost/graph/properties_Constrained_Delaunay_triangulation_2.h>
#include <CGAL/boost/graph/graph_traits_Constrained_triangulation_plus_2.h>
#include <CGAL/boost/graph/properties_Constrained_triangulation_plus_2.h>
#include <CGAL/boost/graph/Seam_mesh.h>
#include <CGAL/boost/graph/io.h>
@ -57,6 +58,10 @@ typedef CGAL::Linear_cell_complex_for_bgl_combinatorial_map_helper
typedef CGAL::Surface_mesh<Point_3> SM;
typedef SM::Property_map<SM::Edge_index, bool> Seam_edge_pmap;
typedef SM::Property_map<SM::Vertex_index, bool> Seam_vertex_pmap;
typedef CGAL::Seam_mesh<SM, Seam_edge_pmap, Seam_vertex_pmap> Seam_mesh;
#if defined(CGAL_USE_OPENMESH)
#include <OpenMesh/Core/IO/MeshIO.hh>
@ -73,6 +78,8 @@ typedef OpenMesh::PolyMesh_ArrayKernelT</* MyTraits*/> OMesh;
typedef CGAL::Triangulation_vertex_base_with_id_2<Kernel> Vbb;
typedef CGAL::Triangulation_face_base_with_id_2<Kernel> Fbb;
typedef CGAL::Triangulation_2<Kernel> Triangulation_no_id_2;
typedef CGAL::Triangulation_2<Kernel,
CGAL::Triangulation_data_structure_2<Vbb, Fbb> > Triangulation_2;
typedef CGAL::Delaunay_triangulation_2<Kernel,
@ -189,8 +196,6 @@ template <typename Tr>
Tr build_dummy_triangulation()
{
typedef typename Tr::Point Point;
typedef typename boost::graph_traits<Tr>::vertex_descriptor vertex_descriptor;
typedef typename boost::graph_traits<Tr>::face_descriptor face_descriptor;
Tr t;
t.insert(Point(0.1,0));
@ -199,24 +204,25 @@ Tr build_dummy_triangulation()
t.insert(Point(0,1));
t.insert(Point(0,2));
int id = 0;
for(vertex_descriptor vd : vertices(t))
vd->id() = id++;
id = 0;
for(face_descriptor fd : faces(t))
fd->id() = id++;
return t;
}
Triangulation_2 t2_data() { return build_dummy_triangulation<Triangulation_2>(); }
Delaunay_triangulation_2 dt2_data() { return build_dummy_triangulation<Delaunay_triangulation_2>(); }
Regular_triangulation_2 rt2_data() { return build_dummy_triangulation<Regular_triangulation_2>(); }
Constrained_triangulation_2 ct2_data() { return build_dummy_triangulation<Constrained_triangulation_2>(); }
Constrained_Delaunay_triangulation_2 cdt2_data() { return build_dummy_triangulation<Constrained_Delaunay_triangulation_2>(); }
CDT_P2 cdtp2_data() { return build_dummy_triangulation<CDT_P2>(); }
Triangulation_hierarchy_2 t2h_data() { return build_dummy_triangulation<Triangulation_hierarchy_2>(); }
template <typename Tr>
Tr build_dummy_triangulation_with_ids()
{
Tr t = build_dummy_triangulation<Tr>();
CGAL::set_triangulation_ids(t);
return t;
}
Triangulation_no_id_2 t2_no_id_data() { return build_dummy_triangulation<Triangulation_no_id_2>(); }
Triangulation_2 t2_data() { return build_dummy_triangulation_with_ids<Triangulation_2>(); }
Delaunay_triangulation_2 dt2_data() { return build_dummy_triangulation_with_ids<Delaunay_triangulation_2>(); }
Regular_triangulation_2 rt2_data() { return build_dummy_triangulation_with_ids<Regular_triangulation_2>(); }
Constrained_triangulation_2 ct2_data() { return build_dummy_triangulation_with_ids<Constrained_triangulation_2>(); }
Constrained_Delaunay_triangulation_2 cdt2_data() { return build_dummy_triangulation_with_ids<Constrained_Delaunay_triangulation_2>(); }
CDT_P2 cdtp2_data() { return build_dummy_triangulation_with_ids<CDT_P2>(); }
Triangulation_hierarchy_2 t2h_data() { return build_dummy_triangulation_with_ids<Triangulation_hierarchy_2>(); }
template <typename Graph>
struct Surface_fixture_1 {

View File

@ -1,115 +1,459 @@
#include "test_Prefix.h"
#include <CGAL/boost/graph/Euler_operations.h>
#include <boost/unordered_set.hpp>
template< typename G,
typename ForwardRange,
typename IndexPropertyMap
>
void index_uniqueness(const G&,
ForwardRange range,
IndexPropertyMap pm)
// #define CGAL_TEST_PROPERTIES_DEBUG
namespace CGAL {
template <typename Key, typename Value, typename Container>
struct Non_mutable_property_map
{
typedef Key key_type;
typedef Value value_type;
typedef value_type reference;
typedef boost::readable_property_map_tag category;
Non_mutable_property_map(const Container& c) : m_c(c) { }
friend reference get(const Non_mutable_property_map<Key, Value, Container>& pmap, key_type k)
{
return pmap.m_c.at(k);
}
private:
const Container& m_c;
};
template <typename Key, typename Value, typename Container>
struct RW_property_map
{
typedef Key key_type;
typedef Value value_type;
typedef value_type& reference;
typedef boost::read_write_property_map_tag category;
RW_property_map(Container& c) : m_c(c) { }
friend void put(RW_property_map<Key, Value, Container>& pmap, const key_type& k, const value_type& val)
{
pmap.m_c[k] = val;
}
friend reference get(RW_property_map<Key, Value, Container>& pmap, const key_type& k)
{
return pmap.m_c[k];
}
private:
Container& m_c;
};
} // namespace CGAL
template<typename Graph,
typename ForwardRange,
typename IndexPropertyMap>
void test_uniqueness(const Graph&,
const ForwardRange& range,
IndexPropertyMap index_map)
{
#ifdef CGAL_TEST_PROPERTIES_DEBUG
std::cout << std::endl
<< "Checking the uniqueness of the property map of type: "
<< typeid(IndexPropertyMap).name() << std::endl;
std::cout << "Element type: " << typeid(typename boost::range_value<ForwardRange>::type).name() << std::endl;
#endif
typename boost::range_iterator<ForwardRange>::type
begin = boost::begin(range),
begin = boost::begin(range),
begin2 = boost::begin(range),
end = boost::end(range);
typedef boost::unordered_set<typename IndexPropertyMap::value_type> id_map;
typedef std::pair<typename id_map::iterator, bool> resultp;
id_map m;
while(begin != end) {
resultp r = m.insert(get(pm, *begin));
id_map m;
while(begin != end)
{
resultp r = m.insert(get(index_map, *begin));
#ifdef CGAL_TEST_PROPERTIES_DEBUG
std::cout << "id: " << get(index_map, *begin) << std::endl;
#endif
++begin;
assert(r.second);
assert(r.second); // already seen that id
}
assert(std::distance(begin2, end) == static_cast<std::ptrdiff_t>(m.size()));
}
void index_uniqueness_poly(const Polyhedron& g)
template<typename Graph,
typename NamedParameters>
void test_vertex_index_map_uniqueness(const Graph& g,
const NamedParameters& np)
{
index_uniqueness(g, edges(g) , get(boost::edge_index, g));
index_uniqueness(g, vertices(g), get(boost::vertex_index, g));
index_uniqueness(g, faces(g), get(boost::face_index, g));
index_uniqueness(g, halfedges(g), get(boost::halfedge_index, g));
typedef typename CGAL::GetInitializedVertexIndexMap<Graph, NamedParameters>::type VIM;
typedef typename CGAL::GetInitializedVertexIndexMap<Graph, NamedParameters>::const_type CVIM;
index_uniqueness(g, edges(g) , get(boost::edge_external_index, g));
index_uniqueness(g, vertices(g), get(boost::vertex_external_index, g));
index_uniqueness(g, faces(g), get(boost::face_external_index, g));
index_uniqueness(g, halfedges(g), get(boost::halfedge_external_index, g));
// in the case where the map is passed by NP, its type doesn't depend on whether the mesh is const or not
static_assert((std::is_same<VIM, CVIM>::value), "VIM, CVIM must be the same type");
VIM ivim = CGAL::get_initialized_vertex_index_map(g, np);
return test_uniqueness(g, vertices(g), ivim);
}
void index_uniqueness_lcc(const LCC& g)
template<typename Graph,
typename NamedParameters>
void test_halfedge_index_map_uniqueness(const Graph& g,
const NamedParameters& np)
{
index_uniqueness(g, edges(g) , get(boost::edge_index, g));
index_uniqueness(g, vertices(g), get(boost::vertex_index, g));
index_uniqueness(g, faces(g), get(boost::face_index, g));
index_uniqueness(g, halfedges(g), get(boost::halfedge_index, g));
typedef typename CGAL::GetInitializedHalfedgeIndexMap<Graph, NamedParameters>::type HIM;
typedef typename CGAL::GetInitializedHalfedgeIndexMap<Graph, NamedParameters>::const_type CHIM;
// in the case where the map is passed by NP, its type doesn't depend on whether the mesh is const or not
static_assert((std::is_same<HIM, CHIM>::value), "HIM, CHIM must be the same type");
HIM ihim = CGAL::get_initialized_halfedge_index_map(g, np);
return test_uniqueness(g, halfedges(g), ihim);
}
void index_uniqueness_sm(const SM& g)
template<typename Graph,
typename NamedParameters>
void test_edge_index_map_uniqueness(const Graph& g,
const NamedParameters& np)
{
index_uniqueness(g, edges(g) , get(boost::edge_index, g));
index_uniqueness(g, vertices(g), get(boost::vertex_index, g));
index_uniqueness(g, faces(g), get(boost::face_index, g));
index_uniqueness(g, halfedges(g), get(boost::halfedge_index, g));
typedef typename CGAL::GetInitializedEdgeIndexMap<Graph, NamedParameters>::type EIM;
typedef typename CGAL::GetInitializedEdgeIndexMap<Graph, NamedParameters>::const_type CEIM;
// in the case where the map is passed by NP, its type doesn't depend on whether the mesh is const or not
static_assert((std::is_same<EIM, CEIM>::value), "EIM, CEIM must be the same type");
EIM ieim = CGAL::get_initialized_edge_index_map(g, np);
return test_uniqueness(g, edges(g), ieim);
}
#if defined(CGAL_USE_OPENMESH)
void index_uniqueness_omesh(const OMesh& g)
template<typename Graph,
typename NamedParameters>
void test_face_index_map_uniqueness(const Graph& g,
const NamedParameters& np)
{
index_uniqueness(g, edges(g) , get(boost::edge_index, g));
index_uniqueness(g, vertices(g), get(boost::vertex_index, g));
index_uniqueness(g, faces(g), get(boost::face_index, g));
index_uniqueness(g, halfedges(g), get(boost::halfedge_index, g));
typedef typename CGAL::GetInitializedFaceIndexMap<Graph, NamedParameters>::type FIM;
typedef typename CGAL::GetInitializedFaceIndexMap<Graph, NamedParameters>::const_type CFIM;
// in the case where the map is passed by NP, its type doesn't depend on whether the mesh is const or not
static_assert((std::is_same<FIM, CFIM>::value), "FIM, CFIM must be the same type");
FIM ifim = CGAL::get_initialized_face_index_map(g, np);
return test_uniqueness(g, faces(g), ifim);
}
////////////////////////////////////////// const ///////////////////////////////////////////////////
template <typename Graph>
void test_internal_index_maps_const(const Graph& g)
{
test_uniqueness(g, vertices(g), get(boost::vertex_index, g));
test_uniqueness(g, halfedges(g), get(boost::halfedge_index, g));
test_uniqueness(g, edges(g) , get(boost::edge_index, g));
test_uniqueness(g, faces(g), get(boost::face_index, g));
}
template <typename Graph>
void test_initialized_index_maps_const(const Graph& g)
{
typedef typename CGAL::GetInitializedVertexIndexMap<Graph>::const_type VIM;
VIM ivim = CGAL::get_initialized_vertex_index_map(g);
test_uniqueness(g, vertices(g), ivim);
typedef typename CGAL::GetInitializedHalfedgeIndexMap<Graph>::const_type HIM;
HIM ihim = CGAL::get_initialized_halfedge_index_map(g);
test_uniqueness(g, halfedges(g), ihim);
typedef typename CGAL::GetInitializedEdgeIndexMap<Graph>::const_type EIM;
EIM ieim = CGAL::get_initialized_edge_index_map(g);
test_uniqueness(g, edges(g), ieim);
typedef typename CGAL::GetInitializedFaceIndexMap<Graph>::const_type FIM;
FIM ifim = CGAL::get_initialized_face_index_map(g);
test_uniqueness(g, faces(g), ifim);
// Passing an index map via NP
typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
typedef std::map<vertex_descriptor, int> VertexIndexMap;
typedef boost::associative_property_map<VertexIndexMap> VertexIdPropertyMap; // lvalue_pmap
int vi = static_cast<int>(num_vertices(g));
VertexIndexMap vim;
VertexIdPropertyMap external_vertex_index_map(vim);
for(vertex_descriptor v : vertices(g))
put(external_vertex_index_map, v, --vi);
test_vertex_index_map_uniqueness(g, CGAL::parameters::vertex_index_map(external_vertex_index_map));
// Read-only pmap
typedef typename boost::graph_traits<Graph>::halfedge_descriptor halfedge_descriptor;
typedef std::map<halfedge_descriptor, int> HalfedgeIndexMap;
typedef CGAL::Non_mutable_property_map<halfedge_descriptor, int,
HalfedgeIndexMap> HalfedgeIdPropertyMap;
int hi = 0;
HalfedgeIndexMap him;
HalfedgeIdPropertyMap external_halfedge_index_map(him);
// this should complain that the map is not writable (commented because it does assert)
// CGAL::BGL::internal::initialize_halfedge_index_map(external_halfedge_index_map, g);
// forced to initialize the underlying map
for(halfedge_descriptor h : halfedges(g))
him[h] = hi++;
test_halfedge_index_map_uniqueness(g, CGAL::parameters::halfedge_index_map(external_halfedge_index_map));
// Writable pmap
typedef typename boost::graph_traits<Graph>::edge_descriptor edge_descriptor;
typedef boost::unordered_map<edge_descriptor, int> EdgeIndexMap;
typedef CGAL::RW_property_map<edge_descriptor, int, EdgeIndexMap> EdgeIdPropertyMap;
EdgeIndexMap eim;
EdgeIdPropertyMap external_edge_index_map(eim);
CGAL::BGL::internal::initialize_edge_index_map(external_edge_index_map, g);
test_edge_index_map_uniqueness(g, CGAL::parameters::edge_index_map(external_edge_index_map));
// Just so face_index_map don't feel excluded
typedef typename boost::graph_traits<Graph>::face_descriptor face_descriptor;
typedef std::map<face_descriptor, int> FaceIndexMap;
typedef boost::const_associative_property_map<FaceIndexMap> FaceIdPropertyMap;
FaceIndexMap fim;
FaceIdPropertyMap external_face_index_map(fim);
// 'const_associative_pmap' has category 'lvalue_property_map_tag' but it's not writable
// so below should complain (commented because it does assert)
// CGAL::BGL::internal::initialize_face_index_map(external_face_index_map, g);
// gotta initialize the underlying map
int fi = 0;
for(face_descriptor f : faces(g))
fim[f] = fi++;
test_face_index_map_uniqueness(g, CGAL::parameters::face_index_map(external_face_index_map));
}
template <typename Graph>
void test_all_index_maps_const(const Graph& g)
{
#ifdef CGAL_TEST_PROPERTIES_DEBUG
std::cout << " ---------------------------- Const graph tests" << std::endl;
#endif
template <typename Triangulation>
void index_uniqueness_tr(const Triangulation& g)
{
index_uniqueness(g, edges(g) , get(boost::edge_index, g));
index_uniqueness(g, vertices(g), get(boost::vertex_index, g));
index_uniqueness(g, faces(g), get(boost::face_index, g));
index_uniqueness(g, halfedges(g), get(boost::halfedge_index, g));
test_internal_index_maps_const(g);
test_initialized_index_maps_const(g);
}
int main()
///////////////////////////////////// non-const ////////////////////////////////////////////////////
template <typename Graph>
void test_internal_index_maps(Graph& g)
{
test_uniqueness(g, vertices(g), get(boost::vertex_index, g));
test_uniqueness(g, halfedges(g), get(boost::halfedge_index, g));
test_uniqueness(g, edges(g) , get(boost::edge_index, g));
test_uniqueness(g, faces(g), get(boost::face_index, g));
}
template <typename Graph>
void test_initialized_index_maps(Graph& g)
{
typedef typename CGAL::GetInitializedVertexIndexMap<Graph>::type VIM;
VIM ivim = CGAL::get_initialized_vertex_index_map(g);
test_uniqueness(g, vertices(g), ivim);
typedef typename CGAL::GetInitializedHalfedgeIndexMap<Graph>::type HIM;
HIM ihim = CGAL::get_initialized_halfedge_index_map(g);
test_uniqueness(g, halfedges(g), ihim);
typedef typename CGAL::GetInitializedEdgeIndexMap<Graph>::type EIM;
EIM ieim = CGAL::get_initialized_edge_index_map(g);
test_uniqueness(g, edges(g), ieim);
typedef typename CGAL::GetInitializedFaceIndexMap<Graph>::type FIM;
FIM ifim = CGAL::get_initialized_face_index_map(g);
test_uniqueness(g, faces(g), ifim);
// Passing an index map via NP
typedef typename boost::graph_traits<Graph>::vertex_descriptor vertex_descriptor;
typedef std::map<vertex_descriptor, int> VertexIndexMap;
typedef boost::associative_property_map<VertexIndexMap> VertexIdPropertyMap; // lvalue_pmap
int vi = static_cast<int>(num_vertices(g));
VertexIndexMap vim;
VertexIdPropertyMap external_vertex_index_map(vim);
for(vertex_descriptor v : vertices(g))
put(external_vertex_index_map, v, --vi);
test_vertex_index_map_uniqueness(g, CGAL::parameters::vertex_index_map(external_vertex_index_map));
// Read-only pmap
typedef typename boost::graph_traits<Graph>::halfedge_descriptor halfedge_descriptor;
typedef std::map<halfedge_descriptor, int> HalfedgeIndexMap;
typedef CGAL::Non_mutable_property_map<halfedge_descriptor, int,
HalfedgeIndexMap> HalfedgeIdPropertyMap;
int hi = 0;
HalfedgeIndexMap him;
HalfedgeIdPropertyMap external_halfedge_index_map(him);
// this should complain that the map is not writable (commented because it does assert)
// CGAL::BGL::internal::initialize_halfedge_index_map(external_halfedge_index_map, g);
// forced to initialize the underlying map
for(halfedge_descriptor h : halfedges(g))
him[h] = hi++;
test_halfedge_index_map_uniqueness(g, CGAL::parameters::halfedge_index_map(external_halfedge_index_map));
// Writable pmap
typedef typename boost::graph_traits<Graph>::edge_descriptor edge_descriptor;
typedef boost::unordered_map<edge_descriptor, int> EdgeIndexMap;
typedef CGAL::RW_property_map<edge_descriptor, int, EdgeIndexMap> EdgeIdPropertyMap;
EdgeIndexMap eim;
EdgeIdPropertyMap external_edge_index_map(eim);
CGAL::BGL::internal::initialize_edge_index_map(external_edge_index_map, g);
test_edge_index_map_uniqueness(g, CGAL::parameters::edge_index_map(external_edge_index_map));
// Just so face_index_map don't feel excluded
typedef typename boost::graph_traits<Graph>::face_descriptor face_descriptor;
typedef std::map<face_descriptor, int> FaceIndexMap;
typedef boost::const_associative_property_map<FaceIndexMap> FaceIdPropertyMap;
FaceIndexMap fim;
FaceIdPropertyMap external_face_index_map(fim);
// 'const_associative_pmap' has category 'lvalue_property_map_tag' but it's not writable
// so below should complain (commented because it does assert)
// CGAL::BGL::internal::initialize_face_index_map(external_face_index_map, g);
// gotta initialize the underlying map
int fi = 0;
for(face_descriptor f : faces(g))
fim[f] = fi++;
test_face_index_map_uniqueness(g, CGAL::parameters::face_index_map(external_face_index_map));
}
template <typename Graph>
void test_all_index_maps(Graph& g)
{
#ifdef CGAL_TEST_PROPERTIES_DEBUG
std::cout << " ---------------------------- Non-const graph tests" << std::endl;
#endif
test_internal_index_maps(g);
test_initialized_index_maps(g);
}
template <typename Graph>
void test_graph(Graph& g)
{
#ifdef CGAL_TEST_PROPERTIES_DEBUG
std::cout << "Graph has:" << std::endl
<< "\t" << num_vertices(g) << " vertices (actual: " << vertices(g).size() << ")" << std::endl
<< "\t" << num_halfedges(g) << " halfedges (actual: " << halfedges(g).size() << ")" << std::endl
<< "\t" << num_edges(g) << " edges (actual: " << edges(g).size() << ")" << std::endl
<< "\t" << num_faces(g) << " faces (actual: " << faces(g).size() << ")" << std::endl;
#endif
test_all_index_maps(g);
test_all_index_maps_const(g);
}
void test_poly(Polyhedron& g)
{
test_graph(g);
test_uniqueness(g, edges(g) , get(boost::edge_external_index, g));
test_uniqueness(g, vertices(g), get(boost::vertex_external_index, g));
test_uniqueness(g, faces(g), get(boost::face_external_index, g));
test_uniqueness(g, halfedges(g), get(boost::halfedge_external_index, g));
}
int main(int, char**)
{
std::cout << "testing Polyhedron\n";
std::vector<Polyhedron> polys = poly_data();
for(Polyhedron p : polys)
index_uniqueness_poly(p);
for(Polyhedron& p : polys)
test_poly(p);
std::cout << "testing Linear_cell_complex\n";
std::vector<LCC> lccs = lcc_data();
for(LCC p : lccs)
index_uniqueness_lcc(p);
for(LCC& p : lccs)
test_graph(p);
std::cout << "testing Surface_mesh\n";
std::vector<SM> sms = sm_data();
for(SM p : sms)
index_uniqueness_sm(p);
for(SM& sm : sms)
{
assert(!CGAL::is_empty(sm));
// Add some garbage
CGAL::Euler::join_vertex(*(halfedges(sm).begin()), sm);
test_graph(sm);
// Test on a mesh with no internal index maps
Seam_edge_pmap seam_edges = sm.add_property_map<SM::Edge_index, bool>("e:on_seam", false).first;
Seam_vertex_pmap seam_vertices = sm.add_property_map<SM::Vertex_index, bool>("v:on_seam", false).first;
Seam_mesh seam_mesh(sm, seam_edges, seam_vertices);
test_initialized_index_maps(seam_mesh);
test_initialized_index_maps_const(seam_mesh);
}
#if defined(CGAL_USE_OPENMESH)
std::cout << "testing OpenMesh\n";
std::vector<OMesh> omeshs = omesh_data();
for(OMesh p : omeshs)
index_uniqueness_omesh(p);
for(OMesh& p : omeshs)
test_graph(p);
#endif
std::cout << "testing Triangulations\n";
index_uniqueness_tr(t2_data());
index_uniqueness_tr(dt2_data());
index_uniqueness_tr(rt2_data());
index_uniqueness_tr(ct2_data());
index_uniqueness_tr(cdt2_data());
index_uniqueness_tr(cdtp2_data());
index_uniqueness_tr(t2h_data());
std::cerr << "done\n";
return 0;
Triangulation_2 t2 = t2_data();
test_graph(t2);
Delaunay_triangulation_2 dt2 = dt2_data();
test_graph(dt2);
Regular_triangulation_2 rt2 = rt2_data();
test_graph(rt2);
Constrained_triangulation_2 ct2 = ct2_data();
test_graph(ct2);
Constrained_Delaunay_triangulation_2 cdt2 = cdt2_data();
test_graph(cdt2);
CDT_P2 cdtp2 = cdtp2_data();
test_graph(cdtp2);
Triangulation_hierarchy_2 t2h = t2h_data();
test_graph(t2h);
// no dynamic pmaps in triangulations (yet)
// Triangulation_no_id_2 t2_no_id = t2_no_id_data();
// test_initialized_index_maps(t2_no_id);
// test_initialized_index_maps_const(t2_no_id);
std::cout << "Done!" << std::endl;
return EXIT_SUCCESS;
}

View File

@ -94,6 +94,8 @@ void test(const NamedParameters& np)
assert(get_parameter(np, CGAL::internal_np::area_threshold).v == 57);
assert(get_parameter(np, CGAL::internal_np::volume_threshold).v == 58);
assert(get_parameter(np, CGAL::internal_np::dry_run).v == 59);
assert(get_parameter(np, CGAL::internal_np::do_lock_mesh).v == 60);
assert(get_parameter(np, CGAL::internal_np::do_simplify_border).v == 61);
// Named parameters that we use in the package 'Surface Mesh Simplification'
assert(get_parameter(np, CGAL::internal_np::get_cost_policy).v == 34);
@ -181,6 +183,8 @@ void test(const NamedParameters& np)
check_same_type<57>(get_parameter(np, CGAL::internal_np::area_threshold));
check_same_type<58>(get_parameter(np, CGAL::internal_np::volume_threshold));
check_same_type<59>(get_parameter(np, CGAL::internal_np::dry_run));
check_same_type<60>(get_parameter(np, CGAL::internal_np::do_lock_mesh));
check_same_type<61>(get_parameter(np, CGAL::internal_np::do_simplify_border));
// Named parameters that we use in the package 'Surface Mesh Simplification'
check_same_type<34>(get_parameter(np, CGAL::internal_np::get_cost_policy));
@ -274,6 +278,8 @@ int main()
.area_threshold(A<57>(57))
.volume_threshold(A<58>(58))
.dry_run(A<59>(59))
.do_lock_mesh(A<60>(60))
.do_simplify_border(A<61>(61))
);
return EXIT_SUCCESS;

View File

@ -8,15 +8,16 @@ if ( CGAL_FOUND )
# Use Eigen
find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater)
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
endif()
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})
if(NOT (${cppfile} STREQUAL "ellipsoid.cpp") OR EIGEN3_FOUND)
create_single_source_cgal_program( "${cppfile}" )
if (EIGEN3_FOUND)
get_filename_component(target ${cppfile} NAME_WE)
CGAL_target_use_Eigen(${target})
endif()
endif()
endforeach()

View File

@ -14,15 +14,16 @@ if ( CGAL_FOUND )
# Use Eigen
find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater)
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
endif()
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})
if(NOT (${cppfile} STREQUAL "Approximate_min_ellipsoid_d.cpp") OR EIGEN3_FOUND)
create_single_source_cgal_program( "${cppfile}" )
if (EIGEN3_FOUND)
get_filename_component(target ${cppfile} NAME_WE)
CGAL_target_use_Eigen(${target})
endif()
endif()
endforeach()

View File

@ -76,6 +76,10 @@ read_vtk_image_data(vtkImageData* vtk_image, Image_3::Own owning = Image_3::OWN_
image->wdim = imageio_type.wdim;
image->wordKind = imageio_type.wordKind;
image->sign = imageio_type.sign;
if (!vtk_image->GetPointData() || !vtk_image->GetPointData()->GetScalars()) {
::_freeImage(image);
return Image_3();
}
CGAL_assertion(vtk_image->GetPointData()->GetScalars()->GetNumberOfTuples() == dims[0]*dims[1]*dims[2]);
if(owning == Image_3::OWN_THE_DATA) {
image->data = ::ImageIO_alloc(dims[0]*dims[1]*dims[2]*image->wdim);

View File

@ -27,9 +27,7 @@ if ( CGAL_FOUND )
include(${CGAL_USE_FILE})
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
else()
if (NOT EIGEN3_FOUND)
message(STATUS "NOTICE: This project requires the Eigen library, and will not be compiled.")
return()
endif()
@ -143,6 +141,7 @@ if ( CGAL_FOUND )
add_library(CGAL_${IPELET} MODULE ${IPELET}.cpp)
add_to_cached_list(CGAL_EXECUTABLE_TARGETS CGAL_${IPELET})
target_link_libraries(CGAL_${IPELET} PRIVATE CGAL::CGAL ${IPE_LIBRARIES})
CGAL_target_use_Eigen(CGAL_${IPELET})
if ( IPELET_INSTALL_DIR )
install(TARGETS CGAL_${IPELET} DESTINATION ${IPELET_INSTALL_DIR})
if (WITH_IPE_7)
@ -153,12 +152,13 @@ if ( CGAL_FOUND )
endforeach(IPELET)
if(CGAL_Core_FOUND)
target_link_libraries(CGAL_cone_spanners PRIVATE CGAL::CGAL_Core)
CGAL_target_use_Eigen(CGAL_cone_spanners)
endif()
#example in doc not installed
add_library(simple_triangulation MODULE simple_triangulation.cpp)
add_to_cached_list(CGAL_EXECUTABLE_TARGETS simple_triangulation)
target_link_libraries(simple_triangulation ${IPE_LIBRARIES})
CGAL_target_use_Eigen(simple_triangulation)
cgal_add_compilation_test(simple_triangulation)
else()

View File

@ -50,6 +50,15 @@ public:
PointC2(const FT &hx, const FT &hy, const FT &hw)
: base(hx, hy, hw) {}
friend void swap(Self& a, Self& b)
#ifdef __cpp_lib_is_swappable
noexcept(std::is_nothrow_swappable_v<Vector_2_>)
#endif
{
using std::swap;
swap(a.base, b.base);
}
const FT& x() const
{
return base.x();

View File

@ -24,6 +24,7 @@ namespace CGAL {
template < class R_ >
class PointC3
{
typedef PointC3<R_> Self;
typedef typename R_::Vector_3 Vector_3;
typedef typename R_::Point_3 Point_3;
typedef typename R_::Aff_transformation_3 Aff_transformation_3;
@ -47,6 +48,15 @@ public:
PointC3(const FT &x, const FT &y, const FT &z, const FT &w)
: base(x, y, z, w) {}
friend void swap(Self& a, Self& b)
#ifdef __cpp_lib_is_swappable
noexcept(std::is_nothrow_swappable_v<Vector_3>)
#endif
{
using std::swap;
swap(a.base, b.base);
}
const FT & x() const
{
return base.x();

View File

@ -27,6 +27,7 @@ namespace CGAL {
template < class R_ >
class VectorC2
{
typedef VectorC2<R_> Self;
typedef typename R_::FT FT;
typedef typename R_::Point_2 Point_2;
typedef typename R_::Vector_2 Vector_2;
@ -55,6 +56,15 @@ public:
: base( hw != FT(1) ? CGAL::make_array<FT>(hx/hw, hy/hw)
: CGAL::make_array(hx, hy) ) {}
friend void swap(Self& a, Self& b)
#ifdef __cpp_lib_is_swappable
noexcept(std::is_nothrow_swappable_v<Base>)
#endif
{
using std::swap;
swap(a.base, b.base);
}
const FT & x() const
{
return CGAL::get_pointee_or_identity(base)[0];

View File

@ -27,6 +27,7 @@ template < class R_ >
class VectorC3
{
// https://doc.cgal.org/latest/Manual/devman_code_format.html#secprogramming_conventions
typedef VectorC3<R_> Self;
typedef typename R_::FT FT_;
typedef typename R_::Point_3 Point_3;
typedef typename R_::Vector_3 Vector_3;
@ -70,6 +71,15 @@ public:
: base( w != FT_(1) ? CGAL::make_array<FT_>(x/w, y/w, z/w)
: CGAL::make_array(x, y, z) ) {}
friend void swap(Self& a, Self& b)
#ifdef __cpp_lib_is_swappable
noexcept(std::is_nothrow_swappable_v<Base>)
#endif
{
using std::swap;
swap(a.base, b.base);
}
const FT_ & x() const
{
return get_pointee_or_identity(base)[0];

View File

@ -5,7 +5,6 @@ cmake_minimum_required(VERSION 3.1...3.15)
project( Classification_Examples )
# CGAL and its components
find_package( CGAL QUIET COMPONENTS )
@ -22,127 +21,73 @@ if ( NOT Boost_FOUND )
return()
endif()
find_package( Boost OPTIONAL_COMPONENTS serialization iostreams )
set(Classification_dependencies_met TRUE)
if( WIN32 )
# to avoid a warning with old cmake
set(_Boost_BZIP2_HEADERS "boost/iostreams/filter/bzip2.hpp")
set(_Boost_ZLIB_HEADERS "boost/iostreams/filter/zlib.hpp")
find_package( Boost OPTIONAL_COMPONENTS bzip2 zlib)
else()
find_package(ZLIB QUIET)
find_package( Boost OPTIONAL_COMPONENTS serialization iostreams )
if (NOT Boost_SERIALIZATION_FOUND)
message(STATUS "NOTICE: This project requires Boost Serialization, and will not be compiled.")
set(Classification_dependencies_met FALSE)
endif()
if (NOT Boost_IOSTREAMS_FOUND)
message(STATUS "NOTICE: This project requires Boost IO Streams, and will not be compiled.")
set(Classification_dependencies_met FALSE)
endif()
find_package(OpenCV QUIET COMPONENTS core ml) # Need core + machine learning
if (NOT OpenCV_FOUND)
message(STATUS "NOTICE: OpenCV was not found. OpenCV random forest predicate for classification won't be available.")
endif()
find_package(TensorFlow QUIET)
if (NOT TensorFlow_FOUND)
message(STATUS "NOTICE: TensorFlow was not found. TensorFlow neural network predicate for classification won't be available.")
endif()
find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater)
if (NOT EIGEN3_FOUND)
message(STATUS "This project requires the Eigen library, and will not be compiled.")
set(Classification_dependencies_met FALSE)
endif()
find_package(TBB QUIET)
find_package(OpenCV QUIET COMPONENTS core ml) # Need core + machine learning
# Use Eigen
find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater)
if (NOT EIGEN3_FOUND)
message(STATUS "This project requires the Eigen library, and will not be compiled.")
return()
else()
include( ${EIGEN3_USE_FILE} )
endif()
# Creating entries for all C++ files with "main" routine
# ##########################################################
# Classification examples
set(targets
example_classification
example_ethz_random_forest
example_feature
example_generation_and_training
example_mesh_classification
example_cluster_classification)
# Classification requires some C++11 features
set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates)
# Libraries and flags
set(classification_linked_libraries)
set(classification_compile_definitions)
if (Boost_SERIALIZATION_FOUND AND Boost_IOSTREAMS_FOUND)
if(TARGET Boost::serialization AND TARGET Boost::iostreams)
set(classification_linked_libraries Boost::serialization Boost::iostreams)
else()
set(classification_linked_libraries ${classification_linked_libraries}
${Boost_SERIALIZATION_LIBRARY}
${Boost_IOSTREAMS_LIBRARY})
endif()
else()
if (NOT Boost_SERIALIZATION_FOUND)
message(STATUS "NOTICE: This project requires Boost Serialization, and will not be compiled.")
endif()
if (NOT Boost_IOSTREAMS_FOUND)
message(STATUS "NOTICE: This project requires Boost IO Streams, and will not be compiled.")
endif()
if (NOT Classification_dependencies_met)
return()
endif()
if( WIN32 )
if (Boost_ZLIB_FOUND AND Boost_BZIP2_FOUND)
set(classification_linked_libraries ${classification_linked_libraries}
${Boost_ZLIB_LIBRARY} ${Boost_BZIP2_LIBRARY})
else()
message(STATUS "NOTICE: This project requires Boost ZLIB and Boost BZIP2, and will not be compiled.")
return()
endif()
else()
if(ZLIB_FOUND)
set(classification_linked_libraries ${classification_linked_libraries} ZLIB::ZLIB)
else()
message(STATUS "NOTICE: This project requires ZLIB, and will not be compiled.")
return()
endif()
endif()
create_single_source_cgal_program( "example_classification.cpp" )
create_single_source_cgal_program( "example_ethz_random_forest.cpp" )
create_single_source_cgal_program( "example_feature.cpp" )
create_single_source_cgal_program( "example_generation_and_training.cpp" )
create_single_source_cgal_program( "example_mesh_classification.cpp" )
create_single_source_cgal_program( "example_cluster_classification.cpp" )
if (OpenCV_FOUND)
message(STATUS "Found OpenCV ${OpenCV_VERSION}")
include_directories(${OpenCV_INCLUDE_DIRS})
set(classification_linked_libraries ${classification_linked_libraries}
${OpenCV_LIBS})
set(classification_compile_definitions ${classification_compile_definitions}
"-DCGAL_LINKED_WITH_OPENCV")
set(targets ${targets} example_opencv_random_forest)
else()
message(STATUS "NOTICE: OpenCV was not found. OpenCV random forest predicate for classification won't be available.")
create_single_source_cgal_program( "example_opencv_random_forest.cpp" )
CGAL_target_use_OpenCV(example_opencv_random_forest)
endif()
find_package(TensorFlow QUIET)
if (TensorFlow_FOUND)
message(STATUS "Found TensorFlow")
include_directories( ${TensorFlow_INCLUDE_DIR} )
set(classification_linked_libraries ${classification_linked_libraries}
${TensorFlow_LIBRARY})
set(classification_compile_definitions ${classification_compile_definitions}
"-DCGAL_LINKED_WITH_TENSORFLOW")
set(targets ${targets} example_tensorflow_neural_network)
else()
message(STATUS "NOTICE: TensorFlow not found, Neural Network predicate for classification won't be available.")
create_single_source_cgal_program( "example_tensorflow_neural_network.cpp" )
CGAL_target_use_TensorFlow(example_tensorflow_neural_network)
endif()
# Creating targets with correct libraries and flags
foreach(target ${targets})
create_single_source_cgal_program( "${target}.cpp" CXX_FEATURES ${needed_cxx_features} )
foreach(target
example_classification
example_ethz_random_forest
example_feature
example_generation_and_training
example_mesh_classification
example_cluster_classification
example_opencv_random_forest
example_tensorflow_neural_network)
if(TARGET ${target})
target_link_libraries(${target} PUBLIC ${classification_linked_libraries})
target_compile_definitions(${target} PUBLIC ${classification_compile_definitions})
CGAL_target_use_Eigen(${target})
CGAL_target_use_Boost_IOStreams(${target})
CGAL_target_use_Boost_Serialization(${target})
if(TBB_FOUND)
CGAL_target_use_TBB(${target})
endif()
endif()
endforeach()

View File

@ -5,7 +5,6 @@ cmake_minimum_required(VERSION 3.1...3.15)
project( Classification_Tests )
# CGAL and its components
find_package( CGAL QUIET COMPONENTS )
@ -22,88 +21,39 @@ if ( NOT Boost_FOUND )
return()
endif()
set(Classification_dependencies_met TRUE)
find_package( Boost OPTIONAL_COMPONENTS serialization iostreams )
if( WIN32 )
# to avoid a warning with old cmake
set(_Boost_BZIP2_HEADERS "boost/iostreams/filter/bzip2.hpp")
set(_Boost_ZLIB_HEADERS "boost/iostreams/filter/zlib.hpp")
find_package( Boost OPTIONAL_COMPONENTS bzip2 zlib)
else()
find_package(ZLIB QUIET)
if (NOT Boost_SERIALIZATION_FOUND)
message(STATUS "NOTICE: This project requires Boost Serialization, and will not be compiled.")
set(Classification_dependencies_met FALSE)
endif()
if (NOT Boost_IOSTREAMS_FOUND)
message(STATUS "NOTICE: This project requires Boost IO Streams, and will not be compiled.")
set(Classification_dependencies_met FALSE)
endif()
# Use Eigen
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
find_package(Eigen3 3.1.0 REQUIRED) #(3.1.0 or greater)
if (NOT EIGEN3_FOUND)
message(STATUS "This project requires the Eigen library, and will not be compiled.")
set(Classification_dependencies_met FALSE)
endif()
find_package( TBB )
find_package(TBB QUIET)
# include for local directory
include_directories( BEFORE include )
# include for local package
# Creating entries for all C++ files with "main" routine
# ##########################################################
#add_definitions("-DCGAL_DO_NOT_USE_BOYKOV_KOLMOGOROV_MAXFLOW_SOFTWARE")
# Classification requires some C++11 features
set(needed_cxx_features cxx_rvalue_references cxx_variadic_templates)
# Libraries and flags
set(classification_linked_libraries)
if (Boost_SERIALIZATION_FOUND AND Boost_IOSTREAMS_FOUND)
if(TARGET Boost::serialization AND TARGET Boost::iostreams)
set(classification_linked_libraries Boost::serialization Boost::iostreams)
else()
set(classification_linked_libraries ${classification_linked_libraries}
${Boost_SERIALIZATION_LIBRARY}
${Boost_IOSTREAMS_LIBRARY})
endif()
else()
if (NOT Boost_SERIALIZATION_FOUND)
message(STATUS "NOTICE: This project requires Boost Serialization, and will not be compiled.")
endif()
if (NOT Boost_IOSTREAMS_FOUND)
message(STATUS "NOTICE: This project requires Boost IO Streams, and will not be compiled.")
endif()
if (NOT Classification_dependencies_met)
return()
endif()
if( WIN32 )
if (Boost_ZLIB_FOUND AND Boost_BZIP2_FOUND)
set(classification_linked_libraries ${classification_linked_libraries}
${Boost_ZLIB_LIBRARY} ${Boost_BZIP2_LIBRARY})
else()
message(STATUS "NOTICE: This project requires Boost ZLIB and Boost BZIP2, and will not be compiled.")
return()
endif()
else()
if(ZLIB_FOUND)
set(classification_linked_libraries ${classification_linked_libraries} ZLIB::ZLIB)
else()
message(STATUS "NOTICE: This project requires ZLIB, and will not be compiled.")
return()
endif()
endif()
create_single_source_cgal_program( "test_classification_point_set.cpp" )
create_single_source_cgal_program( "test_classification_io.cpp" )
create_single_source_cgal_program( "test_classification_point_set.cpp" CXX_FEATURES ${needed_cxx_features} )
if(TARGET test_classification_point_set)
target_link_libraries(test_classification_point_set PUBLIC ${classification_linked_libraries})
if (TBB_FOUND)
CGAL_target_use_TBB( test_classification_point_set )
foreach(target test_classification_point_set test_classification_io)
CGAL_target_use_Eigen(${target})
CGAL_target_use_Boost_IOStreams(${target})
CGAL_target_use_Boost_Serialization(${target})
if(TBB_FOUND)
CGAL_target_use_TBB(${target})
endif()
endif()
endforeach()
create_single_source_cgal_program( "test_classification_io.cpp" CXX_FEATURES ${needed_cxx_features} )
if(TARGET test_classification_io)
target_link_libraries(test_classification_io PUBLIC ${classification_linked_libraries})
if (TBB_FOUND)
CGAL_target_use_TBB( test_classification_io )
endif()
endif()

View File

@ -21,7 +21,7 @@ is a kernel with exact predicates but inexact constructions
(in practice we check `R::Has_filtered_predicates_tag` is `Tag_true` and `R::FT` is a floating point type),
then the default traits class of `::convex_hull_3()` is `Convex_hull_traits_3<R>`, and `R` otherwise.
\attention The user must include the header file of the `Polygon_mesh` type.
\attention The user must include the header file of the `PolygonMesh` type.
\cgalHeading{Implementation}
@ -34,6 +34,36 @@ Barnard <I>et al.</I> \cgalCite{bdh-qach-96}.
template <class InputIterator, class PolygonMesh, class Traits>
void convex_hull_3(InputIterator first, InputIterator last, PolygonMesh& pm, const Traits& ch_traits = Default_traits);
/*!
\ingroup PkgConvexHull3Functions
* \brief computes the convex hull of the points associated to the vertices of `g`.
* The polygon mesh `pm` is cleared, then
* the convex hull is stored in `pm`. Note that the convex hull will be triangulated,
* that is `pm` will contain only triangular faces.
* if the convex hull is a point or a segment, endpoints will be added in `pm` as isolated vertices.
*
* \tparam VertexListGraph a model of `VertexListGraph`.
* \tparam PolygonMesh must be a model of `MutableFaceGraph`.
* \tparam NamedParameters a sequence of named parameters
*
* \param g the graph
* \param pm the `PolygonMesh` that will contain the convex hull
* \param np optional sequence of named parameters among the ones listed below
*
* \cgalNamedParamsBegin
* \cgalParamBegin{vertex_point_map} the property map with the points associated to the vertices of `g`.
* If this parameter is omitted, an internal property map for
* `CGAL::vertex_point_t` must be available in `VertexListGraph`
* \cgalParamEnd
* \cgalNamedParamsEnd
* \attention The user must include the header file of the `PolygonMesh` and `VertexListGraph` types.
*/
template <class VertexListGraph, class PolygonMesh, class NamedParameters>
void convex_hull_3(const VertexListGraph& g,
PolygonMesh& pm,
const NamedParameters& np);
/*!
\ingroup PkgConvexHull3Functions
@ -47,7 +77,7 @@ that is the polygon mesh will contain only triangular facets.
\tparam Traits must be model of the concept `ConvexHullTraits_3`.
For the purposes of checking the postcondition that the convex hull
is valid, `Traits` must also be a model of the concept
`IsStronglyConvexTraits_3`. Furthermore, `Traits` must define a type `Polygon_mesh` that is a model of
`IsStronglyConvexTraits_3`. Furthermore, `Traits` must define a type `PolygonMesh` that is a model of
`MutableFaceGraph`.
If the kernel `R` of the points determined by the value type of `InputIterator`
@ -55,7 +85,7 @@ is a kernel with exact predicates but inexact constructions
(in practice we check `R::Has_filtered_predicates_tag` is `Tag_true` and `R::FT` is a floating point type),
then the default traits class of `convex_hull_3()` is `Convex_hull_traits_3<R>`, and `R` otherwise.
\attention The user must include the header file of the `Polygon_mesh` type.
\attention The user must include the header file of the `PolygonMesh` type.
*/
template <class InputIterator, class Traits>

View File

@ -1,3 +1,9 @@
@INCLUDE = ${CGAL_DOC_PACKAGE_DEFAULTS}
PROJECT_NAME = "CGAL ${CGAL_DOC_VERSION} - 3D Convex Hulls"
\# macros to be used inside the code
ALIASES += "cgalNamedParamsBegin=<dl class=\"params\"><dt>Named Parameters</dt><dd> <table class=\"params\">"
ALIASES += "cgalNamedParamsEnd=</table> </dd> </dl>"
ALIASES += "cgalParamBegin{1}=<tr><td class=\"paramname\">\ref BGL_\1 \"\1\"</td><td>"
ALIASES += "cgalParamEnd=</td></tr>"

View File

@ -54,6 +54,9 @@ create_single_source_cgal_program( "lloyd_algorithm.cpp" )
create_single_source_cgal_program( "quickhull_3.cpp" )
create_single_source_cgal_program( "graph_hull_3.cpp" )
create_single_source_cgal_program( "quickhull_any_dim_3.cpp" )
create_single_source_cgal_program( "extreme_points_3_sm.cpp" )

View File

@ -0,0 +1,31 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/convex_hull_3.h>
#include <vector>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_3 Point_3;
typedef CGAL::Surface_mesh<Point_3> Surface_mesh;
int main(int argc, char* argv[])
{
std::ifstream in( (argc>1)? argv[1] : "data/star.off");
Surface_mesh poly;
if(!(in >> poly))
{
std::cerr<<"Could not find input file."<<std::endl;
return 1;
}
Surface_mesh chull;
// compute convex hull
CGAL::convex_hull_3(poly, chull);
std::cout << "The convex hull contains " << chull.number_of_vertices() << " vertices" << std::endl;
return 0;
}

View File

@ -37,6 +37,7 @@
#include <memory>
#include <list>
#include <vector>
#include <type_traits>
#include <boost/bind.hpp>
#include <boost/next_prior.hpp>
#include <boost/type_traits/is_floating_point.hpp>
@ -49,6 +50,9 @@
#include <CGAL/boost/graph/properties_Triangulation_data_structure_2.h>
#include <CGAL/Polyhedron_3_fwd.h>
#include <CGAL/boost/graph/Euler_operations.h>
#include <CGAL/boost/iterator/transform_iterator.hpp>
#include <CGAL/boost/graph/named_params_helper.h>
#include <CGAL/is_iterator.h>
#include <boost/unordered_map.hpp>
@ -1036,7 +1040,10 @@ void convex_hull_3(InputIterator first, InputIterator beyond,
template <class InputIterator, class Polyhedron_3>
void convex_hull_3(InputIterator first, InputIterator beyond,
Polyhedron_3& polyhedron)
Polyhedron_3& polyhedron,
typename std::enable_if<
CGAL::is_iterator<InputIterator>::value
>::type* =0) //workaround to avoid ambiguity with next overload.
{
typedef typename std::iterator_traits<InputIterator>::value_type Point_3;
typedef typename internal::Convex_hull_3::Default_traits_for_Chull_3<Point_3, Polyhedron_3>::type Traits;
@ -1044,6 +1051,29 @@ void convex_hull_3(InputIterator first, InputIterator beyond,
}
template <class VertexListGraph, class PolygonMesh, class NamedParameters>
void convex_hull_3(const VertexListGraph& g,
PolygonMesh& pm,
const NamedParameters& np)
{
typedef typename GetVertexPointMap<VertexListGraph, NamedParameters>::const_type Vpmap;
typedef CGAL::Property_map_to_unary_function<Vpmap> Vpmap_fct;
Vpmap vpm = CGAL::parameters::choose_parameter(
CGAL::parameters::get_parameter(np, internal_np::vertex_point),
get_const_property_map(boost::vertex_point, g));
Vpmap_fct v2p(vpm);
convex_hull_3(boost::make_transform_iterator(vertices(g).begin(), v2p),
boost::make_transform_iterator(vertices(g).end(), v2p), pm);
}
template <class VertexListGraph, class PolygonMesh>
void convex_hull_3(const VertexListGraph& g,
PolygonMesh& pm)
{
convex_hull_3(g,pm,CGAL::parameters::all_default());
}
template <class InputRange, class OutputIterator, class Traits>
OutputIterator
extreme_points_3(const InputRange& range,

View File

@ -0,0 +1,32 @@
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/convex_hull_3.h>
#include <vector>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Polyhedron_3<K> Polyhedron_3;
typedef K::Point_3 Point_3;
typedef CGAL::Surface_mesh<Point_3> Surface_mesh;
int main(int argc, char* argv[])
{
std::ifstream in( (argc>1)? argv[1] : "data/cross.off");
Surface_mesh poly;
if(!in || !(in >> poly))
{
std::cerr<<"Could not find a correct input file."<<std::endl;
return 1;
}
Surface_mesh chull;
// compute convex hull
auto np = CGAL::parameters::all_default();
CGAL::convex_hull_3(poly, chull, np);
std::cout << "The convex hull contains " << chull.number_of_vertices() << " vertices" << std::endl;
return 0;
}

View File

@ -126,10 +126,14 @@ The exhaustive list of \sc{Qt}5 components used in demos is:
\sc{Eigen} is a `C++` template library for linear algebra. \sc{Eigen} supports all
matrix sizes, various matrix decomposition methods and sparse linear solvers.
In \cgal, \sc{Eigen} is used in many packages such as \ref PkgPoissonSurfaceReconstruction3
or \ref PkgJetFitting3, providing sparse linear solvers and singular value decompositions.
A package dependency over \sc{Eigen} is marked on the
<a href="https://doc.cgal.org/latest/Manual/packages.html">Package Overview</a> page.
In \cgal, \sc{Eigen} is used in many packages such as \ref
PkgPoissonSurfaceReconstruction3 or \ref PkgJetFitting3, providing
sparse linear solvers and singular value decompositions. A package
dependency over \sc{Eigen} is marked on the <a
href="https://doc.cgal.org/latest/Manual/packages.html">Package
Overview</a> page. In order to use Eigen in \cgal programs, the
provided CMake function `CGAL_target_use_Eigen(<target>)` should be
used.
The \sc{Eigen} web site is <A HREF="http://eigen.tuxfamily.org/index.php?title=Main_Page">`http://eigen.tuxfamily.org`</A>.
@ -194,7 +198,9 @@ It can be downloaded from <A HREF="http://esbtl.sourceforge.net/">`http://esbtl.
\sc{Tbb} (Threading Building Blocks) is a library developed by Intel Corporation for writing software
programs that take advantage of multi-core processors.
In \cgal, \sc{Tbb} is used by the packages that offer parallel code.
In \cgal, \sc{Tbb} is used by the packages that offer parallel
code. In order to use \sc{Tbb} in \cgal programs, the provided CMake
function `CGAL_target_use_TBB(<target>)` should be used.
The \sc{Tbb} web site is <A HREF="https://www.threadingbuildingblocks.org">`https://www.threadingbuildingblocks.org`</A>.
@ -204,7 +210,9 @@ The \sc{Tbb} web site is <A HREF="https://www.threadingbuildingblocks.org">`http
the LAS format (or the compressed LAZ format).
In \cgal, \sc{LASlib} is used to provide input and output functions in
the \ref PkgPointSetProcessing3 package.
the \ref PkgPointSetProcessing3 package. In order to use \sc{LASlib} in
\cgal programs, the provided CMake function
`CGAL_target_use_LASLIB(<target>)` should be used.
The \sc{LASlib} web site is <a
href="https://rapidlasso.com/lastools/">`https://rapidlasso.com/lastools/`</a>. \sc{LASlib}
@ -217,7 +225,9 @@ CMake based install procedure</a>.
\sc{OpenCV} (Open Computer Vision) is a library designed for computer
vision, computer graphics and machine learning.
In \cgal, \sc{OpenCV} is used by the \ref PkgClassification package.
In \cgal, \sc{OpenCV} is used by the \ref PkgClassification
package. In order to use \sc{OpenCV} in \cgal programs, the provided
CMake function `CGAL_target_use_OpenCV(<target>)` should be used.
The \sc{OpenCV} web site is <A HREF="https://opencv.org/">`https://opencv.org/`</A>.
@ -235,6 +245,9 @@ enable and compile the following targets:
- `tensorflow_BUILD_PYTHON_BINDINGS`
- `tensorflow_BUILD_SHARED_LIB`.
In order to use \sc{TensorFlow} in \cgal programs, the provided CMake
function `CGAL_target_use_TensorFlow(<target>)` should be used.
The \sc{TensorFlow} web site is <A HREF="https://www.tensorflow.org/">`https://www.tensorflow.org/`</A>.
\subsection thirdpartyMETIS METIS
@ -274,7 +287,10 @@ for more information.
\sc{GLPK} (GNU Linear Programming Kit) is a library for solving linear programming (LP), mixed integer programming (MIP), and other related problems.
In \cgal, \sc{GLPK} provides an optional linear integer program solver in the \ref PkgPolygonalSurfaceReconstruction package.
In \cgal, \sc{GLPK} provides an optional linear integer program solver
in the \ref PkgPolygonalSurfaceReconstruction package. In order to use
\sc{GLPK} in \cgal programs, the provided CMake function
`CGAL_target_use_GLPK(<target>)` should be used.
The \sc{GLPK} web site is <A HREF="https://www.gnu.org/software/glpk/">`https://www.gnu.org/software/glpk/`</A>.
@ -282,7 +298,10 @@ The \sc{GLPK} web site is <A HREF="https://www.gnu.org/software/glpk/">`https://
\sc{SCIP} (Solving Constraint Integer Programs) is currently one of the fastest open source solvers for mixed integer programming (MIP) and mixed integer nonlinear programming (MINLP).
In \cgal, \sc{SCIP} provides an optional linear integer program solver in the \ref PkgPolygonalSurfaceReconstruction package.
In \cgal, \sc{SCIP} provides an optional linear integer program solver
in the \ref PkgPolygonalSurfaceReconstruction package. In order to use
\sc{SCIP} in \cgal programs, the provided CMake function
`CGAL_target_use_SCIP(<target>)` should be used.
The \sc{SCIP} web site is <A HREF="http://scip.zib.de/">`http://scip.zib.de/`</A>.

View File

@ -60,6 +60,12 @@ On most operating systems, package managers offer \cgal and its essential third
On macOS, we recommend using of <a href="https://brew.sh/">Homebrew</a> in the following way:
brew install cgal
brew install cgal-qt5 #(only for GUI)
You should check that cgal and cgal-qt5 are correctly "linked", especially when upgrading from an old version. If not, run the following command:
brew link cgal
brew link cgal-qt5 #(if you installed it)
On Linux distributions such as `Debian`/`Ubuntu`/`Mint`, use `apt-get` in the following way:
@ -148,10 +154,14 @@ The variable `CGAL_DIR` is also generally found when \cgal has been obtained via
In the rare event that it has not, the variable `CGAL_DIR` should be set manually to:
<ul>
<li>something like `/usr/local/Cellar/cgal/CGAL-\cgalReleaseNumber/lib/cmake/CGAL`, for Brew.</li>
<li>something like `/usr/local/opt/cgal/lib/cmake/CGAL`, for Brew.</li>
<li>something like `/usr/lib/x86_64-linux-gnu/cmake/CGAL`, for Linux distributions.</li>
</ul>
Note that you can also use `CMAKE_PREFIX_PATH` to point to a directory that contains all dependencies, like so:
cmake -DCMAKE_PREFIX_PATH=/my/custom/brew/installation/dir -DCMAKE_BUILD_TYPE=Release .
If \cgal has been obtained via other means, `CGAL_DIR` must point to the root directory
of the \cgal source code (either the root of the unpacked release tarball or the root
of the Git working directory).
@ -162,6 +172,13 @@ if no debugging is intended. Users should thus run:
cd CGAL-\cgalReleaseNumber/examples/Triangulation_2
cmake -DCGAL_DIR=$HOME/CGAL-\cgalReleaseNumber -DCMAKE_BUILD_TYPE=Release . # we are here using a release tarball
Note that the package Qt on brew is "keg-only", which means it cannot be "linked" with brew.
You will have to specify the Qt5_DIR by hand to cmake, using something like
-DQt5_DIR=/usr/local/opt/qt/lib/cmake/Qt5
where '/usr/local/` is actually your current brew installation directory.
\subsection usage_configuring_cmake_gui Specifying Missing Dependencies
The configuration process launched above might fail if CMake fails to find

View File

@ -85,6 +85,7 @@ and will serverly limit performances.
| Variable | Description | Type | %Default Value |
| :- | :- | :- | :- |
| `CGAL_DIR` | Full-path to the binary directory where \cgal was configured |Either CMake or Environment | none |
| `Qt5_DIR` | Full-path to the Qt cmake directory |CMake| platform-dependent|
\subsection installation_variables_third_party Variables Providing Information About 3rd-Party Libraries
@ -300,6 +301,20 @@ environment variable is sufficient.
| `ESBTL_INC_DIR` | Directory containing the `ESBTL/default.h` file | Environment |
| `ESBTL_INCLUDE_DIR` | Directory containing the `ESBTL/default.h` file | CMake |
\subsection installation_metis METIS Library
Some BGL examples require the \sc{Metis} library in order to partition \sc{Metis} meshes.
If \sc{Metis} is not automatically found, setting the `METIS_INCLUDE_DIR` and `METIS_LIBRARY`
cmake variables is necessary.
| Variable | Description | Type |
| :- | :- | :- |
| `METIS_INCLUDE_DIR` | Directory of \sc{Metis} default installation | CMAKE |
| `METIS_LIBRARY` | Directory containing the `libmetis.so or .lib` file | CMAKE |
\subsection installation_tbb TBB Library
If \sc{Tbb} is not automatically found, the user must set the `TBB_ROOT`
@ -324,6 +339,44 @@ Note that the variables in the table below are being used.
| `TBB_MALLOCPROXY_DEBUG_LIBRARY` | Full pathname of the compiled TBB debug malloc_proxy library (optional) | CMake |
| `TBB_MALLOCPROXY_RELEASE_LIBRARY` | Full pathname of the compiled TBB release malloc_proxy library (optional) | CMake |
\subsection installation_laslib LASlib library
If LASLIB is not automatically found, the following variables must be set:
| Variable | Description | Type |
| :- | :- | :- |
| `LASLIB_INCLUDE_DIR` | Directory containing the file `lasreader.hpp` | CMake |
| `LASZIP_INCLUDE_DIR` | Directory containing the file `mydefs.hpp` | CMake |
| `LASLIB_LIBRARIES` | Full pathname of the compiled LASLIB library | CMake |
\subsection installation_OpenCV OpenCV library
The environment variable `OPENCV_DIR` should be set to the directory
containing the file `OpenCVConfig.cmake` provided by OpenCV.
\subsection installation_TensorFlow TensorFlow library
If TensorFlow is not automatically found, the following variables must be set:
| Variable | Description | Type |
| :- | :- | :- |
| `TensorFlow_INCLUDE_DIR` | Directory containing the directories `tensorflow/core`, `tensorflow/cc`, etc. | CMake |
| `TensorFlow_LIBRARY` | Full pathname of the compiled TensorFlow C++ library | CMake |
\subsection installation_SCIP SCIP library
The environment variable `SCIP_DIR` should be set to the directory
containing the file `scip-config.cmake` provided by SCIP.
\subsection installation_GLPK GLPK library
If GLPK is not automatically found, the following variables must be set:
| Variable | Description | Type |
| :- | :- | :- |
| `GLPK_INCLUDE_DIR` | Directory containing the file `glpk.h` | CMake |
| `GLPK_LIBRARIES` | Full pathname of the compiled GLPK library | CMake |
\section installation_compiler_workarounds Compiler Workarounds
A number of boolean flags are used to workaround compiler bugs and

View File

@ -37,8 +37,8 @@ The first step is to clone or download `vcpkg` from
By default `vcpkg` installs for 32 bit binaries and will use the latest version of Visual C++
installed on your machine. If you develop 64 bit software you must
set the Windows environment variable `VCPKG_DEFAULT_TRIPLE` to `x64-windows`
or pass the option `--triplet x64-windows` whenever you install a package.
set the Windows environment variable `VCPKG_DEFAULT_TRIPLET` to `x64-windows`
or add the suffix `:x64-windows` to the package name you want to install (for example `cgal:x64-windows`).
We refer to the
<a href="https://github.com/microsoft/vcpkg/blob/master/docs/examples/installing-and-using-packages.md#step-2-use">official documentation</a>
of `vcpkg` if you want to compile for an older version of a compiler.

View File

@ -3,12 +3,12 @@
var url_re = /(cgal\.geometryfactory\.com\/CGAL\/doc\/|doc\.cgal\.org\/)(master|latest|(\d\.\d+|\d\.\d+\.\d+))\//;
var url_local = /.*\/doc_output\//;
var current_version_local = '5.0.1'
var current_version_local = '5.1-dev'
var all_versions = [
'master',
'latest',
'5.0.1',
'4.14.2',
'5.0.2',
'4.14.3',
'4.13.2',
'4.12.2',
'4.11.3',

View File

@ -3,12 +3,12 @@
var url_re = /(cgal\.geometryfactory\.com\/CGAL\/doc\/|doc\.cgal\.org\/)(master|latest|(\d\.\d+|\d\.\d+\.\d+))\//;
var url_local = /.*\/doc_output\//;
var current_version_local = '5.0.1'
var current_version_local = '5.1-dev'
var all_versions = [
'master',
'latest',
'5.0.1',
'4.14.2',
'5.0.2',
'4.14.3',
'4.13.2',
'4.12.2',
'4.11.3',

View File

@ -3,12 +3,12 @@
var url_re = /(cgal\.geometryfactory\.com\/CGAL\/doc\/|doc\.cgal\.org\/)(master|latest|(\d\.\d+|\d\.\d+\.\d+))\//;
var url_local = /.*\/doc_output\//;
var current_version_local = '5.0.1'
var current_version_local = '5.1-dev'
var all_versions = [
'master',
'latest',
'5.0.1',
'4.14.2',
'5.0.2',
'4.14.3',
'4.13.2',
'4.12.2',
'4.11.3',

View File

@ -34,77 +34,13 @@ struct Primitive_profiler
Primitive_profiler(const P& p = P())
: P(p) {}
template <class A1>
template <class ... A>
result_type
operator()(const A1 &a1) const
operator()(A&& ... a) const
{
CGAL_KERNEL_PROFILER;
return P::operator()(a1);
return P::operator()(std::forward<A>(a)...);
}
template <class A1, class A2>
result_type
operator()(const A1 &a1, const A2 &a2) const
{
CGAL_KERNEL_PROFILER;
return P::operator()(a1, a2);
}
template <class A1, class A2, class A3>
result_type
operator()(const A1 &a1, const A2 &a2, const A3 &a3) const
{
CGAL_KERNEL_PROFILER;
return P::operator()(a1, a2, a3);
}
template <class A1, class A2, class A3, class A4>
result_type
operator()(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4) const
{
CGAL_KERNEL_PROFILER;
return P::operator()(a1, a2, a3, a4);
}
template <class A1, class A2, class A3, class A4, class A5>
result_type
operator()(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4,
const A5 &a5) const
{
CGAL_KERNEL_PROFILER;
return P::operator()(a1, a2, a3, a4, a5);
}
template <class A1, class A2, class A3, class A4, class A5, class A6>
result_type
operator()(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4,
const A5 &a5, const A6 &a6) const
{
CGAL_KERNEL_PROFILER;
return P::operator()(a1, a2, a3, a4, a5, a6);
}
template <class A1, class A2, class A3, class A4,
class A5, class A6, class A7>
result_type
operator()(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4,
const A5 &a5, const A6 &a6, const A7 &a7) const
{
CGAL_KERNEL_PROFILER;
return P::operator()(a1, a2, a3, a4, a5, a6, a7);
}
template <class A1, class A2, class A3, class A4,
class A5, class A6, class A7, class A8>
result_type
operator()(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4,
const A5 &a5, const A6 &a6, const A7 &a7, const A8 &a8) const
{
CGAL_KERNEL_PROFILER;
return P::operator()(a1, a2, a3, a4, a5, a6, a7, a8);
}
// ...
};
// We inherit all geometric objects from K, and just replace the primitives.

View File

@ -731,6 +731,9 @@ public :
PTR = new Lazy_rep_0<AT,ET,E2A>(std::move(e));
}
friend void swap(Lazy& a, Lazy& b) noexcept
{ swap(static_cast<Handle&>(a), static_cast<Handle&>(b)); }
const AT& approx() const
{ return ptr()->approx(); }

View File

@ -12,9 +12,6 @@ if ( CGAL_FOUND )
# Use Eigen
find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater)
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
endif()
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
@ -23,6 +20,10 @@ if ( CGAL_FOUND )
OR NOT (${cppfile} STREQUAL "random_points_on_tetrahedral_mesh_3.cpp")
OR EIGEN3_FOUND)
create_single_source_cgal_program( "${cppfile}" )
if (EIGEN3_FOUND)
get_filename_component(target ${cppfile} NAME_WE)
CGAL_target_use_Eigen(${target})
endif()
endif()
endforeach()

View File

@ -12,15 +12,16 @@ if ( CGAL_FOUND )
# Use Eigen
find_package(Eigen3 3.1.0 QUIET) #(3.1.0 or greater)
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
endif()
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})
if(NOT (${cppfile} STREQUAL "generic_random_test.cpp") OR EIGEN3_FOUND)
create_single_source_cgal_program( "${cppfile}" )
if (EIGEN3_FOUND)
get_filename_component(target ${cppfile} NAME_WE)
CGAL_target_use_Eigen(${target})
endif()
endif()
endforeach()

View File

@ -16,9 +16,7 @@ endif()
find_package(CGAL COMPONENTS Qt5 Core)
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
else()
if (NOT EIGEN3_FOUND)
message(STATUS "NOTICE: This project requires the Eigen library, and will not be compiled.")
return()
endif()
@ -48,6 +46,7 @@ if ( CGAL_FOUND AND CGAL_Qt5_FOUND AND Qt5_FOUND )
# The executable itself.
add_executable ( Polygon_2 Polygon_2.cpp ${DT_UI_FILES} ${DT_RESOURCE_FILES} ${CGAL_Qt5_RESOURCE_FILES} ${CGAL_Qt5_MOC_FILES} )
CGAL_target_use_Eigen(Polygon_2)
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polygon_2 )

View File

@ -31,8 +31,8 @@ if(COMMAND add_config_flag)
add_config_flag( CGAL_HAS_QT5 )
endif()
install(DIRECTORY "../../include/CGAL/Qt/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/Qt" COMPONENT CGAL_Qt5)
if (CGAL_HEADER_ONLY)
install(DIRECTORY "../../include/CGAL/Qt/" DESTINATION "${CGAL_INSTALL_INC_DIR}/CGAL/include/CGAL/Qt" COMPONENT CGAL_Qt5)
install(DIRECTORY "../../demo/resources/" DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/resources" COMPONENT CGAL_Qt5)
install(DIRECTORY "../../demo/icons/" DESTINATION "${CGAL_INSTALL_CMAKE_DIR}/demo/icons" COMPONENT CGAL_Qt5)
endif()

View File

@ -34,11 +34,8 @@ endif()
find_package(Eigen3 3.3.0)
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
else()
if (NOT EIGEN3_FOUND)
message(STATUS "This project requires the Eigen library (3.3 or greater), and will not be compiled.")
return()
endif()
@ -54,6 +51,10 @@ include_directories( BEFORE include )
include( CGAL_CreateSingleSourceCGALProgram )
create_single_source_cgal_program( "heat_method.cpp" )
CGAL_target_use_Eigen(heat_method)
create_single_source_cgal_program( "heat_method_polyhedron.cpp" )
CGAL_target_use_Eigen(heat_method_polyhedron)
create_single_source_cgal_program( "heat_method_surface_mesh.cpp" )
CGAL_target_use_Eigen(heat_method_surface_mesh)
create_single_source_cgal_program( "heat_method_surface_mesh_direct.cpp" )
CGAL_target_use_Eigen(heat_method_surface_mesh_direct)

View File

@ -34,11 +34,8 @@ endif()
find_package(Eigen3 3.3.0)
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
else()
if (NOT EIGEN3_FOUND)
message(STATUS "This project requires the Eigen library (3.3 or greater), and will not be compiled.")
return()
endif()
@ -52,5 +49,8 @@ include_directories( BEFORE include )
include( CGAL_CreateSingleSourceCGALProgram )
create_single_source_cgal_program( "heat_method_concept.cpp" )
CGAL_target_use_Eigen(heat_method_concept)
create_single_source_cgal_program( "heat_method_surface_mesh_test.cpp" )
CGAL_target_use_Eigen(heat_method_surface_mesh_test)
create_single_source_cgal_program( "heat_method_surface_mesh_direct_test.cpp" )
CGAL_target_use_Eigen(heat_method_surface_mesh_direct_test)

View File

@ -8,7 +8,7 @@ git clone https://github.com/CGAL/cgal.git /path/to/cgal.git
cd /path/to/cgal.git/Triangulation_2/examples/Triangulation_2
mkdir -p build/debug
cd build/debug
cmake -DCMAKE_BUILD_TYPE=Debug -DCGAL_DIR=/path/to/cgal.git
cmake -DCMAKE_BUILD_TYPE=Debug -DCGAL_DIR=/path/to/cgal.git ../..
make
```

View File

@ -21,6 +21,10 @@ Release date: June 2020
### Intersecting Sequences of dD Iso-oriented Boxes
- Added parallel versions of the functions `CGAL::box_intersection_d()` and `CGAL::box_self_intersection_d()`.
### CGAL and the Boost Graph Library (BGL)
- Introduced the function `set_triangulation_ids(Triangulation& tr)` which must be used to initialize vertex,
edge, and face indices of a triangulation meant to be used with BGL algorithms.
### Polygon Mesh Processing
- Introduced a new function, `CGAL::Polygon_mesh_processing::remove_connected_components_of_negligible_size()`,
@ -91,6 +95,11 @@ Release date: June 2020
### STL Extensions for CGAL
- Added a new concurrency tag: `CGAL::Parallel_if_available_tag`. This tag is a convenience typedef to `CGAL::Parallel_tag`
if the third party library TBB has been found and linked with, and to `CGAL::Sequential_tag` otherwise.
### Convex_hull_3
- A new overload for `convex_hull_3()` that takes a model of `VertexListGraph` has been added.
[Release 5.0](https://github.com/CGAL/cgal/releases/tag/releases%2FCGAL-5.0)
-----------

View File

@ -882,11 +882,11 @@ endif()
foreach (dir ${CGAL_CONFIGURED_PACKAGES})
if (EXISTS ${dir}/include/CGAL)
install(DIRECTORY ${dir}/include/CGAL DESTINATION ${CGAL_INSTALL_INC_DIR} PATTERN ".svn" EXCLUDE)
install(DIRECTORY ${dir}/include/CGAL DESTINATION ${CGAL_INSTALL_INC_DIR} PATTERN ".svn" EXCLUDE PATTERN "Qt" EXCLUDE)
endif()
endforeach()
if(EXISTS ${CMAKE_BINARY_DIR}/include/CGAL)
install(DIRECTORY ${CMAKE_BINARY_DIR}/include/CGAL DESTINATION ${CGAL_INSTALL_INC_DIR} PATTERN ".svn" EXCLUDE)
install(DIRECTORY ${CMAKE_BINARY_DIR}/include/CGAL DESTINATION ${CGAL_INSTALL_INC_DIR} PATTERN ".svn" EXCLUDE PATTERN "Qt" EXCLUDE)
endif()
file(GLOB scripts "scripts/*")

View File

@ -56,10 +56,13 @@ if( NOT CGAL_COMMON_FILE_INCLUDED )
endif()
endif()
# set minimal version of some optional libraries:
set( Eigen3_FIND_VERSION "3.1.0")
# set use-file for Eigen3 (needed to have default solvers)
set(EIGEN3_USE_FILE "UseEigen3")
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_Boost_IOStreams.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_Boost_Serialization.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_Eigen.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_GLPK.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_LASLIB.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_OpenCV.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_SCIP.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_TBB.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_target_use_TensorFlow.cmake)
endif()

View File

@ -119,12 +119,23 @@ function(CGAL_setup_CGAL_dependencies target)
# Now setup compilation flags
if(MSVC)
target_compile_options(${target} ${keyword}
"-D_SCL_SECURE_NO_DEPRECATE;-D_SCL_SECURE_NO_WARNINGS"
"/fp:strict"
"/fp:except-"
"/wd4503" # Suppress warnings C4503 about "decorated name length exceeded"
"/bigobj" # Use /bigobj by default
)
"-D_SCL_SECURE_NO_DEPRECATE;-D_SCL_SECURE_NO_WARNINGS")
if(CMAKE_VERSION VERSION_LESS 3.11)
target_compile_options(${target} ${keyword}
/fp:strict
/fp:except-
/wd4503 # Suppress warnings C4503 about "decorated name length exceeded"
/bigobj # Use /bigobj by default
)
else()
# The MSVC generator supports `$<COMPILE_LANGUAGE: >` since CMake 3.11.
target_compile_options(${target} ${keyword}
$<$<COMPILE_LANGUAGE:CXX>:/fp:strict>
$<$<COMPILE_LANGUAGE:CXX>:/fp:except->
$<$<COMPILE_LANGUAGE:CXX>:/wd4503> # Suppress warnings C4503 about "decorated name length exceeded"
$<$<COMPILE_LANGUAGE:CXX>:/bigobj> # Use /bigobj by default
)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
message( STATUS "Using Intel Compiler. Adding -fp-model strict" )
if(WIN32)

View File

@ -0,0 +1,39 @@
if (CGAL_target_use_Boost_IOStreams_included)
return()
endif()
set(CGAL_target_use_Boost_IOStreams_included TRUE)
function(CGAL_target_use_Boost_IOStreams target)
if( WIN32 )
# to avoid a warning with old cmake
set(_Boost_BZIP2_HEADERS "boost/iostreams/filter/bzip2.hpp")
set(_Boost_ZLIB_HEADERS "boost/iostreams/filter/zlib.hpp")
find_package( Boost OPTIONAL_COMPONENTS bzip2 zlib)
else()
find_package(ZLIB QUIET)
endif()
if(TARGET Boost::iostreams)
target_link_libraries(${target} PUBLIC Boost::iostreams)
else()
target_link_libraries(${target} PUBLIC ${Boost_IOSTREAMS_LIBRARY})
endif()
if( WIN32 )
if (Boost_ZLIB_FOUND AND Boost_BZIP2_FOUND)
target_link_libraries(${target} PUBLIC ${Boost_ZLIB_LIBRARY} ${Boost_BZIP2_LIBRARY})
else()
message(STATUS "NOTICE: This project requires Boost ZLIB and Boost BZIP2, and will not be compiled.")
return()
endif()
else()
if(ZLIB_FOUND)
target_link_libraries(${target} PUBLIC ZLIB::ZLIB)
else()
message(STATUS "NOTICE: This project requires ZLIB, and will not be compiled.")
return()
endif()
endif()
endfunction()

View File

@ -0,0 +1,14 @@
if (CGAL_target_use_Boost_Serialization_included)
return()
endif()
set(CGAL_target_use_Boost_Serialization_included TRUE)
function(CGAL_target_use_Boost_Serialization target)
if(TARGET Boost::serialization)
target_link_libraries(${target} PUBLIC Boost::serialization)
else()
target_link_libraries(${target} PUBLIC ${Boost_SERIALIZATION_LIBRARY})
endif()
endfunction()

View File

@ -0,0 +1,13 @@
if (CGAL_target_use_Eigen_included)
return()
endif()
set(CGAL_target_use_Eigen_included TRUE)
set( Eigen3_FIND_VERSION "3.1.0")
set(EIGEN3_USE_FILE "UseEigen3")
function(CGAL_target_use_Eigen target)
target_include_directories(${target} PUBLIC ${EIGEN3_INCLUDE_DIR})
target_compile_options( ${target} PUBLIC -DCGAL_EIGEN3_ENABLED)
endfunction()

View File

@ -0,0 +1,11 @@
if (CGAL_target_use_GLPK_included)
return()
endif()
set(CGAL_target_use_GLPK_included TRUE)
function(CGAL_target_use_GLPK target)
target_include_directories(${target} PUBLIC ${GLPK_INCLUDE_DIR})
target_compile_options(${target} PUBLIC -DCGAL_USE_GLPK)
target_link_libraries(${target} PUBLIC ${GLPK_LIBRARIES})
endfunction()

View File

@ -0,0 +1,11 @@
if (CGAL_target_use_LASLIB_included)
return()
endif()
set(CGAL_target_use_LASLIB_included TRUE)
function(CGAL_target_use_LASLIB target)
target_include_directories(${target} PUBLIC ${LASLIB_INCLUDE_DIR})
target_include_directories(${target} PUBLIC ${LASZIP_INCLUDE_DIR})
target_compile_options( ${target} PUBLIC -DCGAL_LINKED_WITH_LASLIB)
target_link_libraries(${target} PUBLIC ${LASLIB_LIBRARIES})
endfunction()

View File

@ -0,0 +1,10 @@
if (CGAL_target_use_OpenCV_included)
return()
endif()
set(CGAL_target_use_OpenCV_included TRUE)
function(CGAL_target_use_OpenCV target)
target_include_directories(${target} PUBLIC ${OpenCV_INCLUDE_DIRS})
target_compile_options( ${target} PUBLIC -DCGAL_LINKED_WITH_OPENCV)
target_link_libraries(${target} PUBLIC ${OpenCV_LIBS})
endfunction()

View File

@ -0,0 +1,11 @@
if (CGAL_target_use_SCIP_included)
return()
endif()
set(CGAL_target_use_SCIP_included TRUE)
function(CGAL_target_use_SCIP target)
target_include_directories(${target} PUBLIC ${SCIP_INCLUDE_DIRS})
target_compile_options(${target} PUBLIC -DCGAL_USE_SCIP)
target_link_libraries(${target} PUBLIC ${SCIP_LIBRARIES})
endfunction()

View File

@ -0,0 +1,10 @@
if (CGAL_target_use_TensorFlow_included)
return()
endif()
set(CGAL_target_use_TensorFlow_included TRUE)
function(CGAL_target_use_TensorFlow target)
target_include_directories(${target} PUBLIC ${TensorFlow_INCLUDE_DIR})
target_compile_options( ${target} PUBLIC -DCGAL_LINKED_WITH_TENSORFLOW)
target_link_libraries(${target} PUBLIC ${TensorFlow_LIBRARU})
endfunction()

View File

@ -0,0 +1,39 @@
# - Try to find the LibSSH libraries
# This module defines:
# LIBSSH_FOUND - system has LibSSH lib
# LIBSSH_INCLUDE_DIR - the LibSSH include directory
# LIBSSH_LIBRARIES_DIR - directory where the LibSSH libraries are located
# LIBSSH_LIBRARIES - Link these to use LibSSH
include(FindPackageHandleStandardArgs)
include(${CMAKE_CURRENT_LIST_DIR}/CGAL_GeneratorSpecificSettings.cmake)
if(LIBSSH_INCLUDE_DIR)
set(LIBSSH_in_cache TRUE)
else()
set(LIBSSH_in_cache FALSE)
endif()
if(NOT LIBSSH_LIBRARIES)
set(LIBSSH_in_cache FALSE)
endif()
# Is it already configured?
if( NOT LIBSSH_in_cache )
find_path(LIBSSH_INCLUDE_DIR
NAMES "libssh/libssh.h"
)
find_library(LIBSSH_LIBRARIES NAMES ssh libssh
HINTS "/usr/lib"
"usr/lib/x86_64-linux-gnu"
PATH_SUFFIXES lib
DOC "Path to the LIBSSH library"
)
endif()
SET(LIBSSH_FOUND TRUE)
if( NOT LIBSSH_LIBRARIES OR NOT LIBSSH_INCLUDE_DIR)
SET(LIBSSH_FOUND FALSE)
endif()

View File

@ -7,3 +7,5 @@ include_directories( SYSTEM ${EIGEN3_INCLUDE_DIR} )
add_definitions(-DCGAL_EIGEN3_ENABLED)
set (EIGEN3_SETUP TRUE)
message(DEPRECATION "This file UseEigen.cmake is deprecated, and the function `CGAL_target_use_Eigen` from CGAL_target_use_Eigen.cmake should be used instead.")

View File

@ -2,3 +2,6 @@
# It assumes that find_package(LASLIB) was already called.
add_definitions(-DCGAL_LINKED_WITH_LASLIB)
message(DEPRECATION "This file UseLASLIB.cmake is deprecated, and the function `CGAL_target_use_LASLIB` from CGAL_target_use_LASLIB.cmake should be used instead.")

View File

@ -14,7 +14,6 @@ if ( CGAL_FOUND )
# use Eigen
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
# Link with Boost.ProgramOptions (optional)
find_package(Boost QUIET COMPONENTS program_options)
if(Boost_PROGRAM_OPTIONS_FOUND)
@ -30,9 +29,11 @@ if ( CGAL_FOUND )
list(APPEND CGAL_3RD_PARTY_LIBRARIES ${Boost_PROGRAM_OPTIONS_LIBRARY})
endif()
create_single_source_cgal_program( "Mesh_estimation.cpp" )
create_single_source_cgal_program( "Single_estimation.cpp" )
create_single_source_cgal_program( "Mesh_estimation.cpp" )
CGAL_target_use_Eigen(Mesh_estimation)
create_single_source_cgal_program( "Single_estimation.cpp" )
CGAL_target_use_Eigen(Single_estimation)
else()
message(STATUS "NOTICE: This program requires Eigen 3.1 (or greater) and will not be compiled.")
endif()

View File

@ -14,8 +14,8 @@ if ( CGAL_FOUND )
# use Eigen
find_package(Eigen3 3.1.0) #(requires 3.1.0 or greater)
if (EIGEN3_FOUND)
include( ${EIGEN3_USE_FILE} )
create_single_source_cgal_program( "blind_1pt.cpp" )
CGAL_target_use_Eigen(blind_1pt)
else()
message(STATUS "NOTICE: This program requires Eigen 3.1 (or greater) and will not be compiled.")
endif()

View File

@ -59,19 +59,13 @@ Filtered_predicate<EP, FP, C2E, C2F>();
/// @}
/// \name Operations
/// Similar function operators are defined for up to 7 arguments.
/// @{
/*!
The unary function operator for unary predicates.
The function operator for predicates.
*/
template <class A1> result_type operator()(A1 a1);
template <class ... A> result_type operator()(A a...);
/*!
The binary function operator for binary predicates.
*/
template <class A1, class A2>
result_type operator()(A1 a1, A2 a2);
/// @}

View File

@ -110,8 +110,8 @@ CGAL_Kernel_pred(Compare_dihedral_angle_3,
compare_dihedral_angle_3_object)
CGAL_Kernel_pred(Compare_distance_2,
compare_distance_2_object)
CGAL_Kernel_pred_RT(Compare_distance_3,
compare_distance_3_object)
CGAL_Kernel_pred(Compare_distance_3,
compare_distance_3_object)
CGAL_Kernel_pred_RT(Compare_power_distance_2,
compare_power_distance_2_object)
CGAL_Kernel_pred_RT(Compare_power_distance_3,

View File

@ -79,164 +79,21 @@ public:
: p1(pp1), p2(pp2), cmp(c)
{ }
template <class A1>
typename Pairify<typename CGAL::cpp11::result_of<P1(const A1&)>::type,
typename CGAL::cpp11::result_of<P2(const A1&)>::type>::result_type
operator()(const A1 &a1) const
template <class ... A>
typename Pairify<typename CGAL::cpp11::result_of<P1(const A&...)>::type,
typename CGAL::cpp11::result_of<P2(const A&...)>::type>::result_type
operator()(const A&... a) const
{
typedef typename CGAL::cpp11::result_of<P1(const A1&)>::type result_type_1;
typedef typename CGAL::cpp11::result_of<P2(const A1&)>::type result_type_2;
result_type_1 res1 = p1(a1.first);
result_type_2 res2 = p2(a1.second);
typedef typename CGAL::cpp11::result_of<P1(const A&...)>::type result_type_1;
typedef typename CGAL::cpp11::result_of<P2(const A&...)>::type result_type_2;
result_type_1 res1 = p1(a.first...);
result_type_2 res2 = p2(a.second...);
if (! cmp(res1, res2))
{
std::cerr << "Kernel_checker error : " << res1 << " != " << res2
<< " for the inputs : " << std::endl;
std::cerr << a1.first << std::endl;
std::cerr << a1.second << std::endl;
std::cerr << "functor first kernel : "
<< typeid(p1).name() << std::endl;
std::cerr << "functor second kernel: "
<< typeid(p2).name() << std::endl;
std::cerr << CGAL_PRETTY_FUNCTION << std::endl;
CGAL_kernel_assertion(false);
}
return Pairify<result_type_1, result_type_2>()(res1, res2);
}
template <class A1, class A2>
typename Pairify<typename CGAL::cpp11::result_of<P1(const A1&, const A2&)>::type,
typename CGAL::cpp11::result_of<P2(const A1&, const A2&)>::type>::result_type
operator()(const A1 &a1, const A2 &a2) const
{
typedef typename CGAL::cpp11::result_of<P1(const A1&, const A2&)>::type result_type_1;
typedef typename CGAL::cpp11::result_of<P2(const A1&, const A2&)>::type result_type_2;
result_type_1 res1 = p1(a1.first, a2.first);
result_type_2 res2 = p2(a1.second, a2.second);
if (! cmp(res1, res2))
{
std::cerr << "Kernel_checker error : " << res1 << " != " << res2
<< " for the inputs : " << std::endl;
std::cerr << a1.first << std::endl;
std::cerr << a1.second << std::endl;
std::cerr << a2.first << std::endl;
std::cerr << a2.second << std::endl;
std::cerr << "functor first kernel : "
<< typeid(p1).name() << std::endl;
std::cerr << "functor second kernel: "
<< typeid(p2).name() << std::endl;
std::cerr << CGAL_PRETTY_FUNCTION << std::endl;
CGAL_kernel_assertion(false);
}
return Pairify<result_type_1, result_type_2>()(res1, res2);
}
template <class A1, class A2, class A3>
typename Pairify<typename CGAL::cpp11::result_of<P1(
const A1&, const A2&, const A3&)>::type,
typename CGAL::cpp11::result_of<P2(
const A1&, const A2&, const A3&)>::type>::result_type
operator()(const A1 &a1, const A2 &a2, const A3 &a3) const
{
typedef typename CGAL::cpp11::result_of<P1(const A1&, const A2&, const A3&)>::type result_type_1;
typedef typename CGAL::cpp11::result_of<P2(const A1&, const A2&, const A3&)>::type result_type_2;
result_type_1 res1 = p1(a1.first, a2.first, a3.first);
result_type_2 res2 = p2(a1.second, a2.second, a3.second);
if (! cmp(res1, res2))
{
std::cerr << "Kernel_checker error : " << res1 << " != " << res2
<< " for the inputs : " << std::endl;
std::cerr << a1.first << std::endl;
std::cerr << a1.second << std::endl;
std::cerr << a2.first << std::endl;
std::cerr << a2.second << std::endl;
std::cerr << a3.first << std::endl;
std::cerr << a3.second << std::endl;
std::cerr << "functor first kernel : "
<< typeid(p1).name() << std::endl;
std::cerr << "functor second kernel: "
<< typeid(p2).name() << std::endl;
std::cerr << CGAL_PRETTY_FUNCTION << std::endl;
CGAL_kernel_assertion(false);
}
return Pairify<result_type_1, result_type_2>()(res1, res2);
}
template <class A1, class A2, class A3, class A4>
typename Pairify<typename CGAL::cpp11::result_of<P1(
const A1&, const A2&, const A3&, const A4&)>::type,
typename CGAL::cpp11::result_of<P2(
const A1&, const A2&, const A3&, const A4&)>::type>::result_type
operator()(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4) const
{
typedef typename CGAL::cpp11::result_of<P1(
const A1&, const A2&, const A3&, const A4&)>::type result_type_1;
typedef typename CGAL::cpp11::result_of<P2(
const A1&, const A2&, const A3&, const A4&)>::type result_type_2;
result_type_1 res1 = p1(a1.first, a2.first, a3.first, a4.first);
result_type_2 res2 = p2(a1.second, a2.second, a3.second, a4.second);
if (! cmp(res1, res2))
{
std::cerr << "Kernel_checker error : " << res1 << " != " << res2
<< " for the inputs : " << std::endl;
std::cerr << a1.first << std::endl;
std::cerr << a1.second << std::endl;
std::cerr << a2.first << std::endl;
std::cerr << a2.second << std::endl;
std::cerr << a3.first << std::endl;
std::cerr << a3.second << std::endl;
std::cerr << a4.first << std::endl;
std::cerr << a4.second << std::endl;
std::cerr << "functor first kernel : "
<< typeid(p1).name() << std::endl;
std::cerr << "functor second kernel: "
<< typeid(p2).name() << std::endl;
std::cerr << CGAL_PRETTY_FUNCTION << std::endl;
CGAL_kernel_assertion(false);
}
return Pairify<result_type_1, result_type_2>()(res1, res2);
}
template <class A1, class A2, class A3, class A4, class A5>
typename Pairify<typename CGAL::cpp11::result_of<P1(
const A1&, const A2&, const A3&, const A4&, const A5&)>::type,
typename CGAL::cpp11::result_of<P2(
const A1&, const A2&, const A3&, const A4&, const A5&)>::type>::result_type
operator()(const A1 &a1, const A2 &a2, const A3 &a3, const A4 &a4, const A5 &a5) const
{
typedef typename CGAL::cpp11::result_of<P1(
const A1&, const A2&, const A3&, const A4&, const A5&)>::type result_type_1;
typedef typename CGAL::cpp11::result_of<P2(
const A1&, const A2&, const A3&, const A4&, const A5&)>::type result_type_2;
result_type_1 res1 = p1(a1.first, a2.first, a3.first, a4.first, a5.first);
result_type_2 res2 = p2(a1.second, a2.second, a3.second, a4.second, a5.second);
if (! cmp(res1, res2))
{
std::cerr << "Kernel_checker error : " << res1 << " != " << res2
<< " for the inputs : " << std::endl;
std::cerr << a1.first << std::endl;
std::cerr << a1.second << std::endl;
std::cerr << a2.first << std::endl;
std::cerr << a2.second << std::endl;
std::cerr << a3.first << std::endl;
std::cerr << a3.second << std::endl;
std::cerr << a4.first << std::endl;
std::cerr << a4.second << std::endl;
std::cerr << a5.first << std::endl;
std::cerr << a5.second << std::endl;
std::cerr << "functor first kernel : "
<< typeid(p1).name() << std::endl;
std::cerr << "functor second kernel: "
<< typeid(p2).name() << std::endl;
std::cerr << CGAL_PRETTY_FUNCTION << std::endl;
CGAL_kernel_assertion(false);
}
return Pairify<result_type_1, result_type_2>()(res1, res2);
}
// Same thing with more arguments...
};
struct dont_check_equal {

View File

@ -48,12 +48,12 @@ public:
typedef RPoint_2 Rep;
typedef typename R_::Cartesian_const_iterator_2 Cartesian_const_iterator;
const Rep& rep() const
const Rep& rep() const noexcept
{
return *this;
}
Rep& rep()
Rep& rep() noexcept
{
return *this;
}
@ -84,6 +84,15 @@ public:
: RPoint_2(typename R::Construct_point_2()(Return_base_tag(), hx, hy, hw))
{}
friend void swap(Self& a, Self& b)
#ifdef __cpp_lib_is_swappable
noexcept(std::is_nothrow_swappable_v<Rep>)
#endif
{
using std::swap;
swap(a.rep(), b.rep());
}
typename cpp11::result_of<typename R::Compute_x_2(Point_2)>::type
x() const
{

View File

@ -46,12 +46,12 @@ public:
typedef typename R_::Kernel_base::Point_3 Rep;
typedef typename R_::Cartesian_const_iterator_3 Cartesian_const_iterator;
const Rep& rep() const
const Rep& rep() const noexcept
{
return *this;
}
Rep& rep()
Rep& rep() noexcept
{
return *this;
}
@ -81,6 +81,15 @@ public:
: Rep(typename R::Construct_point_3()(Return_base_tag(), hx, hy, hz, hw))
{}
friend void swap(Self& a, Self& b)
#ifdef __cpp_lib_is_swappable
noexcept(std::is_nothrow_swappable_v<Rep>)
#endif
{
using std::swap;
swap(a.rep(), b.rep());
}
typename cpp11::result_of<typename R::Compute_x_3( Point_3)>::type
x() const
{

View File

@ -54,12 +54,12 @@ public:
typedef RVector_2 Rep;
typedef typename R_::Cartesian_const_iterator_2 Cartesian_const_iterator;
const Rep& rep() const
const Rep& rep() const noexcept
{
return *this;
}
Rep& rep()
Rep& rep() noexcept
{
return *this;
}
@ -93,6 +93,15 @@ public:
Vector_2(const RT &x, const RT &y, const RT &w)
: RVector_2(typename R::Construct_vector_2()(Return_base_tag(), x,y,w)) {}
friend void swap(Self& a, Self& b)
#ifdef __cpp_lib_is_swappable
noexcept(std::is_nothrow_swappable_v<Rep>)
#endif
{
using std::swap;
swap(a.rep(), b.rep());
}
typename cpp11::result_of<typename R::Compute_x_2(Vector_2)>::type
x() const

View File

@ -93,6 +93,15 @@ public:
Vector_3(const RT& x, const RT& y, const RT& z, const RT& w)
: Rep(typename R::Construct_vector_3()(Return_base_tag(), x, y, z, w)) {}
friend void swap(Self& a, Self& b)
#ifdef __cpp_lib_is_swappable
noexcept(std::is_nothrow_swappable_v<Rep>)
#endif
{
using std::swap;
swap(a.rep(), b.rep());
}
Direction_3 direction() const
{
return R().construct_direction_3_object()(*this);

View File

@ -32,81 +32,10 @@ class Construct
public:
typedef ToBeConstructed result_type;
template <class ... A>
ToBeConstructed
operator()() const
{ return ToBeConstructed(); }
template <class A1>
ToBeConstructed
operator()( const A1& a1) const
{ return ToBeConstructed(a1); }
template <class A1, class A2>
ToBeConstructed
operator()( const A1& a1, const A2& a2) const
{ return ToBeConstructed(a1,a2); }
template <class A1, class A2, class A3>
ToBeConstructed
operator()( const A1& a1, const A2& a2, const A3& a3) const
{ return ToBeConstructed(a1,a2,a3); }
template <class A1, class A2, class A3, class A4>
ToBeConstructed
operator()( const A1& a1, const A2& a2, const A3& a3, const A4& a4) const
{ return ToBeConstructed(a1,a2,a3,a4); }
template <class A1, class A2, class A3, class A4, class A5>
ToBeConstructed
operator()( const A1& a1, const A2& a2, const A3& a3, const A4& a4,
const A5& a5) const
{ return ToBeConstructed(a1,a2,a3,a4,a5); }
template <class A>
ToBeConstructed
operator()( const A& a1, const A& a2, const A& a3,
const A& a4, const A& a5, const A& a6 ) const
{ return ToBeConstructed(a1,a2,a3,a4,a5,a6); }
template <class A>
ToBeConstructed
operator()( const A& a1, const A& a2, const A& a3,
const A& a4, const A& a5, const A& a6,
const A& a7 ) const
{ return ToBeConstructed(a1,a2,a3,a4,a5,a6,a7); }
template <class A>
ToBeConstructed
operator()( const A& a1, const A& a2, const A& a3,
const A& a4, const A& a5, const A& a6,
const A& a7, const A& a8, const A& a9) const
{ return ToBeConstructed(a1,a2,a3,a4,a5,a6,a7,a8,a9); }
template <class A>
ToBeConstructed
operator()( const A& a1, const A& a2, const A& a3,
const A& a4, const A& a5, const A& a6,
const A& a7, const A& a8, const A& a9,
const A& a10) const
{ return ToBeConstructed(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10); }
template <class A>
ToBeConstructed
operator()( const A& a1, const A& a2, const A& a3,
const A& a4, const A& a5, const A& a6,
const A& a7, const A& a8, const A& a9,
const A& a10,const A& a11,const A& a12) const
{ return ToBeConstructed(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12); }
template <class A>
ToBeConstructed
operator()( const A& a1, const A& a2, const A& a3,
const A& a4, const A& a5, const A& a6,
const A& a7, const A& a8, const A& a9,
const A& a10,const A& a11,const A& a12,
const A& a13) const
{ return ToBeConstructed(a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13); }
operator()( A&& ... a) const
{ return ToBeConstructed(std::forward<A>(a)...); }
};
class Call_has_on_positive_side

View File

@ -25,11 +25,11 @@ namespace CGAL {
class Point_for_cell
{
public:
/// Contructor without parameter.
/// Constructor without parameter.
Point_for_cell()
{}
/// Contructor with a point in parameter.
/// Constructor with a point in parameter.
Point_for_cell(const Point& apoint) : mpoint(apoint)
{}
@ -87,15 +87,15 @@ namespace CGAL {
{ return !operator==(other); }
protected:
/// Default contructor.
/// Default constructor.
Cell_attribute_with_point()
{}
/// Contructor with a point in parameter.
/// Constructor with a point in parameter.
Cell_attribute_with_point(const Point& apoint) : Base2(apoint)
{}
/// Contructor with a point and an attribute in parameters.
/// Constructor with a point and an attribute in parameters.
Cell_attribute_with_point(const Point& apoint, const Info& ainfo) :
Base1(ainfo),
Base2(apoint)
@ -144,11 +144,11 @@ namespace CGAL {
{ return false; }
protected:
/// Default contructor.
/// Default constructor.
Cell_attribute_with_point()
{}
/// Contructor with a point in parameter.
/// Constructor with a point in parameter.
Cell_attribute_with_point(const Point& apoint) : Base2(apoint)
{}
};

View File

@ -25,11 +25,11 @@ LC_CTYPE=en_US.UTF-8
# "master" alone
0 21 * * Sun cd $HOME/CGAL/create_internal_release && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/master.git --do-it || echo ERROR
# "integration"
0 21 * * Mon,Tue,Wed,Thu cd $HOME/CGAL/create_internal_release && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/integration.git $HOME/CGAL/branches/empty-dir --do-it --public || echo ERROR
0 21 * * Mon,Tue,Wed,Thu,Fri cd $HOME/CGAL/create_internal_release && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/integration.git $HOME/CGAL/branches/empty-dir --do-it --public || echo ERROR
# from branch 5.0
0 21 * * Fri cd $HOME/CGAL/create_internal_release-5.0-branch && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/CGAL-5.0-branch.git --public --do-it || echo ERROR
0 21 * * Sat cd $HOME/CGAL/create_internal_release-5.0-branch && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/CGAL-5.0-branch.git --public --do-it || echo ERROR
# from branch 4.14
0 21 * * Sat cd $HOME/CGAL/create_internal_release-4.14-branch && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/CGAL-4.14-branch.git --public --do-it || echo ERROR
#0 21 * * Sat cd $HOME/CGAL/create_internal_release-4.14-branch && /usr/bin/time scl enable rh-git29 -- $HOME/bin/create_release $HOME/CGAL/branches/CGAL-4.14-branch.git --public --do-it || echo ERROR
## Older stuff
# from branch 4.13

View File

@ -111,10 +111,8 @@ public:
typedef typename Geom_traits::Compute_squared_distance_2
Compute_squared_distance_2;
Geom_traits traits; /** @warning traits with data!! */
Compute_squared_distance_2 squared_distance =
traits.compute_squared_distance_2_object();
this->traits.compute_squared_distance_2_object();
const Point_2& pa = fh->vertex(0)->point();
const Point_2& pb = fh->vertex(1)->point();
@ -165,7 +163,7 @@ public:
}
}
Compute_area_2 area_2 = traits.compute_area_2_object();
Compute_area_2 area_2 = this->traits.compute_area_2_object();
double area = 2*CGAL::to_double(area_2(pa, pb, pc));

Some files were not shown because too many files have changed in this diff Show More