Rebase on master

This commit is contained in:
Simon Giraudot 2021-04-07 14:32:05 +02:00
commit 10f6992b2a
182 changed files with 2260 additions and 2955 deletions

View File

@ -45,11 +45,9 @@ typedef unspecified_type Do_intersect_3;
/*!
A functor object to construct the intersection between two geometric objects.
This functor must support the result_of protocol, that is the return
type of the `operator()(A, B)` is `CGAL::cpp11::result<Intersect_3(A,B)>`.
Provides the operators:
`CGAL::cpp11::result<Intersect_3(A,B)> operator()(const A& a, const B& b);`
`decltype(auto) operator()(const A& a, const B& b);`
where `A` and `B` are any relevant types among `Ray_3`, `Segment_3`, `Line_3`,
`Triangle_3`, `Plane_3` and `Bbox_3`.
Relevant herein means that a line primitive (ray, segment, line) is tested

View File

@ -20,7 +20,6 @@
#include <CGAL/disable_warnings.h>
#include <CGAL/AABB_primitive.h>
#include <CGAL/result_of.h>
#include <iterator>
namespace CGAL {
@ -31,14 +30,17 @@ namespace internal {
//classical typedefs
typedef Iterator key_type;
typedef typename GeomTraits::Point_3 value_type;
typedef typename cpp11::result_of<
typename GeomTraits::Construct_source_3(typename GeomTraits::Segment_3)
>::type reference;
// typedef decltype(
// std::declval<typename GeomTraits::Construct_source_3>()(
// std::declval<typename GeomTraits::Segment_3>())) reference;
typedef decltype(
typename GeomTraits::Construct_source_3()(
*std::declval<key_type&>())) reference;
typedef boost::readable_property_map_tag category;
typedef Source_of_segment_3_iterator_property_map<GeomTraits, Iterator> Self;
inline friend
typename Source_of_segment_3_iterator_property_map<GeomTraits,Iterator>::reference
get(Source_of_segment_3_iterator_property_map<GeomTraits,Iterator>, Iterator it)
inline friend reference
get(Self, key_type it)
{
return typename GeomTraits::Construct_source_3()( *it );
}
@ -57,7 +59,6 @@ namespace internal {
* \tparam GeomTraits is a traits class providing the nested type `Point_3` and `Segment_3`.
* It also provides the functor `Construct_source_3` that has an operator taking a `Segment_3`
* and returning its source as a type convertible to `Point_3`.
* In addition `Construct_source_3` must support the result_of protocol.
* \tparam Iterator is a model of `ForwardIterator` with its value type convertible to `GeomTraits::Segment_3`
* \tparam CacheDatum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case,
* the datum is stored in the primitive, while in the latter it is

View File

@ -24,6 +24,8 @@
#include <CGAL/internal/AABB_tree/Has_nested_type_Shared_data.h>
#include <CGAL/internal/AABB_tree/Is_ray_intersection_geomtraits.h>
#include <CGAL/internal/AABB_tree/Primitive_helper.h>
#include <CGAL/internal/Has_boolean_tags.h>
#include <boost/optional.hpp>
@ -190,14 +192,14 @@ public:
typedef typename std::pair<typename GeomTraits::Point_3, typename Primitive::Id> Point_and_primitive_id;
/// `Intersection_and_primitive_id<Query>::%Type::first_type` is found according to
/// the result type of `GeomTraits::Intersect_3::operator()`,
/// (that is cpp11::result_of<GeomTraits::Intersect_3(Query, Primitive::Datum)>::type). If it is
/// the result type of `GeomTraits::Intersect_3::operator()`. If it is
/// `boost::optional<T>` then it is `T`, and the result type otherwise.
template<typename Query>
struct Intersection_and_primitive_id {
typedef typename cpp11::result_of<
typename GeomTraits::Intersect_3(Query, typename Primitive::Datum)
>::type Intersection_type;
typedef decltype(
std::declval<typename GeomTraits::Intersect_3>()(
std::declval<Query>(),
std::declval<typename Primitive::Datum>())) Intersection_type;
typedef std::pair<
typename internal::AABB_tree::Remove_optional<Intersection_type>::type,
@ -364,8 +366,7 @@ public:
template<typename Query>
boost::optional< typename Intersection_and_primitive_id<Query>::Type >
operator()(const Query& query, const typename AT::Primitive& primitive) const {
typename cpp11::result_of<typename GeomTraits::Intersect_3(Query, typename Primitive::Datum) >::type
inter_res = GeomTraits().intersect_3_object()(internal::Primitive_helper<AT>::get_datum(primitive,m_traits),query);
auto inter_res = GeomTraits().intersect_3_object()(internal::Primitive_helper<AT>::get_datum(primitive,m_traits),query);
if (!inter_res)
return boost::none;
return boost::make_optional( std::make_pair(*inter_res, primitive.id()) );
@ -414,6 +415,27 @@ public:
CGAL::SMALLER : CGAL::LARGER;
}
CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, Tag_true) const
{
return GeomTraits().do_intersect_3_object()
(GeomTraits().construct_sphere_3_object()
(p, GeomTraits().compute_squared_distance_3_object()(p, bound)), bb,true)?
CGAL::SMALLER : CGAL::LARGER;
}
CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound, Tag_false) const
{
return GeomTraits().do_intersect_3_object()
(GeomTraits().construct_sphere_3_object()
(p, GeomTraits().compute_squared_distance_3_object()(p, bound)), bb)?
CGAL::SMALLER : CGAL::LARGER;
}
CGAL::Comparison_result operator()(const Point& p, const Bounding_box& bb, const Point& bound) const
{
return (*this)(p, bb, bound, Boolean_tag<internal::Has_static_filters<GeomTraits>::value>());
}
template <class Solid>
CGAL::Comparison_result operator()(const Point& p, const Solid& pr, const FT& sq_distance) const
{
@ -423,6 +445,7 @@ public:
CGAL::SMALLER :
CGAL::LARGER;
}
};
Closest_point closest_point_object() const {return Closest_point(*this);}

View File

@ -20,7 +20,6 @@
#include <CGAL/disable_warnings.h>
#include <CGAL/AABB_primitive.h>
#include <CGAL/result_of.h>
#include <iterator>
namespace CGAL {
@ -31,14 +30,18 @@ namespace internal {
//classical typedefs
typedef Iterator key_type;
typedef typename GeomTraits::Point_3 value_type;
typedef typename cpp11::result_of<
typename GeomTraits::Construct_vertex_3(typename GeomTraits::Triangle_3,int)
>::type reference;
// typedef decltype(
// std::declval<typename GeomTraits::Construct_vertex_3>()(
// std::declval<typename GeomTraits::Triangle_3>(),
// std::declval<int>())) reference;
typedef decltype(
typename GeomTraits::Construct_vertex_3()(
*std::declval<key_type&>(), 0)) reference;
typedef boost::readable_property_map_tag category;
typedef Point_from_triangle_3_iterator_property_map<GeomTraits, Iterator> Self;
inline friend
typename Point_from_triangle_3_iterator_property_map<GeomTraits,Iterator>::reference
get(Point_from_triangle_3_iterator_property_map<GeomTraits,Iterator>, Iterator it)
inline friend reference
get(Self, key_type it)
{
return typename GeomTraits::Construct_vertex_3()( *it, 0 );
}
@ -57,7 +60,6 @@ namespace internal {
* \tparam GeomTraits is a traits class providing the nested type `Point_3` and `Triangle_3`.
* It also provides the functor `Construct_vertex_3` that has an operator taking a `Triangle_3`
* and an integer as parameters and returning a triangle point as a type convertible to `Point_3`.
* In addition `Construct_vertex_3` must support the result_of protocol.
* \tparam Iterator is a model of `ForwardIterator` with its value type convertible to `GeomTraits::Triangle_3`
* \tparam CacheDatum is either `CGAL::Tag_true` or `CGAL::Tag_false`. In the former case,
* the datum is stored in the primitive, while in the latter it is

View File

@ -18,7 +18,6 @@
#include <CGAL/AABB_primitive.h>
#include <CGAL/result_of.h>
#include <iterator>
namespace CGAL
@ -31,14 +30,18 @@ namespace CGAL
//classical typedefs
typedef Iterator key_type;
typedef typename GeomTraits::Point_3 value_type;
typedef typename cpp11::result_of<
typename GeomTraits::Construct_vertex_3(typename GeomTraits::Tetrahedron_3, int)
>::type reference;
typedef decltype(
std::declval<typename GeomTraits::Construct_vertex_3>()(
std::declval<typename GeomTraits::Tetrahedron_3>(),
std::declval<int>())) reference;
// typedef decltype(
// typename GeomTraits::Construct_vertex_3()(
// *std::declval<key_type&>(), 0)) reference; // fails polyhedron demo!
typedef boost::readable_property_map_tag category;
typedef Point_from_cell_iterator_proprety_map<GeomTraits, Iterator> Self;
inline friend
typename Point_from_cell_iterator_proprety_map<GeomTraits, Iterator>::reference
get(Point_from_cell_iterator_proprety_map<GeomTraits, Iterator>, Iterator it)
inline friend reference
get(Self, key_type it)
{
typename GeomTraits::Construct_point_3 point;
return point(it->vertex(1)->point());

View File

@ -51,12 +51,10 @@ else()
endif()
find_package( METIS )
if( METIS_FOUND )
include(CGAL_METIS_support)
if( TARGET CGAL::METIS_support )
create_single_source_cgal_program( "polyhedron_partition.cpp" )
if( METIS_FOUND )
target_include_directories( polyhedron_partition PRIVATE ${METIS_INCLUDE_DIRS} )
target_link_libraries( polyhedron_partition PRIVATE ${METIS_LIBRARIES} )
else()
message( STATUS "Examples that use the METIS library will not be compiled." )
endif()
target_link_libraries( polyhedron_partition PUBLIC CGAL::METIS_support)
else()
message( STATUS "Examples that use the METIS library will not be compiled." )
endif()

View File

@ -13,10 +13,10 @@ create_single_source_cgal_program("surface_mesh_dual.cpp")
create_single_source_cgal_program("connected_components.cpp")
find_package(METIS)
if( METIS_FOUND )
include(CGAL_METIS_support)
if( TARGET CGAL::METIS_support )
create_single_source_cgal_program( "surface_mesh_partition.cpp" )
target_include_directories( surface_mesh_partition PRIVATE ${METIS_INCLUDE_DIRS} )
target_link_libraries( surface_mesh_partition PRIVATE ${METIS_LIBRARIES} )
target_link_libraries( surface_mesh_partition PUBLIC CGAL::METIS_support )
else()
message(STATUS "Examples that use the METIS library will not be compiled.")
endif()

View File

@ -737,7 +737,7 @@ add_face(const VertexRange& vr, Graph& g)
patch_start, patch_end;
// cache for set_next and vertex' set_halfedge
typedef std::pair<halfedge_descriptor, halfedge_descriptor> NextCacheEntry;
typedef std::vector<NextCacheEntry> NextCache;
typedef boost::container::small_vector<NextCacheEntry,9> NextCache;
NextCache next_cache;
next_cache.reserve(3 * n);

View File

@ -17,6 +17,7 @@
#define CGAL_CARTESIAN_CIRCLEC3_H
#include <CGAL/Interval_nt.h>
#include "boost/tuple/tuple.hpp"
namespace CGAL {
@ -29,13 +30,9 @@ class CircleC3 {
typedef typename R_::Direction_3 Direction_3;
typedef typename R_::FT FT;
struct Rep
{
Sphere_3 first;
Plane_3 second;
Rep () : first(), second() { }
Rep (const Sphere_3& s, const Plane_3& p) : first(s), second(p) { }
};
//using a boost::tuple because std::pair and tuple cannot work with incomplete types.
typedef boost::tuple<Sphere_3, Plane_3> Rep;
typedef typename R_::template Handle<Rep>::type Base;
Base base;
@ -125,7 +122,7 @@ public:
const Plane_3& supporting_plane() const
{
return get_pointee_or_identity(base).second;
return boost::get<1>(get_pointee_or_identity(base));
}
const Sphere_3& supporting_sphere() const
@ -145,7 +142,7 @@ public:
const Sphere_3& diametral_sphere() const
{
return get_pointee_or_identity(base).first;
return boost::get<0>(get_pointee_or_identity(base));
}
double approximate_area() const

View File

@ -22,7 +22,6 @@
#include <CGAL/config.h>
#include <CGAL/result_of.h>
#include <CGAL/Bbox_2.h>
#include <CGAL/enum.h>
namespace CGAL {
@ -107,25 +106,25 @@ public:
{}
typename cpp11::result_of<typename R::Construct_circular_source_vertex_2(Circular_arc_2)>::type
decltype(auto)
source() const
{
return typename R::Construct_circular_source_vertex_2()(*this);
}
typename cpp11::result_of<typename R::Construct_circular_target_vertex_2(Circular_arc_2)>::type
decltype(auto)
target() const
{
return typename R::Construct_circular_target_vertex_2()(*this);
}
typename cpp11::result_of<typename R::Construct_circular_min_vertex_2(Circular_arc_2)>::type
decltype(auto)
left() const
{
return typename R::Construct_circular_min_vertex_2()(*this);
}
typename cpp11::result_of<typename R::Construct_circular_max_vertex_2(Circular_arc_2)>::type
decltype(auto)
right() const
{
return typename R::Construct_circular_max_vertex_2()(*this);
@ -141,19 +140,19 @@ public:
return typename R::Is_y_monotone_2()(*this);
}
typename cpp11::result_of<typename R::Construct_circle_2(Circular_arc_2)>::type
decltype(auto)
supporting_circle() const
{
return typename R::Construct_circle_2()(*this);
}
typename cpp11::result_of<typename R::Construct_center_2(Circular_arc_2)>::type
decltype(auto)
center() const
{
return typename R::Construct_center_2()(*this);
}
typename cpp11::result_of<typename R::Compute_squared_radius_2( Circular_arc_2)>::type
decltype(auto)
squared_radius() const
{
return typename R::Compute_squared_radius_2()(*this);

View File

@ -21,7 +21,6 @@
#include <CGAL/license/Circular_kernel_2.h>
#include <CGAL/result_of.h>
#include <CGAL/Bbox_2.h>
#include <CGAL/enum.h>
@ -72,15 +71,13 @@ public:
: RCircular_arc_point_2(typename R::Construct_circular_arc_point_2()(p))
{}
typename
cpp11::result_of<typename R::Compute_circular_x_2(Circular_arc_point_2)>::type
decltype(auto)
x() const
{
return typename R::Compute_circular_x_2()(*this);
}
typename
cpp11::result_of<typename R::Compute_circular_y_2(Circular_arc_point_2)>::type
decltype(auto)
y() const
{
return typename R::Compute_circular_y_2()(*this);

View File

@ -639,13 +639,13 @@ public:
return _support;
}
typename cpp11::result_of<typename CK::Construct_center_2(Circle_2)>::type
decltype(auto)
center() const
{
return supporting_circle().center();
}
typename cpp11::result_of<typename CK::Compute_squared_radius_2(Circle_2)>::type
decltype(auto)
squared_radius() const
{
return supporting_circle().squared_radius();

View File

@ -357,22 +357,8 @@ namespace CircularFunctors {
//using CK::Linear_kernel::Intersect_2::operator();
template<typename>
struct result;
template<typename F, typename A, typename B>
struct result<F(A,B)> {
typedef typename Intersection_traits<CK, A, B>::result_type type;
};
//need a specialization for the case of 3 object in CK
template<typename F, typename A, typename B, typename OutputIterator>
struct result<F(A,B,OutputIterator)> {
typedef OutputIterator type;
};
template<class A, class B>
typename Intersection_traits<CK, A, B>::result_type
decltype(auto)
operator()(const A& a, const B& b) const{
return typename CK::Linear_kernel::Intersect_2()(a,b);
}
@ -482,21 +468,6 @@ namespace CircularFunctors {
{
public:
template<typename>
struct result;
template<typename F>
struct result<F(typename CK::Line_2)>
{
typedef typename CK::Polynomial_1_2 type;
};
template<typename F>
struct result<F(typename CK::Circle_2)>
{
typedef typename CK::Polynomial_for_circles_2_2 type;
};
typename CK::Polynomial_1_2
operator() ( const typename CK::Line_2 & l )
{
@ -1014,22 +985,8 @@ namespace CircularFunctors {
typedef typename CK::Point_2 Point_2;
typedef typename CK::Circle_2 Circle_2;
public:
template<typename>
struct result{
typedef FT type;
};
template<typename F>
struct result<F(Circular_arc_2)> {
typedef typename cpp11::result_of<LK_Compute_squared_radius_2(Circle_2)>::type type;
};
template<typename F>
struct result<F(Circle_2)> {
typedef typename cpp11::result_of<LK_Compute_squared_radius_2(Circle_2)>::type type;
};
typename cpp11::result_of<LK_Compute_squared_radius_2(Circle_2)>::type
decltype(auto)
operator()( const Circle_2& c) const
{ return LK_Compute_squared_radius_2()(c); }
@ -1042,7 +999,7 @@ namespace CircularFunctors {
FT operator()( const Point_2& p, const Point_2& q, const Point_2& r) const
{ return LK_Compute_squared_radius_2()(p, q, r); }
typename cpp11::result_of<LK_Compute_squared_radius_2(Circle_2)>::type
decltype(auto)
operator()(const Circular_arc_2& c) const
{ return c.rep().squared_radius(); }

View File

@ -21,7 +21,6 @@
#include <CGAL/license/Circular_kernel_2.h>
#include <CGAL/result_of.h>
#include <CGAL/Bbox_2.h>
namespace CGAL {
@ -91,25 +90,25 @@ public:
: RLine_arc_2(a)
{}
typename cpp11::result_of< typename R::Construct_circular_source_vertex_2(Line_arc_2)>::type
decltype(auto)
source() const
{
return typename R::Construct_circular_source_vertex_2()(*this);
}
typename cpp11::result_of< typename R::Construct_circular_target_vertex_2(Line_arc_2)>::type
decltype(auto)
target() const
{
return typename R::Construct_circular_target_vertex_2()(*this);
}
typename cpp11::result_of< typename R::Construct_circular_min_vertex_2(Line_arc_2)>::type
decltype(auto)
left() const
{
return typename R::Construct_circular_min_vertex_2()(*this);
}
typename cpp11::result_of< typename R::Construct_circular_max_vertex_2(Line_arc_2)>::type
decltype(auto)
right() const
{
return typename R::Construct_circular_max_vertex_2()(*this);

View File

@ -20,7 +20,6 @@
#include <CGAL/license/Circular_kernel_3.h>
#include <CGAL/result_of.h>
#include <CGAL/Bbox_3.h>
namespace CGAL {
@ -117,19 +116,19 @@ namespace CGAL {
: RCircular_arc_3(a)
{}
typename cpp11::result_of<typename R::Construct_circular_source_vertex_3(Circular_arc_3)>::type
decltype(auto)
source() const
{
return typename R::Construct_circular_source_vertex_3()(*this);
}
typename cpp11::result_of<typename R::Construct_circular_target_vertex_3(Circular_arc_3)>::type
decltype(auto)
target() const
{
return typename R::Construct_circular_target_vertex_3()(*this);
}
typename cpp11::result_of<typename R::Construct_circle_3(Circular_arc_3)>::type
decltype(auto)
supporting_circle() const
{
return typename R::Construct_circle_3()(*this);

View File

@ -20,7 +20,6 @@
#include <CGAL/license/Circular_kernel_3.h>
#include <CGAL/result_of.h>
#include <CGAL/Bbox_3.h>
#include <iostream>
@ -196,15 +195,15 @@ public:
typename cpp11::result_of<typename R::Compute_circular_x_3(Circular_arc_point_3)>::type
decltype(auto)
x() const
{ return typename R::Compute_circular_x_3()(*this);}
typename cpp11::result_of<typename R::Compute_circular_y_3(Circular_arc_point_3)>::type
decltype(auto)
y() const
{ return typename R::Compute_circular_y_3()(*this);}
typename cpp11::result_of<typename R::Compute_circular_z_3(Circular_arc_point_3)>::type
decltype(auto)
z() const
{ return typename R::Compute_circular_z_3()(*this);}

View File

@ -567,15 +567,6 @@ template < class SK > \
typedef typename SK::Kernel_base::Circle_3 RCircle_3;
typedef typename Circle_3::Rep Rep;
public:
template<typename>
struct result {
typedef forwarded_result_type type;
};
template<typename F>
struct result<F(Circular_arc_3)> {
typedef const forwarded_result_type& type;
};
forwarded_result_type
operator()(const Point_3& p, const FT& sr,
@ -1019,44 +1010,17 @@ template < class SK > \
public:
template <typename>
struct result;
// the binary overload always goes to Linear::Intersect_3
template <typename F, typename A, typename B>
struct result<F(A, B)>
{ typedef typename Intersection_traits<SK, A, B>::result_type type; };
// This one is only for the spherical kernel, O is an output iterator
template <typename F, typename A, typename B, typename OutputIterator>
struct result<F(A, B, OutputIterator)>
{ typedef OutputIterator type;};
// there is no quaternary form in the linear Kernel
template <typename F, typename A, typename B, typename C, typename OutputIterator>
struct result<F(A, B, C, OutputIterator)>
{ typedef OutputIterator type; };
//only ternary from the linear kernel
template<typename F>
struct result<F(Plane_3, Plane_3, Plane_3)> {
typedef boost::optional<
boost::variant< Point_3,
Line_3,
Plane_3 > > type;
};
//using SK::Linear_kernel::Intersect_3::operator();
typedef typename SK::Linear_kernel::Intersect_3 Intersect_linear_3;
template<class A, class B>
typename Intersection_traits<SK, A, B>::result_type
decltype(auto)
operator()(const A& a, const B& b) const{
return Intersect_linear_3()(a,b);
}
typename result<Intersect_linear_3(Plane_3, Plane_3, Plane_3)>::type
decltype(auto)
operator()(const Plane_3& p, const Plane_3& q, const Plane_3& r) const
{
return Intersect_linear_3()(p, q, r);

View File

@ -41,33 +41,6 @@ namespace CGAL {
typedef typename SK::Polynomials_for_circle_3 result_type_for_circle;
//using LinearFunctors::Get_equation<SK>::operator();
template <typename>
struct result;
template <typename F>
struct result<F(typename SK::Sphere_3)>
{
typedef result_type_for_sphere type;
};
template <typename F>
struct result<F(typename SK::Plane_3)>
{
typedef result_type_for_plane type;
};
template <typename F>
struct result<F(typename SK::Line_3)>
{
typedef result_type_for_line type;
};
template <typename F>
struct result<F(typename SK::Circle_3)>
{
typedef result_type_for_circle type;
};
result_type_for_sphere
operator() ( const typename SK::Sphere_3 & s )
{

View File

@ -20,7 +20,6 @@
#include <CGAL/license/Circular_kernel_3.h>
#include <CGAL/result_of.h>
#include <CGAL/Bbox_3.h>
@ -122,31 +121,31 @@ namespace CGAL {
: RLine_arc_3(a)
{}
typename cpp11::result_of<typename R::Construct_circular_source_vertex_3(Line_arc_3)>::type
decltype(auto)
source() const
{
return typename R::Construct_circular_source_vertex_3()(*this);
}
typename cpp11::result_of<typename R::Construct_circular_target_vertex_3(Line_arc_3)>::type
decltype(auto)
target() const
{
return typename R::Construct_circular_target_vertex_3()(*this);
}
typename cpp11::result_of<typename R::Construct_circular_min_vertex_3(Line_arc_3)>::type
decltype(auto)
lower_xyz_extremity() const
{
return typename R::Construct_circular_min_vertex_3()(*this);
}
typename cpp11::result_of<typename R::Construct_circular_max_vertex_3(Line_arc_3)>::type
decltype(auto)
higher_xyz_extremity() const
{
return typename R::Construct_circular_max_vertex_3()(*this);
}
typename cpp11::result_of<typename R::Construct_line_3(Line_arc_3)>::type
decltype(auto)
supporting_line() const
{
return typename R::Construct_line_3()(*this);

View File

@ -199,7 +199,7 @@ Example of cluster classification mesh (left: input, middle: clusters computed f
%Classification relies on a classifier: this classifier is an object that, from the set of values taken by the features at an input item, computes the probability that an input item belongs to one label or another. A model of the concept `CGAL::Classification::Classifier` must take the index of an input item and store the probability associated to each label in a vector. If a classifier returns the value 1 for a pair of label and input item, it means that this item belongs to this label with certainty; values close to 0 mean that this item is not likely to belong to this label.
\cgal provides four models for this concept, [ETHZ::Random_forest_classifier](@ref CGAL::Classification::ETHZ::Random_forest_classifier), [OpenCV::Random_forest_classifier](@ref CGAL::Classification::OpenCV::Random_forest_classifier), [TensorFlow::Neural_network_classifier](@ref CGAL::Classification::TensorFlow::Neural_network_classifier) and [Sum_of_weighted_features_classifier](@ref CGAL::Classification::Sum_of_weighted_features_classifier).
\cgal provides three models for this concept, [ETHZ::Random_forest_classifier](@ref CGAL::Classification::ETHZ::Random_forest_classifier), [OpenCV::Random_forest_classifier](@ref CGAL::Classification::OpenCV::Random_forest_classifier), and [Sum_of_weighted_features_classifier](@ref CGAL::Classification::Sum_of_weighted_features_classifier).
\note Currently, [ETHZ::Random_forest_classifier](@ref CGAL::Classification::ETHZ::Random_forest_classifier)
is the best classifier available in \cgal and we strongly advise users
@ -255,31 +255,6 @@ use this classifier. For more details about the algorithm, please refer
to [the official documentation](https://docs.opencv.org/2.4/modules/ml/doc/random_trees.html)
of OpenCV.
\subsection Classification_TensorFlow_neural_network TensorFlow Neural Network
\cgal provides [TensorFlow::Neural_network_classifier](@ref CGAL::Classification::TensorFlow::Neural_network_classifier).
It uses the C++ API of the \ref thirdpartyTensorFlow library.
\warning This feature is still experimental: it may not be stable
and is likely to undergo substantial changes in future releases of
\cgal. The API changes will be announced in the release notes.
The provided interface is a feature-based neural network: a set of
features is used as an input layer followed by a user-specified number
of hidden layers with a user-specified activation function. The output
layer is a softmax layer providing, for each label, the probability
that an input item belongs to it.
This classifier cannot be set up by hand and requires a ground truth
training set. The training algorithm usually requires a higher number
of inliers than random forest. The quality of the results, so far, is
comparable to random forest.
An [example](\ref Classification_example_tensorflow_neural_network) shows how to
use this classifier. For more details about the algorithm, please refer
to [the TensorFlow tutorials](https://www.tensorflow.org/tutorials/).
\subsection Classification_sowf Sum of Weighted Features
This latest classifier defines the following attributes:
@ -524,14 +499,6 @@ The following example shows how to use the classifier [OpenCV::Random_forest_cla
\cgalExample{Classification/example_opencv_random_forest.cpp}
\subsection Classification_example_tensorflow_neural_network TensorFlow Neural Network
The following example shows how to use the classifier
[TensorFlow::Neural_network_classifier](@ref CGAL::Classification::TensorFlow::Neural_network_classifier)
using an input training set.
\cgalExample{Classification/example_tensorflow_neural_network.cpp}
\subsection Classification_example_mesh Mesh Classification
The following example:

View File

@ -15,7 +15,6 @@ Concept describing a classifier used by classification functions (see
\cgalHasModel `CGAL::Classification::Sum_of_weighted_features_classifier`
\cgalHasModel `CGAL::Classification::ETHZ::Random_forest_classifier`
\cgalHasModel `CGAL::Classification::OpenCV::Random_forest_classifier`
\cgalHasModel `CGAL::Classification::TensorFlow::Neural_network_classifier`
*/
class Classifier

View File

@ -24,11 +24,6 @@ Classifiers that use the ETHZ library.
Classifiers that use the \ref thirdpartyOpenCV library.
\defgroup PkgClassificationClassifiersTensorFlow TensorFlow
\ingroup PkgClassificationClassifiers
Classifiers that use the \ref thirdpartyTensorFlow library.
\defgroup PkgClassificationDataStructures Common Data Structures
\ingroup PkgClassificationRef
@ -102,7 +97,6 @@ Data structures specialized to classify clusters.
- `CGAL::Classification::ETHZ::Random_forest_classifier`
- `CGAL::Classification::OpenCV::Random_forest_classifier`
- `CGAL::Classification::TensorFlow::Neural_network_classifier<ActivationFunction>`
- `CGAL::Classification::Sum_of_weighted_features_classifier`
\cgalCRPSection{Common Data Structures}

View File

@ -5,7 +5,6 @@
\example Classification/example_ethz_random_forest.cpp
\example Classification/example_deprecated_conversion.cpp
\example Classification/example_opencv_random_forest.cpp
\example Classification/example_tensorflow_neural_network.cpp
\example Classification/example_mesh_classification.cpp
\example Classification/example_cluster_classification.cpp
*/

View File

@ -46,15 +46,6 @@ if(NOT TARGET CGAL::OpenCV_support)
)
endif()
find_package(TensorFlow QUIET)
include(CGAL_TensorFlow_support)
if(NOT TARGET CGAL::TensorFlow_support)
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)
include(CGAL_Eigen3_support)
if(NOT TARGET CGAL::Eigen3_support)
@ -85,13 +76,6 @@ if (TARGET CGAL::OpenCV_support)
PUBLIC CGAL::OpenCV_support)
endif()
if(TARGET CGAL::TensorFlow_support)
create_single_source_cgal_program("example_tensorflow_neural_network.cpp")
target_link_libraries(example_opencv_random_forest
PUBLIC CGAL::TensorFlow_support)
endif()
foreach(target
example_classification
example_ethz_random_forest
@ -100,7 +84,6 @@ foreach(target
example_mesh_classification
example_cluster_classification
example_opencv_random_forest
example_tensorflow_neural_network
gis_tutorial_example
example_deprecated_conversion)
if(TARGET ${target})

View File

@ -86,7 +86,12 @@ int main (int argc, char** argv)
#endif
generator.generate_point_based_features (pointwise_features);
generator.generate_normal_based_features (pointwise_features, pts.normal_map());
// Generator should only be used with variables defined at the scope
// of the generator object, thus we instantiate the normal map
// outside of the function
Vmap normal_map = pts.normal_map();
generator.generate_normal_based_features (pointwise_features, normal_map);
#ifdef CGAL_LINKED_WITH_TBB
pointwise_features.end_parallel_additions();
@ -156,8 +161,8 @@ int main (int argc, char** argv)
// First, compute means of features.
features.begin_parallel_additions();
for (Feature_handle fh : pointwise_features)
features.add<Feature::Cluster_mean_of_feature> (clusters, fh);
for (std::size_t i = 0; i < pointwise_features.size(); ++ i)
features.add<Feature::Cluster_mean_of_feature> (clusters, pointwise_features[i]);
features.end_parallel_additions();
// Then, compute variances of features (and remaining cluster features).

View File

@ -1,140 +0,0 @@
#if defined (_MSC_VER) && !defined (_WIN64)
#pragma warning(disable:4244) // boost::number_distance::distance()
// converts 64 to 32 bits integers
#endif
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <string>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Classification.h>
#include <CGAL/Point_set_3.h>
#include <CGAL/Point_set_3/IO.h>
#include <CGAL/Real_timer.h>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point;
typedef CGAL::Point_set_3<Point> Point_set;
typedef Kernel::Iso_cuboid_3 Iso_cuboid_3;
typedef Point_set::Point_map Pmap;
typedef Point_set::Property_map<int> Imap;
typedef Point_set::Property_map<unsigned char> UCmap;
namespace Classification = CGAL::Classification;
typedef Classification::Label_handle Label_handle;
typedef Classification::Feature_handle Feature_handle;
typedef Classification::Label_set Label_set;
typedef Classification::Feature_set Feature_set;
typedef Classification::Point_set_feature_generator<Kernel, Point_set, Pmap> Feature_generator;
int main (int argc, char** argv)
{
std::string filename = (argc > 1) ? argv[1] : "data/b9_training.ply";
std::cerr << "Reading input" << std::endl;
std::ifstream in (filename.c_str(), std::ios::binary);
Point_set pts;
in >> pts;
Imap label_map;
bool lm_found = false;
std::tie (label_map, lm_found) = pts.property_map<int> ("label");
if (!lm_found)
{
std::cerr << "Error: \"label\" property not found in input file." << std::endl;
return EXIT_FAILURE;
}
Feature_set features;
std::cerr << "Generating features" << std::endl;
CGAL::Real_timer t;
t.start();
Feature_generator generator (pts, pts.point_map(),
5); // using 5 scales
features.begin_parallel_additions();
generator.generate_point_based_features (features);
features.end_parallel_additions();
t.stop();
std::cerr << "Done in " << t.time() << " second(s)" << std::endl;
// Add labels
Label_set labels;
Label_handle ground = labels.add ("ground");
Label_handle vegetation = labels.add ("vegetation");
Label_handle roof = labels.add ("roof");
std::vector<int> label_indices(pts.size(), -1);
std::cerr << "Using TensorFlow neural network Classifier" << std::endl;
Classification::TensorFlow::Neural_network_classifier<> classifier (labels, features);
std::cerr << "Training" << std::endl;
t.reset();
t.start();
classifier.train (pts.range(ground_truth),
true, // restart from scratch
100); // 100 iterations
t.stop();
std::cerr << "Done in " << t.time() << " second(s)" << std::endl;
t.reset();
t.start();
Classification::classify_with_graphcut<CGAL::Sequential_tag>
(pts, pts.point_map(), labels, classifier,
generator.neighborhood().k_neighbor_query(12),
0.2f, 1, label_indices);
t.stop();
std::cerr << "Classification with graphcut done in " << t.time() << " second(s)" << std::endl;
std::cerr << "Precision, recall, F1 scores and IoU:" << std::endl;
Classification::Evaluation evaluation (labels, pts.range(ground_truth), label_indices);
for (Label_handle l : labels)
{
std::cerr << " * " << l->name() << ": "
<< evaluation.precision(l) << " ; "
<< evaluation.recall(l) << " ; "
<< evaluation.f1_score(l) << " ; "
<< evaluation.intersection_over_union(l) << std::endl;
}
std::cerr << "Accuracy = " << evaluation.accuracy() << std::endl
<< "Mean F1 score = " << evaluation.mean_f1_score() << std::endl
<< "Mean IoU = " << evaluation.mean_intersection_over_union() << std::endl;
// Color point set according to class
UCmap red = pts.add_property_map<unsigned char>("red", 0).first;
UCmap green = pts.add_property_map<unsigned char>("green", 0).first;
UCmap blue = pts.add_property_map<unsigned char>("blue", 0).first;
for (std::size_t i = 0; i < label_indices.size(); ++ i)
{
label_map[i] = label_indices[i]; // update label map with computed classification
Label_handle label = labels[label_indices[i]];
const CGAL::Color& color = label->color();
red[i] = color.red();
green[i] = color.green();
blue[i] = color.blue();
}
// Write result
std::ofstream f ("classification.ply");
f.precision(18);
f << pts;
std::cerr << "All done" << std::endl;
return EXIT_SUCCESS;
}

View File

@ -22,10 +22,6 @@
#include <CGAL/Classification/OpenCV/Random_forest_classifier.h>
#endif
#ifdef CGAL_LINKED_WITH_TENSORFLOW
#include <CGAL/Classification/TensorFlow/Neural_network_classifier.h>
#endif
#include <CGAL/Classification/Cluster.h>
#include <CGAL/Classification/Evaluation.h>
#include <CGAL/Classification/Feature_base.h>

View File

@ -31,7 +31,7 @@
#include <list>
#include <CGAL/IO/binary_file_io.h>
#include <boost/version.hpp>
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/random/mersenne_twister.hpp>
#if BOOST_VERSION >= 104700

View File

@ -228,7 +228,7 @@ public:
{
#ifdef CGAL_LINKED_WITH_TBB
m_tasks->wait();
m_tasks.release();
m_tasks.reset();
m_adders.clear();
#endif
}

View File

@ -22,7 +22,6 @@
#include <CGAL/Kernel_traits.h>
#include <CGAL/convex_hull_3.h>
#include <CGAL/result_of.h>
namespace CGAL {
namespace Convex_hull_3 {
@ -37,14 +36,14 @@ struct Forward_functor
Forward_functor(const PointPropertyMap& vpm, const F& f) : F(f), vpm_(vpm) {}
template <class Vertex>
typename cpp11::result_of<F(const Vertex&, const Vertex&)>::type
decltype(auto)
operator()(const Vertex& p, const Vertex& q) const
{
return static_cast<const F*>(this)->operator()(get(vpm_, p), get(vpm_, q));
}
template <class Vertex>
typename cpp11::result_of<F(const Vertex&, const Vertex&, const Vertex&)>::type
decltype(auto)
operator()(const Vertex& p, const Vertex& q, const Vertex& r) const
{
return static_cast<const F*>(this)->operator()(get(vpm_, p),
@ -53,7 +52,7 @@ struct Forward_functor
}
template <class Vertex>
typename cpp11::result_of<F(const Vertex&, const Vertex&, const Vertex&, const Vertex&)>::type
decltype(auto)
operator()(const Vertex& p, const Vertex& q, const Vertex& r, const Vertex& s) const
{
return static_cast<const F*>(this)->operator()(get(vpm_, p),

View File

@ -256,27 +256,6 @@ executables should be linked with the CMake imported target
The \opencv web site is <A HREF="https://opencv.org/">`https://opencv.org/`</A>.
\subsection thirdpartyTensorFlow TensorFlow
\tensorflow is a library designed for machine learning and deep learning.
In \cgal, the C++ API of \tensorflow is used by the \ref
PkgClassification package for neural network. The C++ API can be
compiled using CMake: it is distributed as part of the official
package and is located in `tensorflow/contrib/cmake`. Be sure to
enable and compile the following targets:
- `tensorflow_BUILD_ALL_KERNELS`
- `tensorflow_BUILD_PYTHON_BINDINGS`
- `tensorflow_BUILD_SHARED_LIB`.
In order to use \tensorflow in \cgal programs, the executables
should be linked with the CMake imported target
`CGAL::TensorFlow_support` provided in
`CGAL_TensorFlow_support.cmake`.
The \tensorflow web site is <A HREF="https://www.tensorflow.org/">`https://www.tensorflow.org/`</A>.
\subsection thirdpartyMETIS METIS
<b>Version 5.1 or later</b>
@ -310,6 +289,10 @@ requires solving complex non-linear least squares problems.
Visit the official website of the library at <A HREF="http://ceres-solver.org/index.html">`ceres-solver.org`</A>
for more information.
\attention \ceres indicates that `glog` is a recommended dependency. `glog` has `libunwind` as a recommended dependency.
On some platforms, linking with `libunwind` was responsible for an increase of the runtime of the final application.
If you experience such an issue, we recommand to compile \ceres without `glog` support.
\subsection thirdpartyGLPK GLPK
\glpk (GNU Linear Programming Kit) is a library for solving linear programming (LP), mixed integer programming (MIP), and other related problems.

View File

@ -354,15 +354,6 @@ If LASLIB is not automatically found, the following variables must be set:
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

View File

@ -470,6 +470,7 @@ public:
};
// Macro helpers to build the kernel objects
#define CGAL_PARAM(z, n, t) std::declval<t##n>()
#define CGAL_TYPEMAP_AC(z, n, t) typedef typename Type_mapper< t##n, LK, AK >::type A##n;
#define CGAL_TYPEMAP_EC(z, n, t) typedef typename Type_mapper< t##n, LK, EK >::type E##n;
#define CGAL_LEXACT(z,n,t) CGAL::exact( l##n )
@ -857,7 +858,8 @@ struct Lazy_construction_bbox
CGAL_NO_UNIQUE_ADDRESS EC ec;
template <typename L1>
result_type operator()(const L1& l1) const
decltype(auto)
operator()(const L1& l1) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
// Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG
@ -977,20 +979,6 @@ struct Lazy_construction_nt {
CGAL_NO_UNIQUE_ADDRESS AC ac;
CGAL_NO_UNIQUE_ADDRESS EC ec;
template<typename>
struct result { };
#define CGAL_RESULT_NT(z, n, d) \
template< typename F, BOOST_PP_ENUM_PARAMS(n, class T) > \
struct result<F( BOOST_PP_ENUM_PARAMS(n, T) )> { \
BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, T) \
typedef Lazy_exact_nt< \
typename boost::remove_cv< typename boost::remove_reference < \
typename cpp11::result_of<EC( BOOST_PP_ENUM_PARAMS(n, E) )>::type >::type >::type > type; \
};
BOOST_PP_REPEAT_FROM_TO(1, 6, CGAL_RESULT_NT, _)
template<class...L>
auto operator()(L const&...l) const ->
Lazy_exact_nt<std::remove_cv_t<std::remove_reference_t<decltype(ec(CGAL::exact(l)...))>>>
@ -1007,8 +995,6 @@ struct Lazy_construction_nt {
return new Lazy_rep_0<AT,ET,To_interval<ET> >(ec( CGAL::exact(l)... ));
}
}
#undef CGAL_RESULT_NT
};
@ -1404,7 +1390,7 @@ struct Lazy_construction_object
public:
template <typename L1>
result_type
decltype(auto)
operator()(const L1& l1) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
@ -1437,7 +1423,7 @@ public:
}
template <typename L1, typename L2>
result_type
decltype(auto)
operator()(const L1& l1, const L2& l2) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
@ -1491,7 +1477,7 @@ CGAL_Kernel_obj(Point_3)
}
template <typename L1, typename L2, typename L3>
result_type
decltype(auto)
operator()(const L1& l1, const L2& l2, const L3& l3) const
{
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
@ -1530,7 +1516,7 @@ CGAL_Kernel_obj(Point_3)
//____________________________________________________________
// The magic functor that has Lazy<Something> as result type.
// Two versions are distinguished: one that needs to fiddle
// with result_of and another that can forward the result types.
// with decltype and another that can forward the result types.
namespace internal {
BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type)
@ -1652,20 +1638,23 @@ struct Lazy_construction_variant {
struct result<F( BOOST_PP_ENUM_PARAMS(n, T) )> { \
BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, T) \
typedef typename Type_mapper< \
typename cpp11::result_of<AC( BOOST_PP_ENUM_PARAMS(n, A) )>::type, AK, LK>::type type; \
decltype(std::declval<AC>()(BOOST_PP_ENUM(n, CGAL_PARAM, A))), AK, LK>::type type; \
};
BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_RESULT, _)
template <typename L1, typename L2>
typename result<Lazy_construction_variant(L1, L2)>::type
decltype(auto)
operator()(const L1& l1, const L2& l2) const {
typedef typename cpp11::result_of<Lazy_construction_variant(L1, L2)>::type result_type;
typedef typename result<Lazy_construction_variant(L1, L2)>::type result_type;
typedef typename cpp11::result_of<AC(typename Type_mapper<L1, LK, AK>::type,
typename Type_mapper<L2, LK, AK>::type)>::type AT;
typedef typename cpp11::result_of<EC(typename Type_mapper<L1, LK, EK>::type,
typename Type_mapper<L2, LK, EK>::type)>::type ET;
// typedef decltype(std::declval<AC>()(std::declval<typename Type_mapper<L1, LK, AK>::type>(),
// std::declval<typename Type_mapper<L2, LK, AK>::type>())) AT;
// typedef decltype(std::declval<EC>()(std::declval<typename Type_mapper<L1, LK, EK>::type>(),
// std::declval<typename Type_mapper<L2, LK, EK>::type>())) ET;
typedef decltype(std::declval<AC const&>()(CGAL::approx(l1), CGAL::approx(l2))) AT;
typedef decltype(std::declval<EC const&>()( CGAL::exact(l1), CGAL::exact(l2))) ET;
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
@ -1706,19 +1695,23 @@ struct Lazy_construction_variant {
}
template <typename L1, typename L2, typename L3>
typename result<Lazy_construction_variant(L1, L2, L3)>::type
decltype(auto)
operator()(const L1& l1, const L2& l2, const L3& l3) const {
typedef typename result<Lazy_construction_variant(L1, L2, L3)>::type result_type;
typedef typename cpp11::result_of<AC(typename Type_mapper<L1, LK, AK>::type,
typename Type_mapper<L2, LK, AK>::type,
typename Type_mapper<L3, LK, AK>::type)>::type AT;
typedef typename cpp11::result_of<EC(typename Type_mapper<L1, LK, EK>::type,
typename Type_mapper<L2, LK, EK>::type,
typename Type_mapper<L3, LK, EK>::type)>::type ET;
// typedef decltype(std::declval<AC>()(std::declval<typename Type_mapper<L1, LK, AK>::type>(),
// std::declval<typename Type_mapper<L2, LK, AK>::type>(),
// std::declval<typename Type_mapper<L3, LK, AK>::type>())) AT;
// typedef decltype(std::declval<EC>()(std::declval<typename Type_mapper<L1, LK, EK>::type>(),
// std::declval<typename Type_mapper<L2, LK, EK>::type>(),
// std::declval<typename Type_mapper<L3, LK, EK>::type>())) ET;
typedef decltype(std::declval<AC const&>()(CGAL::approx(l1), CGAL::approx(l2), CGAL::approx(l3))) AT;
typedef decltype(std::declval<EC const&>()( CGAL::exact(l1), CGAL::exact(l2), CGAL::exact(l3))) ET;
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
Protect_FPU_rounding<Protection> P;
try {
Lazy<AT, ET, E2A> lazy(new Lazy_rep_n<AT, ET, AC, EC, E2A, L1, L2, L3>(AC(), EC(), l1, l2, l3));
@ -1770,7 +1763,7 @@ struct Lazy_construction<LK, AC, EC, E2A_, true> {
typedef typename boost::remove_cv<
typename boost::remove_reference < typename AC::result_type >::type >::type AT;
typedef typename boost::remove_cv<
typename boost::remove_reference < typename EC::result_type >::type >::type ET;
typename boost::remove_reference < typename EC::result_type >::type >::type ET;
typedef typename Default::Get<E2A_, typename LK::E2A>::type E2A;
@ -1781,7 +1774,7 @@ struct Lazy_construction<LK, AC, EC, E2A_, true> {
#define CGAL_CONSTRUCTION_OPERATOR(z, n, d ) \
template<BOOST_PP_ENUM_PARAMS(n, class L)> \
result_type \
decltype(auto) \
operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \
typedef Lazy< AT, ET, E2A> Handle; \
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \
@ -1799,7 +1792,7 @@ struct Lazy_construction<LK, AC, EC, E2A_, true> {
BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_CONSTRUCTION_OPERATOR, _)
// nullary
result_type
decltype(auto)
operator()() const
{
typedef Lazy<AT, ET, E2A> Handle;
@ -1830,27 +1823,18 @@ struct Lazy_construction<LK, AC, EC, E2A_, false>
CGAL_NO_UNIQUE_ADDRESS EC ec;
// acquire the result_type of the approximate kernel, map it back to the lazy kernel object
#define CGAL_RESULT(z, n, d) \
template< typename F, BOOST_PP_ENUM_PARAMS(n, class T) > \
struct result<F( BOOST_PP_ENUM_PARAMS(n, T) )> { \
BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, T) \
typedef typename Type_mapper< typename cpp11::result_of<AC( BOOST_PP_ENUM_PARAMS(n, A) )>::type, AK, LK>::type type; \
};
BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_RESULT, _)
#define CGAL_CONSTRUCTION_OPERATOR(z, n, d) \
template<BOOST_PP_ENUM_PARAMS(n, class L)> \
typename cpp11::result_of<Lazy_construction(BOOST_PP_ENUM_PARAMS(n, L))>::type \
decltype(auto) \
operator()( BOOST_PP_ENUM(n, CGAL_LARGS, _) ) const { \
BOOST_PP_REPEAT(n, CGAL_TYPEMAP_EC, L) \
BOOST_PP_REPEAT(n, CGAL_TYPEMAP_AC, L) \
typedef typename boost::remove_cv< typename boost::remove_reference < \
typename cpp11::result_of< EC(BOOST_PP_ENUM_PARAMS(n, E)) >::type >::type >::type ET; \
typedef typename boost::remove_cv< typename boost::remove_reference < \
typename cpp11::result_of< AC(BOOST_PP_ENUM_PARAMS(n, A)) >::type >::type >::type AT; \
typedef typename Type_mapper<decltype(std::declval<EC>()(BOOST_PP_ENUM(n, CGAL_PARAM, E))),EK,EK>::type ET; \
typedef typename Type_mapper<decltype(std::declval<AC>()(BOOST_PP_ENUM(n, CGAL_PARAM, A))),AK,AK>::type AT; \
typedef Lazy< AT, ET, E2A> Handle; \
typedef typename cpp11::result_of<Lazy_construction(BOOST_PP_ENUM_PARAMS(n, L))>::type result_type; \
typedef typename result<Lazy_construction(BOOST_PP_ENUM_PARAMS(n, L))>::type result_type; \
CGAL_BRANCH_PROFILER(std::string(" failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp); \
Protect_FPU_rounding<Protection> P; \
try { \
@ -1866,13 +1850,13 @@ struct result<F( BOOST_PP_ENUM_PARAMS(n, T) )> { \
BOOST_PP_REPEAT_FROM_TO(1, 9, CGAL_CONSTRUCTION_OPERATOR, _)
// nullary
typename Type_mapper< typename cpp11::result_of<AC()>::type ,AK, LK>::type
decltype(auto)
operator()() const
{
typedef typename cpp11::result_of<AC()>::type AT;
typedef typename cpp11::result_of<EC()>::type ET;
typedef decltype(std::declval<AC>()()) AT;
typedef decltype(std::declval<EC>()()) ET;
typedef Lazy<AT, ET, E2A> Handle;
typedef typename Type_mapper< typename cpp11::result_of<AC()>::type ,AK, LK>::type result_type;
typedef typename Type_mapper<AT, AK, LK>::type result_type;
return result_type( Handle(new Lazy_rep_0<AT,ET,E2A>()) );
}

View File

@ -168,8 +168,9 @@ public:
return this->operator()(s, b);
}
// The parameter overestimate is used to avoid a filter failure in AABB_tree::closest_point()
result_type
operator()(const Sphere_3 &s, const Bbox_3& b) const
operator()(const Sphere_3 &s, const Bbox_3& b, bool overestimate = false) const
{
CGAL_BRANCH_PROFILER_3(std::string("semi-static failures/attempts/calls to : ") +
std::string(CGAL_PRETTY_FUNCTION), tmp);
@ -177,30 +178,47 @@ public:
Get_approx<Point_3> get_approx; // Identity functor for all points
const Point_3& c = s.center();
double scx, scy, scz, ssr, bxmin, bymin, bzmin, bxmax, bymax, bzmax;
double scx, scy, scz, ssr;
double bxmin = b.xmin() , bymin = b.ymin() , bzmin = b.zmin() ,
bxmax = b.xmax() , bymax = b.ymax() , bzmax = b.zmax() ;
if (fit_in_double(get_approx(c).x(), scx) &&
fit_in_double(get_approx(c).y(), scy) &&
fit_in_double(get_approx(c).z(), scz) &&
fit_in_double(s.squared_radius(), ssr) &&
fit_in_double(b.xmin(), bxmin) &&
fit_in_double(b.ymin(), bymin) &&
fit_in_double(b.zmin(), bzmin) &&
fit_in_double(b.xmax(), bxmax) &&
fit_in_double(b.ymax(), bymax) &&
fit_in_double(b.zmax(), bzmax))
fit_in_double(s.squared_radius(), ssr))
{
CGAL_BRANCH_PROFILER_BRANCH_1(tmp);
if ((ssr < 1.11261183279326254436e-293) || (ssr > 2.80889552322236673473e+306)){
CGAL_BRANCH_PROFILER_BRANCH_2(tmp);
return Base::operator()(s,b);
}
double distance = 0;
double max1 = 0;
double double_tmp_result = 0;
double eps = 0;
if(scx < bxmin)
{
double bxmin_scx = bxmin - scx;
max1 = bxmin_scx;
distance = square(bxmin_scx);
double_tmp_result = (distance - ssr);
if( (max1 < 3.33558365626356687717e-147) || (max1 > 1.67597599124282407923e+153) ){
if(overestimate){
return true;
}else{
CGAL_BRANCH_PROFILER_BRANCH_2(tmp);
return Base::operator()(s,b);
}
}
eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1));
if (double_tmp_result > eps){
return false;
}
}
else if(scx > bxmax)
{
@ -208,66 +226,136 @@ public:
max1 = scx_bxmax;
distance = square(scx_bxmax);
double_tmp_result = (distance - ssr);
if( (max1 < 3.33558365626356687717e-147) || (max1 > 1.67597599124282407923e+153)){
if(overestimate){
return true;
}else{
CGAL_BRANCH_PROFILER_BRANCH_2(tmp);
return Base::operator()(s,b);
}
}
eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1));
if (double_tmp_result > eps){
return false;
}
}
if(scy < bymin)
{
double bymin_scy = bymin - scy;
if(max1 < bymin_scy)
if(max1 < bymin_scy){
max1 = bymin_scy;
}
distance += square(bymin_scy);
double_tmp_result = (distance - ssr);
if( (max1 < 3.33558365626356687717e-147) || ((max1 > 1.67597599124282407923e+153)) ){
if(overestimate){
return true;
}else{
CGAL_BRANCH_PROFILER_BRANCH_2(tmp);
return Base::operator()(s,b);
}
}
eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1));
if (double_tmp_result > eps){
return false;
}
}
else if(scy > bymax)
{
double scy_bymax = scy - bymax;
if(max1 < scy_bymax)
if(max1 < scy_bymax){
max1 = scy_bymax;
}
distance += square(scy_bymax);
double_tmp_result = (distance - ssr);
if( ((max1 < 3.33558365626356687717e-147)) || ((max1 > 1.67597599124282407923e+153)) ){
if(overestimate){
return true;
}else{
CGAL_BRANCH_PROFILER_BRANCH_2(tmp);
return Base::operator()(s,b);
}
}
eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1));
if (double_tmp_result > eps){
return false;
}
}
if(scz < bzmin)
{
double bzmin_scz = bzmin - scz;
if(max1 < bzmin_scz)
if(max1 < bzmin_scz){
max1 = bzmin_scz;
}
distance += square(bzmin_scz);
double_tmp_result = (distance - ssr);
if( ((max1 < 3.33558365626356687717e-147)) || ((max1 > 1.67597599124282407923e+153))){
if(overestimate){
return true;
}else{
CGAL_BRANCH_PROFILER_BRANCH_2(tmp);
return Base::operator()(s,b);
}
}
eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1));
if (double_tmp_result > eps){
return false;
}
}
else if(scz > bzmax)
{
double scz_bzmax = scz - bzmax;
if(max1 < scz_bzmax)
if(max1 < scz_bzmax){
max1 = scz_bzmax;
}
distance += square(scz_bzmax);
}
double_tmp_result = (distance - ssr);
double double_tmp_result = (distance - ssr);
double max2 = CGAL::abs(ssr);
if ((max1 < 3.33558365626356687717e-147) || (max2 < 1.11261183279326254436e-293)){
CGAL_BRANCH_PROFILER_BRANCH_2(tmp);
return Base::operator()(s,b);
}
if ((max1 > 1.67597599124282407923e+153) || (max2 > 2.80889552322236673473e+306)){
CGAL_BRANCH_PROFILER_BRANCH_2(tmp);
return Base::operator()(s,b);
}
double eps = 1.99986535548615598560e-15 * (std::max) (max2, (max1 * max1));
if (double_tmp_result > eps)
return false;
else
{
if (double_tmp_result < -eps)
return true;
else {
CGAL_BRANCH_PROFILER_BRANCH_2(tmp);
return Base::operator()(s,b);
if( ((max1 < 3.33558365626356687717e-147)) || ((max1 > 1.67597599124282407923e+153)) ){
if(overestimate){
return true;
}else{
CGAL_BRANCH_PROFILER_BRANCH_2(tmp);
return Base::operator()(s,b);
}
}
eps = 1.99986535548615598560e-15 * (std::max) (ssr, square(max1));
if (double_tmp_result > eps){
return false;
}
}
// double_tmp_result and eps were growing all the time
// no need to test for > eps as done earlier in at least one case
if (double_tmp_result < -eps){
return true;
} else {
if(overestimate){
return true;
}
CGAL_BRANCH_PROFILER_BRANCH_2(tmp);
return Base::operator()(s,b);
}
CGAL_BRANCH_PROFILER_BRANCH_2(tmp);

View File

@ -82,6 +82,24 @@ public:
return Base::operator()(p, q);
}
result_type operator()(const Vector_3 &p, const Null_vector &q) const
{
CGAL_BRANCH_PROFILER(std::string("semi-static attempts/calls to : ") +
std::string(CGAL_PRETTY_FUNCTION), tmp);
Get_approx<Vector_3> get_approx; // Identity functor for all points
// but lazy points
double px, py, pz;
if (fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(p).y(), py) &&
fit_in_double(get_approx(p).z(), pz) )
{
CGAL_BRANCH_PROFILER_BRANCH(tmp);
return px == 0 && py == 0 && pz == 0;
}
return Base::operator()(p, q);
}
}; // end class Equal_3
} // end namespace Static_filters_predicates

View File

@ -35,7 +35,7 @@ int main()
obj = CGAL::intersection(s1,s2);
// check the variant return type
CGAL::cpp11::result_of<K::Intersect_2(Triangle_2, Triangle_2) >::type o_variant = CGAL::intersection(t1,t2);
const auto o_variant = CGAL::intersection(t1,t2);
if(!o_variant) {
std::cerr << "ERROR, empty" << std::endl;
return EXIT_FAILURE;
@ -75,7 +75,7 @@ int main()
}
// check the variant return type
CGAL::cpp11::result_of<K::Intersect_3(Triangle_3, Triangle_3)>::type o_variant = CGAL::intersection(t1,t2);
const auto o_variant = CGAL::intersection(t1,t2);
if(!o_variant) {
std::cerr << "ERROR, empty" << std::endl;
return EXIT_FAILURE;

View File

@ -18,6 +18,7 @@
#include <CGAL/generators.h>
#include <CGAL/Random.h>
#include <CGAL/property_map.h>
#include <CGAL/result_of.h>
#include <vector>

View File

@ -21,6 +21,7 @@
#include <CGAL/function_objects.h>
#include <CGAL/copy_n.h>
#include <CGAL/number_type_config.h>
#include <CGAL/double.h>
#include <list>
namespace CGAL {
@ -192,7 +193,7 @@ void random_convex_hull_in_disc_2(std::size_t n, double radius, std::list<typena
(simulated_points < n)); // initialization such that 0 in P_n
std::size_t T = n;
if (!fast) T = static_cast<std::size_t>(std::floor(n / std::pow(std::log(static_cast<double>(n)), 2)));
if (!fast) T = static_cast<std::size_t>(std::floor(n / CGAL::square(std::log(static_cast<double>(n)))));
while (simulated_points < n) {
// l is a list coming from a convex hull operation. we are moving the

View File

@ -395,7 +395,11 @@ public:
// halfedges, and f faces. The reservation sizes are a hint for
// optimizing storage allocation. They are not used here.
~HalfedgeDS_list() { clear(); }
~HalfedgeDS_list() noexcept {
try {
clear();
} catch (...) {}
}
HalfedgeDS_list( const Self& hds)
: vertices( hds.vertices),

View File

@ -485,9 +485,6 @@ public:
template<class VertexDistanceMap>
void estimate_geodesic_distances(VertexDistanceMap vdm)
{
CGAL_precondition(
!CGAL::Heat_method_3::internal::has_degenerate_faces(triangle_mesh(), Traits()));
if(is_empty(tm)){
return;
}
@ -666,6 +663,9 @@ struct Base_helper
template <class VertexDistanceMap>
void estimate_geodesic_distances(VertexDistanceMap vdm)
{
CGAL_assertion(
!CGAL::Heat_method_3::internal::has_degenerate_faces(
base().triangle_mesh(), Traits()));
base().estimate_geodesic_distances(vdm);
}
};
@ -751,9 +751,6 @@ struct Base_helper<TriangleMesh, Traits, Intrinsic_Delaunay, LA, VertexPointMap>
template <class VertexDistanceMap>
void estimate_geodesic_distances(VertexDistanceMap vdm)
{
CGAL_precondition(
!CGAL::Heat_method_3::internal::has_degenerate_faces(
this->m_idt.triangle_mesh(), Traits()));
base().estimate_geodesic_distances(this->m_idt.vertex_distance_map(vdm));
}
};
@ -769,11 +766,11 @@ struct Base_helper<TriangleMesh, Traits, Intrinsic_Delaunay, LA, VertexPointMap>
* time after changes to the set of sources.
*
* \tparam TriangleMesh a triangulated surface mesh, model of `FaceListGraph` and `HalfedgeListGraph`
* with no degenerate faces
* \tparam Mode must be `Intrinsic_Delaunay` to indicate that an intrinsic Delaunay triangulation is internally constructed
* or `Direct` to indicate that the input mesh should be used as is.
* If `Intrinsic_Delaunay`, then the type `TriangleMesh` must have an internal property for `vertex_point`
* and its value type must be the same as the value type of `VertexPointMap`.
* If `Direct`, then the input mesh should not have any degenerate faces.
* \tparam VertexPointMap a model of `ReadablePropertyMap` with
* `boost::graph_traits<TriangleMesh>::%vertex_descriptor` as key and
* `Traits::Point_3` as value type.
@ -940,7 +937,7 @@ public:
* \tparam VertexDistanceMap a property map model of `WritablePropertyMap`
* with `vertex_descriptor` as key type and `double` as value type.
* \param vdm the vertex distance map to be filled
* \pre the support triangle mesh does not have any degenerate faces
* \pre If `Mode` is `Direct`, the support triangle mesh does not have any degenerate faces
* \warning The key type is `double` even when used with an exact kernel.
**/
template <class VertexDistanceMap>
@ -961,7 +958,7 @@ public:
/// \tparam Mode either the tag `Direct` or `Intrinsic_Delaunay`, which determines if the geodesic distance
/// is computed directly on the mesh or if the intrinsic Delaunay triangulation is applied first.
/// The default is `Intrinsic_Delaunay`.
/// \pre `tm` does not have any degenerate faces
/// \pre If `Mode` is `Direct`, `tm` does not have any degenerate faces
/// \warning The return type is `double` even when used with an exact kernel.
///
/// \sa `CGAL::Heat_method_3::Surface_mesh_geodesic_distances_3`
@ -1003,7 +1000,7 @@ estimate_geodesic_distances(const TriangleMesh& tm,
/// \tparam Mode either the tag `Direct` or `Intrinsic_Delaunay`, which determines if the geodesic distance
/// is computed directly on the mesh or if the intrinsic Delaunay triangulation is applied first.
/// The default is `Intrinsic_Delaunay`.
/// \pre `tm` does not have any degenerate faces
/// \pre If `Mode` is `Direct`, `tm` mesh does not have any degenerate faces
/// \warning The return type is `double` even when used with an exact kernel.
/// \sa `CGAL::Heat_method_3::Surface_mesh_geodesic_distances_3`
template <typename TriangleMesh, typename VertexDistanceMap, typename VertexConstRange, typename Mode>

View File

@ -43,8 +43,6 @@
namespace CGAL {
namespace Heat_method_3 {
// forward declaration
template <typename IDT>
struct IDT_vertex_point_property_map;
@ -53,6 +51,12 @@ struct IDT_vertex_point_property_map;
template <typename IDT, typename PM>
struct IDT_vertex_distance_property_map;
// forward declaration
namespace internal {
template<typename TriangleMesh, typename Traits>
bool has_degenerate_faces(const TriangleMesh& tm, const Traits& traits);
}
template <class TriangleMesh>
struct Intrinsic_Delaunay_triangulation_3_vertex_descriptor {
typedef typename boost::graph_traits<TriangleMesh>::halfedge_descriptor halfedge_descriptor;
@ -285,6 +289,29 @@ private:
return CGAL::sqrt(S*(S-a)*(S-b)*(S-c));
}
// Mollification strategy to avoid degeneracies
void
mollify(const double delta)
{
// compute smallest length epsilon we can add to
// all edges to ensure that the strict triangle
// inequality holds with a tolerance of delta
double epsilon = 0;
for(halfedge_descriptor hd : halfedges(m_intrinsic_tm)) {
halfedge_descriptor hd2 = next(hd, m_intrinsic_tm);
halfedge_descriptor hd3 = next(hd2,m_intrinsic_tm);
Index i = get(edge_id_map, edge(hd,m_intrinsic_tm));
Index j = get(edge_id_map, edge(hd2,m_intrinsic_tm));
Index k = get(edge_id_map, edge(hd3,m_intrinsic_tm));
double ineq = edge_lengths[j] + edge_lengths[k] - edge_lengths[i];
epsilon = (std::max)(epsilon, (std::max)(0., delta-ineq));
}
// update edge lengths
for(edge_descriptor ed : edges(m_intrinsic_tm)) {
Index i = get(edge_id_map, ed);
edge_lengths[i] += epsilon;
}
}
void
loop_over_edges(edge_stack stack, std::vector<int>& marked_edges)
@ -365,13 +392,19 @@ private:
Index edge_i = 0;
VertexPointMap vpm_intrinsic_tm = get(boost::vertex_point,m_intrinsic_tm);
double min_length = (std::numeric_limits<double>::max)();
for(edge_descriptor ed : edges(m_intrinsic_tm)) {
edge_lengths[edge_i] = CGAL::sqrt(to_double(squared_distance(get(vpm_intrinsic_tm, source(ed,m_intrinsic_tm)),
get(vpm_intrinsic_tm, target(ed,m_intrinsic_tm)))));
// Polygon_mesh_processing::edge_length(halfedge(ed,m_intrinsic_tm),m_intrinsic_tm);
if (edge_lengths[edge_i] != 0 && edge_lengths[edge_i] < min_length) min_length = edge_lengths[edge_i];
put(edge_id_map, ed, edge_i++);
stack.push(ed);
}
if(CGAL::Heat_method_3::internal::has_degenerate_faces(m_intrinsic_tm, Traits()))
mollify(min_length*1e-4);
loop_over_edges(stack, mark_edges);
//now that edges are calculated, go through and for each face, calculate the vertex positions around it

View File

@ -48,3 +48,6 @@ target_link_libraries(heat_method_surface_mesh_test PUBLIC CGAL::Eigen3_support)
create_single_source_cgal_program("heat_method_surface_mesh_direct_test.cpp")
target_link_libraries(heat_method_surface_mesh_direct_test
PUBLIC CGAL::Eigen3_support)
create_single_source_cgal_program("heat_method_surface_mesh_intrinsic_test.cpp")
target_link_libraries(heat_method_surface_mesh_intrinsic_test
PUBLIC CGAL::Eigen3_support)

View File

@ -0,0 +1,762 @@
OFF
270 490 0
0 0 0
1 1 0
2 1 0
0 1 0
1 0 0
2 0 0
1 0.5 0
0.53125 0.47916666666666669 0
1.5 0.5 0
0.48958333333333331 0.22916666666666666 0
0.5 1 0
0 0.5 0
1.5 0 0
2 0.5 0
1.5 1 0
1 0.5 0
0.5 0 0
0.75 0.75 0
0.28749999999999998 0.25 0
0.25 0.75 0
1.75 0.75 0
1.25 0.25 0
1.75 0.25 0
1.25 0.75 0
0.23958333333333334 0.10416666666666667 0
0.75 0.375 0
0.75 0.125 0
1 0.75 0
1 0.25 0
0.75 0.48214285714285715 0
0.75 1 0
0.25 1 0
0.5 0.75 0
0 0.75 0
0 0.25 0
0.25 0.5 0
1.25 0 0
1.75 0 0
1.5 0.25 0
2 0.25 0
2 0.75 0
1.75 0.5 0
1.75 1 0
1.25 1 0
1.5 0.75 0
1 0.75 0
1 0.25 0
1.25 0.5 0
0.25 0 0
0.75 0 0
0.875 0.1875 0
0.85416666666666663 0.85416666666666663 0
0.625 0.6428571428571429 0
0.85416666666666663 0.64583333333333337 0
0.625 0.8571428571428571 0
0.35714285714285715 0.375 0
0.125 0.15625 0
0.14285714285714285 0.375 0
0.375 0.625 0
0.14583333333333334 0.85416666666666663 0
0.14285714285714285 0.625 0
0.375 0.8571428571428571 0
1.8541666666666667 0.85416666666666663 0
1.625 0.625 0
1.8571428571428572 0.625 0
1.625 0.8571428571428571 0
1.375 0.375 0
1.1458333333333333 0.14583333333333334 0
1.375 0.14285714285714285 0
1.1428571428571428 0.375 0
1.625 0.375 0
1.8541666666666667 0.14583333333333334 0
1.8571428571428572 0.375 0
1.625 0.14285714285714285 0
1.375 0.625 0
1.1458333333333333 0.85416666666666663 0
1.1428571428571428 0.625 0
1.375 0.8571428571428571 0
0.125 0.0625 0
0.3482142857142857 0.17857142857142858 0
0.375 0.072916666666666671 0
0.5982142857142857 0.3125 0
0.875 0.42708333333333331 0
0.625 0.42708333333333331 0
0.625 0.1875 0
0.875 0.072916666666666671 0
0.625 0.072916666666666671 0
0.875 0.3125 0
0.52500000000000002 0.40000000000000002 0
0.5 0.125 0
0.375 0.28125 0
0.75 0.25 0
1 0.625 0
1 0.875 0
0.875 0.75 0
1 0.125 0
1 0.375 0
0.625 0.51249999999999996 0
0.875 0.51249999999999996 0
0.75 0.625 0
0.875 1 0
0.625 1 0
0.75 0.875 0
0.375 1 0
0.125 1 0
0.25 0.875 0
0.5 0.875 0
0.5 0.625 0
0.625 0.75 0
0.375 0.75 0
0 0.875 0
0 0.625 0
0.125 0.75 0
0 0.375 0
0 0.125 0
0.125 0.25 0
0.125 0.5 0
0.375 0.5 0
0.25 0.625 0
0.25 0.375 0
1.125 0 0
1.375 0 0
1.25 0.125 0
1.625 0 0
1.875 0 0
1.75 0.125 0
1.5 0.125 0
1.5 0.375 0
1.375 0.25 0
1.625 0.25 0
2 0.125 0
2 0.375 0
1.875 0.25 0
2 0.625 0
2 0.875 0
1.875 0.75 0
1.875 0.5 0
1.625 0.5 0
1.75 0.375 0
1.75 0.625 0
1.875 1 0
1.625 1 0
1.75 0.875 0
1.375 1 0
1.125 1 0
1.25 0.875 0
1.5 0.875 0
1.5 0.625 0
1.625 0.75 0
1.375 0.75 0
1 0.875 0
1 0.625 0
1.125 0.75 0
1 0.375 0
1 0.125 0
1.125 0.25 0
1.125 0.5 0
1.375 0.5 0
1.25 0.625 0
1.25 0.375 0
0.125 0 0
0.375 0 0
0.625 0 0
0.875 0 0
1.4583333333333333 0.79166666666666663 0
1.3125 0.9375 0
1.4375 0.9375 0
1.2916666666666667 0.79166666666666663 0
1.0625 0.6875 0
1.2083333333333333 0.54166666666666663 0
1.0625 0.5625 0
0.91666666666666663 0.91666666666666663 0
0.79166666666666663 0.79166666666666663 0
0.9375 0.8125 0
0.8125 0.9375 0
0.70833333333333337 0.70833333333333337 0
0.5625 0.5625 0
0.6875 0.5625 0
0.54166666666666663 0.70833333333333337 0
0.79166666666666663 0.70833333333333337 0
0.91666666666666663 0.58333333333333337 0
0.9375 0.6875 0
0.8125 0.5625 0
0.70833333333333337 0.79166666666666663 0
0.5625 0.9375 0
0.54166666666666663 0.79166666666666663 0
0.6875 0.9375 0
0.4375 0.4375 0
0.28749999999999998 0.3125 0
0.46875 0.33333333333333331 0
0.29166666666666669 0.45833333333333331 0
0.21875 0.20833333333333334 0
1.2083333333333333 0.70833333333333337 0
0.0625 0.21249999999999999 0
0.20833333333333334 0.29166666666666669 0
0.0625 0.4375 0
0.0625 0.3125 0
0.20833333333333334 0.45833333333333331 0
0.45833333333333331 0.54166666666666663 0
0.29166666666666669 0.70833333333333337 0
0.29166666666666669 0.54166666666666663 0
0.45833333333333331 0.70833333333333337 0
0.20833333333333334 0.79166666666666663 0
0.083333333333333329 0.91666666666666663 0
0.0625 0.8125 0
0.1875 0.9375 0
0.20833333333333334 0.70833333333333337 0
0.0625 0.5625 0
0.20833333333333334 0.54166666666666663 0
0.0625 0.6875 0
0.29166666666666669 0.79166666666666663 0
0.4375 0.9375 0
0.3125 0.9375 0
0.45833333333333331 0.79166666666666663 0
1.9166666666666667 0.91666666666666663 0
1.7916666666666667 0.79166666666666663 0
1.9375 0.8125 0
1.8125 0.9375 0
1.7083333333333333 0.70833333333333337 0
1.5416666666666667 0.54166666666666663 0
1.7083333333333333 0.54166666666666663 0
1.5416666666666667 0.70833333333333337 0
1.7916666666666667 0.70833333333333337 0
1.9375 0.5625 0
1.9375 0.6875 0
1.7916666666666667 0.54166666666666663 0
1.7083333333333333 0.79166666666666663 0
1.5625 0.9375 0
1.5416666666666667 0.79166666666666663 0
1.6875 0.9375 0
1.4583333333333333 0.45833333333333331 0
1.2916666666666667 0.29166666666666669 0
1.4583333333333333 0.29166666666666669 0
1.2916666666666667 0.45833333333333331 0
1.2083333333333333 0.20833333333333334 0
1.0833333333333333 0.083333333333333329 0
1.1875 0.0625 0
1.0625 0.1875 0
1.2916666666666667 0.20833333333333334 0
1.4375 0.0625 0
1.4583333333333333 0.20833333333333334 0
1.3125 0.0625 0
1.2083333333333333 0.29166666666666669 0
1.0625 0.4375 0
1.0625 0.3125 0
1.2083333333333333 0.45833333333333331 0
1.5416666666666667 0.45833333333333331 0
1.7083333333333333 0.29166666666666669 0
1.7083333333333333 0.45833333333333331 0
1.5416666666666667 0.29166666666666669 0
1.7916666666666667 0.20833333333333334 0
1.9166666666666667 0.083333333333333329 0
1.9375 0.1875 0
1.8125 0.0625 0
1.7916666666666667 0.29166666666666669 0
1.9375 0.4375 0
1.7916666666666667 0.45833333333333331 0
1.9375 0.3125 0
1.7083333333333333 0.20833333333333334 0
1.5625 0.0625 0
1.6875 0.0625 0
1.5416666666666667 0.20833333333333334 0
1.4583333333333333 0.54166666666666663 0
1.2916666666666667 0.70833333333333337 0
1.2916666666666667 0.54166666666666663 0
1.4583333333333333 0.70833333333333337 0
1.2083333333333333 0.79166666666666663 0
1.0833333333333333 0.91666666666666663 0
1.0625 0.8125 0
1.1875 0.9375 0
3 94 172 179
3 118 199 206
3 138 247 254
3 158 263 192
3 91 26 50
3 15 6 96
3 90 9 189
3 108 175 183
3 128 231 238
3 148 218 226
3 167 263 149
3 228 65 146
3 105 202 210
3 115 191 194
3 125 250 258
3 135 215 222
3 145 266 167
3 155 234 242
3 27 15 151
3 95 28 50
3 99 53 179
3 179 53 94
3 90 55 188
3 188 18 90
3 112 60 206
3 206 60 118
3 139 64 222
3 222 64 135
3 122 68 238
3 238 68 128
3 132 72 254
3 254 72 138
3 152 76 192
3 192 76 158
3 48 161 80
3 24 79 191
3 88 187 189
3 166 14 143
3 91 81 84
3 165 166 143
3 94 53 181
3 15 27 92
3 149 265 164
3 46 28 95
3 181 173 94
3 99 52 177
3 211 61 106
3 209 60 112
3 182 53 99
3 212 205 105
3 207 195 116
3 114 0 78
3 117 187 198
3 196 193 115
3 259 73 126
3 257 72 132
3 127 70 246
3 260 253 125
3 255 223 136
3 135 64 224
3 137 219 246
3 224 216 135
3 166 77 146
3 168 76 152
3 246 70 137
3 165 269 145
3 170 243 156
3 93 45 150
3 241 68 122
3 28 46 153
3 157 230 262
3 244 237 155
3 80 24 48
3 85 26 49
3 227 14 166
3 85 4 95
3 173 171 51
3 93 1 171
3 107 58 198
3 52 176 177
3 99 177 182
3 53 180 181
3 185 178 108
3 106 61 213
3 189 187 55
3 88 7 187
3 263 74 149
3 115 57 196
3 116 60 207
3 57 195 196
3 200 190 117
3 118 60 208
3 105 61 212
3 59 203 204
3 208 200 118
3 116 197 208
3 106 184 211
3 61 211 212
3 216 214 62
3 134 2 214
3 225 64 139
3 137 70 248
3 136 72 255
3 64 223 224
3 228 221 148
3 146 77 164
3 249 70 127
3 128 68 240
3 155 69 244
3 67 235 236
3 240 232 128
3 126 73 261
3 156 76 170
3 69 243 244
3 248 220 137
3 138 72 256
3 125 73 260
3 71 251 252
3 256 248 138
3 136 225 256
3 126 239 259
3 73 259 260
3 264 233 157
3 158 76 169
3 145 77 165
3 75 267 268
3 169 264 158
3 156 245 169
3 146 227 166
3 77 166 165
3 89 9 79
3 78 0 160
3 91 25 81
3 191 56 24
3 80 161 16
3 78 160 48
3 98 180 182
3 189 9 81
3 87 28 96
3 91 50 87
3 97 29 177
3 96 6 82
3 86 162 49
3 80 16 89
3 95 50 85
3 84 9 89
3 86 84 89
3 87 25 91
3 164 228 146
3 87 50 28
3 88 81 83
3 89 16 86
3 83 7 88
3 89 79 80
3 90 18 79
3 18 188 194
3 97 7 83
3 49 163 85
3 173 51 94
3 92 6 15
3 173 27 93
3 93 27 45
3 17 175 179
3 93 171 173
3 96 82 87
3 95 4 154
3 92 27 181
3 153 15 96
3 83 25 29
3 7 176 198
3 98 29 82
3 29 25 82
3 17 172 183
3 82 6 98
3 102 51 174
3 106 54 184
3 94 51 172
3 101 184 186
3 205 59 105
3 205 31 104
3 206 199 19
3 104 203 205
3 178 52 108
3 103 31 212
3 83 29 97
3 109 58 201
3 179 172 17
3 107 52 178
3 118 58 199
3 32 185 213
3 112 59 204
3 195 57 116
3 19 199 210
3 111 207 209
3 193 56 115
3 78 56 114
3 191 79 18
3 114 56 193
3 190 35 197
3 113 34 196
3 189 81 88
3 119 55 190
3 19 202 206
3 190 55 117
3 79 9 90
3 200 58 118
3 122 67 236
3 126 68 239
3 21 231 242
3 121 239 241
3 253 71 125
3 253 37 124
3 254 247 22
3 124 251 253
3 232 66 128
3 123 37 260
3 8 219 262
3 129 70 249
3 21 234 238
3 127 66 232
3 138 70 247
3 38 240 261
3 132 71 252
3 223 64 136
3 22 247 258
3 131 255 257
3 216 62 135
3 216 40 134
3 20 218 222
3 134 214 216
3 220 41 225
3 133 40 224
3 8 230 246
3 139 63 220
3 22 250 254
3 220 63 137
3 20 215 226
3 248 70 138
3 142 62 217
3 146 65 227
3 135 62 215
3 141 227 229
3 269 75 145
3 269 43 144
3 192 263 23
3 144 267 269
3 221 63 148
3 143 43 165
3 137 63 219
3 149 74 265
3 222 215 20
3 147 63 221
3 158 74 263
3 44 228 164
3 152 75 268
3 150 1 93
3 243 69 156
3 151 45 27
3 23 263 167
3 151 170 168
3 237 67 155
3 96 28 153
3 237 46 154
3 154 46 95
3 238 231 21
3 154 235 237
3 233 47 245
3 153 46 244
3 246 219 8
3 159 66 233
3 23 266 192
3 233 66 157
3 128 66 231
3 264 74 158
3 48 24 78
3 16 162 86
3 49 26 86
3 163 4 85
3 192 266 152
3 84 26 91
3 268 45 168
3 50 26 85
3 152 268 168
3 79 24 80
3 169 245 47
3 81 25 83
3 151 15 170
3 81 9 84
3 168 45 151
3 82 25 87
3 266 75 152
3 86 26 84
3 186 54 102
3 100 30 174
3 183 175 17
3 51 171 174
3 181 27 173
3 102 54 183
3 174 171 100
3 171 1 100
3 201 58 107
3 108 52 175
3 198 187 7
3 108 54 185
3 177 176 97
3 176 7 97
3 185 32 178
3 183 54 108
3 182 180 53
3 175 52 99
3 182 29 98
3 98 6 180
3 181 180 92
3 180 6 92
3 177 29 182
3 179 175 99
3 186 184 54
3 172 51 102
3 186 30 101
3 101 10 184
3 201 32 213
3 102 174 186
3 174 30 186
3 183 172 102
3 197 57 119
3 117 55 187
3 194 191 18
3 117 58 200
3 189 55 90
3 119 57 194
3 200 35 190
3 198 58 117
3 193 34 114
3 115 56 191
3 168 170 76
3 78 24 56
3 196 34 193
3 194 57 115
3 208 60 116
3 188 55 119
3 207 11 195
3 119 190 197
3 196 195 113
3 195 11 113
3 116 57 197
3 194 188 119
3 213 61 109
3 176 52 107
3 210 202 19
3 107 178 201
3 208 35 200
3 109 61 210
3 178 32 201
3 198 176 107
3 205 203 59
3 105 59 202
3 110 33 204
3 104 3 203
3 204 203 110
3 203 3 110
3 212 31 205
3 210 61 105
3 209 207 60
3 202 59 112
3 209 33 111
3 111 11 207
3 208 197 35
3 112 204 209
3 204 33 209
3 206 202 112
3 213 185 106
3 199 58 109
3 184 10 211
3 109 201 213
3 212 211 103
3 211 10 103
3 185 54 106
3 210 199 109
3 229 65 142
3 140 42 217
3 226 218 20
3 62 214 217
3 224 40 216
3 142 65 226
3 217 214 140
3 214 2 140
3 265 74 147
3 148 63 218
3 262 230 8
3 148 65 228
3 248 41 220
3 147 74 262
3 228 44 221
3 226 65 148
3 256 72 136
3 218 63 139
3 255 13 223
3 139 220 225
3 224 223 133
3 223 13 133
3 136 64 225
3 222 218 139
3 229 227 65
3 215 62 142
3 229 42 141
3 141 14 227
3 265 44 164
3 142 217 229
3 217 42 229
3 226 215 142
3 245 69 159
3 157 66 230
3 242 234 21
3 157 74 264
3 240 38 232
3 159 69 242
3 264 47 233
3 262 74 157
3 237 235 67
3 155 67 234
3 120 36 236
3 154 4 235
3 236 235 120
3 235 4 120
3 244 46 237
3 242 69 155
3 241 239 68
3 234 67 122
3 241 36 121
3 121 12 239
3 249 38 261
3 122 236 241
3 236 36 241
3 238 234 122
3 169 76 156
3 231 66 159
3 170 15 243
3 159 233 245
3 244 243 153
3 243 15 153
3 156 69 245
3 242 231 159
3 261 73 129
3 230 66 127
3 258 250 22
3 127 232 249
3 256 41 248
3 129 73 258
3 232 38 249
3 246 230 127
3 253 251 71
3 125 71 250
3 130 39 252
3 124 5 251
3 252 251 130
3 251 5 130
3 260 37 253
3 258 73 125
3 257 255 72
3 250 71 132
3 257 39 131
3 131 13 255
3 256 225 41
3 132 252 257
3 252 39 257
3 254 250 132
3 261 240 126
3 247 70 129
3 239 12 259
3 129 249 261
3 260 259 123
3 259 12 123
3 240 68 126
3 258 247 129
3 164 77 149
3 219 63 147
3 167 266 23
3 147 221 265
3 169 47 264
3 149 77 167
3 221 44 265
3 262 219 147
3 269 267 75
3 145 75 266
3 150 45 268
3 144 1 267
3 268 267 150
3 267 1 150
3 165 43 269
3 167 77 145

View File

@ -0,0 +1,115 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h>
#include <fstream>
#include <iostream>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Point_3 Point_3;
typedef CGAL::Surface_mesh<Point_3> Surface_mesh;
typedef boost::graph_traits<Surface_mesh>::vertex_descriptor vertex_descriptor;
typedef Surface_mesh::Property_map<vertex_descriptor,double> Vertex_distance_map;
typedef CGAL::Heat_method_3::Surface_mesh_geodesic_distances_3<Surface_mesh,
CGAL::Heat_method_3::Intrinsic_Delaunay> Heat_method;
int main(int argc, char* argv[])
{
//read in mesh
Surface_mesh sm;
const char* filename = (argc > 1) ? argv[1] : "./data/rectangle_with_degenerate_faces.off";
std::ifstream in(filename);
in >> sm;
//property map for the distance values to the source set
Vertex_distance_map vertex_distance = sm.add_property_map<vertex_descriptor, double>("v:distance", 0).first;
Heat_method hm(sm);
//add the first vertex as the source set
vertex_descriptor source = *(vertices(sm).first);
hm.add_source(source);
assert(hm.sources().size() == 1);
hm.estimate_geodesic_distances(vertex_distance);
Point_3 sp = sm.point(source);
std::cout << "source: " << sp << " " << source << std::endl;
vertex_descriptor vfar;
double sdistance = 0;
for(vertex_descriptor vd : vertices(sm)){
if(get(vertex_distance,vd) > sdistance){
vfar = vd;
sdistance = get(vertex_distance,vd);
}
}
assert(sdistance > 1.);
assert(sdistance < 2.26);//2.236 = sqrt(5)
hm.add_source(vfar);
assert(hm.sources().size() == 2);
hm.estimate_geodesic_distances(vertex_distance);
sdistance = 0;
for(vertex_descriptor vd : vertices(sm)){
if(get(vertex_distance,vd) > sdistance){
sdistance = get(vertex_distance,vd);
}
}
assert(sdistance > 1.);
assert(sdistance < 2.26);//2.236 = sqrt(5)
hm.remove_source(vfar);
assert(hm.sources().size() == 1);
hm.clear_sources();
// add range of sources
std::vector<vertex_descriptor> vrange;
vrange.push_back(source);
vrange.push_back(vfar);
hm.add_sources(vrange);
assert(hm.sources().size() == 2);
hm.estimate_geodesic_distances(vertex_distance);
sdistance = 0;
for(vertex_descriptor vd : vertices(sm)){
if(get(vertex_distance,vd) > sdistance){
sdistance = get(vertex_distance,vd);
}
}
assert(sdistance > 1.);
assert(sdistance < 2.26);//2.236 = sqrt(5)
// do it again for one source
hm.clear_sources();
assert(hm.sources().size() == 0);
hm.add_source(source);
hm.estimate_geodesic_distances(vertex_distance);
for(vertex_descriptor vd : vertices(sm)){
if(get(vertex_distance,vd) > sdistance){
sdistance = get(vertex_distance,vd);
}
}
assert(sdistance > 1.);
assert(sdistance < 2.26);//2.236 = sqrt(5)
CGAL::Heat_method_3::estimate_geodesic_distances(sm, vertex_distance, source,
CGAL::Heat_method_3::Intrinsic_Delaunay());
sdistance = 0;
for(vertex_descriptor vd : vertices(sm)){
if(get(vertex_distance,vd) > sdistance){
sdistance = get(vertex_distance,vd);
}
}
assert(sdistance > 1.);
assert(sdistance < 2.26);//2.236 = sqrt(5)
std::cout << "done" << std::endl;
return 0;
}

View File

@ -54,6 +54,10 @@ A comprehensive list of the supported file formats is available in the Stream_su
### [dD Triangulations](https://doc.cgal.org/5.3/Manual/packages.html#PkgTriangulations)
- Added the function `insert_if_in_star()` to the class `CGAL::Regular_triangulation`, which enables users to insert a point `p` in a regular triangulation on the condition that `p` appears post-insertion in the star of a user-specified, existing vertex.
### [Classification](https://doc.cgal.org/5.3/Manual/packages.html#PkgClassification)
- **Breaking change**: the support for TensorFlow was dropped, the
classifier `CGAL::TensorFlow::Neural_network_classifier` was removed.
[Release 5.2](https://github.com/CGAL/cgal/releases/tag/v5.2)
-----------

View File

@ -0,0 +1,7 @@
if(CERES_FOUND AND NOT TARGET CGAL::Ceres_support)
add_library(CGAL::Ceres_support INTERFACE IMPORTED)
set_target_properties(CGAL::Ceres_support PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "CGAL_PMP_USE_CERES_SOLVER"
INTERFACE_INCLUDE_DIRECTORIES "${CERES_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "ceres")
endif()

View File

@ -0,0 +1,6 @@
if(METIS_FOUND AND NOT TARGET CGAL::METIS_support)
add_library(CGAL::METIS_support INTERFACE IMPORTED)
set_target_properties(CGAL::METIS_support PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${METIS_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${METIS_LIBRARIES}")
endif()

View File

@ -1,7 +0,0 @@
if(TensorFlow_FOUND AND NOT TARGET CGAL::TensorFlow_support)
add_library(CGAL::TensorFlow_support INTERFACE IMPORTED)
set_target_properties(CGAL::TensorFlow_support PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "CGAL_LINKED_WITH_TENSORFLOW"
INTERFACE_INCLUDE_DIRECTORIES "${TensorFlow_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${TensorFlow_LIBRARY}")
endif()

View File

@ -1,25 +0,0 @@
include(FindPackageHandleStandardArgs)
unset(TENSORFLOW_FOUND)
find_path(TensorFlow_INCLUDE_DIR
NAMES
tensorflow/core
tensorflow/cc
third_party
HINTS
/usr/include/
/usr/local/include/)
find_library(TensorFlow_LIBRARY NAMES tensorflow_all
HINTS
/usr/lib
/usr/local/lib)
find_package_handle_standard_args(TensorFlow DEFAULT_MSG TensorFlow_INCLUDE_DIR TensorFlow_LIBRARY)
if(TENSORFLOW_FOUND)
set(TensorFlow_LIBRARIES ${TensorFlow_LIBRARY})
set(TensorFlow_INCLUDE_DIRS ${TensorFlow_INCLUDE_DIR})
endif()

View File

@ -1,7 +1,6 @@
set(list_of_whitelisted_headers_txt [=[
CGAL/SCIP_mixed_integer_program_traits.h
CGAL/GLPK_mixed_integer_program_traits.h
CGAL/Classification/TensorFlow/Neural_network_classifier.h
CGAL/Linear_cell_complex_constructors.h
CGAL/CGAL_Ipelet_base.h
CGAL/IO/read_las_points.h

View File

@ -17,7 +17,6 @@
#include <CGAL/Object.h>
#include <CGAL/assertions.h>
#include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <boost/type_traits/is_same.hpp>
#include <boost/variant.hpp>
@ -41,13 +40,13 @@
#define CGAL_INTERSECTION_FUNCTION(A, B, DIM) \
template<typename K> \
inline \
typename cpp11::result_of<BOOST_PP_CAT(typename K::Intersect_, DIM)(typename K::A, typename K::B)>::type \
decltype(auto) \
intersection(const A<K>& a, const B<K>& b) { \
return BOOST_PP_CAT(K().intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \
} \
template<typename K> \
inline \
typename cpp11::result_of<BOOST_PP_CAT(typename K::Intersect_, DIM)(typename K::A, typename K::B)>::type \
decltype(auto) \
intersection(const B<K>& a, const A<K>& b) { \
return BOOST_PP_CAT(K().intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \
}
@ -55,7 +54,7 @@
#define CGAL_INTERSECTION_FUNCTION_SELF(A, DIM) \
template<typename K> \
inline \
typename cpp11::result_of<BOOST_PP_CAT(typename K::Intersect_, DIM)(typename K::A, typename K::A)>::type \
decltype(auto) \
intersection(const A<K> & a, const A<K> & b) { \
return BOOST_PP_CAT(K().intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \
}
@ -123,11 +122,11 @@ namespace internal {
// the real type.
// Overloads for empty returns are also provided.
template<typename F, typename A, typename B, typename T>
inline typename cpp11::result_of<F(A, B)>::type
intersection_return(T&& t) { return typename cpp11::result_of<F(A, B)>::type(std::forward<T>(t)); }
decltype(auto)
intersection_return(T&& t) { return decltype(std::declval<F>()(std::declval<A>(), std::declval<B>()))(std::forward<T>(t)); }
template<typename F, typename A, typename B>
inline typename cpp11::result_of<F(A, B)>::type
intersection_return() { return typename cpp11::result_of<F(A, B)>::type(); }
decltype(auto)
intersection_return() { return decltype(std::declval<F>()(std::declval<A>(), std::declval<B>()))(); }
// Something similar to wrap around boost::get and object_cast to
// prevent ifdefing too much. Another way could be to introduce an
@ -153,14 +152,14 @@ const T* intersect_get(const boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)> & v) {
}
template<typename A, typename B>
typename cpp11::result_of<typename CGAL::Kernel_traits<A>::Kernel::Intersect_2(A, B)>::type
decltype(auto)
intersection_impl(const A& a, const B& b, CGAL::Dimension_tag<2>) {
typedef typename CGAL::Kernel_traits<A>::Kernel Kernel;
return Kernel().intersect_2_object()(a, b);
}
template<typename A, typename B>
typename cpp11::result_of<typename CGAL::Kernel_traits<A>::Kernel::Intersect_3(A, B)>::type
decltype(auto)
intersection_impl(const A& a, const B& b, Dimension_tag<3>) {
typedef typename CGAL::Kernel_traits<A>::Kernel Kernel;
return Kernel().intersect_3_object()(a, b);

View File

@ -35,39 +35,59 @@ namespace internal {
typedef typename K::Point_3 Point;
FT d = FT(0);
FT distance = FT(0);
FT sr = sphere.squared_radius();
Point center = sphere.center();
if(center.x() < (FT)bbox.xmin())
{
d = (FT)bbox.xmin() - center.x();
distance += d * d;
d = square(d);
if(certainly(d > sr)){
return false;
}
distance = d;
}
else if(center.x() > (FT)bbox.xmax())
{
d = center.x() - (FT)bbox.xmax();
distance += d * d;
d = square(d);
if(certainly(d > sr)){
return false;
}
distance = d;
}
if(center.y() < (FT)bbox.ymin())
{
d = (FT)bbox.ymin() - center.y();
distance += d * d;
d = square(d);
if(certainly(d > sr)){
return false;
}
distance += d ;
}
else if(center.y() > (FT)bbox.ymax())
{
d = center.y() - (FT)bbox.ymax();
distance += d * d;
d = square(d);
if(certainly(d > sr)){
return false;
}
distance += d;
}
if(center.z() < (FT)bbox.zmin())
{
d = (FT)bbox.zmin() - center.z();
distance += d * d;
d = square(d);
distance += d;
}
else if(center.z() > (FT)bbox.zmax())
{
d = center.z() - (FT)bbox.zmax();
distance += d * d;
d = square(d);
distance += d;
}
// For unknown reason this causes a syntax error on VC2005
@ -87,7 +107,7 @@ namespace internal {
// }
//}
return distance <= sphere.squared_radius();
return distance <= sr;
}
template <class K>

View File

@ -57,7 +57,7 @@ namespace CGAL {
// the special plane_3 function
template <class K>
inline
typename cpp11::result_of<typename K::Intersect_3(typename K::Plane_3, typename K::Plane_3, typename K::Plane_3)>::type
decltype(auto)
intersection(const Plane_3<K> &plane1, const Plane_3<K> &plane2,
const Plane_3<K> &plane3)
{

View File

@ -25,9 +25,9 @@ typedef CGAL::Bbox_3 Bbox_3;
template<class A, class B>
void call_intersection_global(const A& a, const B& b) {
typename CGAL::cpp11::result_of<K::Intersect_3(A, B)>::type x = CGAL::intersection(a, b);
typename CGAL::cpp11::result_of<K::Intersect_3(A, B)>::type y = CGAL::intersection(b, a);
typename CGAL::cpp11::result_of<K::Intersect_3(B, A)>::type z = CGAL::intersection(b, a);
const auto x = CGAL::intersection(a, b);
const auto y = CGAL::intersection(b, a);
const auto z = CGAL::intersection(b, a);
CGAL_USE(x);
CGAL_USE(y);
CGAL_USE(z);
@ -42,8 +42,8 @@ void call_do_intersect_global(const A& a, const B& b) {
template<class A, class B, class K>
void call_intersection_with_kernel(const A& a, const B& b, const K&) {
typedef typename K::Intersect_3 Intersect;
typename CGAL::cpp11::result_of<Intersect(A, B)>::type x = Intersect()(a, b);
typename CGAL::cpp11::result_of<Intersect(A, B)>::type y = Intersect()(b, a);
const auto x = Intersect()(a, b);
const auto y = Intersect()(b, a);
}
template<class A, class B, class K>
@ -83,7 +83,7 @@ int main(int argc, char**)
// call_intersection_global(Pl(), Cub());
// special
CGAL::cpp11::result_of<K::Intersect_3(Pl, Pl, Pl)>::type plplpl = CGAL::intersection(Pl(), Pl(), Pl());
const auto plplpl = CGAL::intersection(Pl(), Pl(), Pl());
call_intersection_global(Tr(), S());
call_intersection_global(Tr(), L());

View File

@ -46,10 +46,9 @@ the following function overloads are also available.
The iterator versions of those functions can be used in conjunction
with `Dispatch_output_iterator`.
Since both the number of intersections, if any, and their types, depend
on the arguments, the function expects an output iterator on
`cpp11::result_of<K::Intersect_2(Type1, Type2)>::%type`, as
presented below.
Since both the number of intersections, if any, and types of the interesection results
depend on the arguments, the function expects an output iterator on `K::Intersect_2(Type1, Type2)`
as presented below.
*/
/// @{

View File

@ -57,20 +57,16 @@ the following function overloads are also available.
The iterator versions of those functions can be used in conjunction
with `Dispatch_output_iterator`.
Since both the number of intersections, if any, and their types, depend
on the arguments, the function expects an output iterator on
`cpp11::result_of<Kernel::Intersect_3(Type1, Type2)>::%type`,
Since both the number of intersections, if any, and types of the interesection results
depend on the arguments, the function expects an output iterator on `Kernel::Intersect_3(Type1, Type2)`
as presented below.
*/
/// @{
/*!
Copies in the output iterator the intersection elements between the
two objects. `intersections` iterates on
elements of type `result_of< Intersect_3(SphericalType1, SphericalType2) >`, in lexicographic order,
when this ordering is defined on the computed objects,
where `SphericalType1` and `SphericalType2` can both be one of:
Constructs the intersection elements between the two input
objects and stores them in the OutputIterator in lexicographic order,
where both, `SphericalType1` and `SphericalType2`, can be either
- `Sphere_3<SphericalKernel>`,
- `Plane_3<SphericalKernel>`,
@ -90,7 +86,7 @@ type can be
and if the two objets `obj1` and `obj2` are equal,
- `Line_3<SphericalKernel>` or
`Circle_3<SphericalKernel>` when `SphericalType1` and `SphericalType2`
are two-dimensional objets intersecting along a curve (2 planes, or 2
are two-dimensional objects intersecting along a curve (2 planes, or 2
spheres, or one plane and one sphere),
- `Circular_arc_3<SphericalKernel>` in case of an overlap of
two circular arcs or

View File

@ -101,12 +101,15 @@ The following tables give the possible values for `Type1` and `Type2`.
\cgalHeading{2D Intersections}
The return type can be obtained through `CGAL::cpp11::result_of<Kernel::Intersect_2(A, B)>::%type`.
It is equivalent to `boost::optional< boost::variant< T... > >`, the last column in the table providing the template parameter pack.
The return type of intersecting two objects of the types `Type1` and `Type2` can be
specified through the placeholder type specifier `auto`. It is equivalent to
`boost::optional< boost::variant< T... > >`, the last column in the table providing
the template parameter pack.
<DIV ALIGN="CENTER">
<TABLE CELLPADDING=3 BORDER="1">
<TR> <TH> Type1 </TH>
<TR>
<TH> Type1 </TH>
<TH> Type2 </TH>
<TH> Return Type: `T...` </TH>
</TR>
@ -197,12 +200,15 @@ intersections existing with the type `Iso_rectangle_2`. Note that the return typ
\cgalHeading{3D Intersections}
The return type can be obtained through `CGAL::cpp11::result_of<Kernel::Intersect_3(A, B)>::%type`.
It is equivalent to `boost::optional< boost::variant< T... > >`, the last column in the table providing the template parameter pack.
The return type of intersecting two objects of the types `Type1` and `Type2` can be
specified through the placeholder type specifier `auto`. It is equivalent to
`boost::optional< boost::variant< T... > >`, the last column in the table providing
the template parameter pack.
<DIV ALIGN="CENTER">
<TABLE CELLPADDING=3 BORDER="1">
<TR> <TH> Type1 </TH>
<TR>
<TH> Type1 </TH>
<TH> Type2 </TH>
<TH> Return Type: `T...` </TH>
</TR>
@ -356,9 +362,9 @@ The following examples demonstrate the most common use of
`intersection()` functions with the 2D and 3D Linear %Kernel.
In the first two examples we intersect a segment and a line.
The result type can be obtained with `CGAL::cpp11::result_of`. It looks simpler
if you use a C++ compiler which supports `auto`,
but you must anyways know that the result type is a `boost::optional<boost::variant<..> >`, in order to unpack the point or segment.
The result type can be specified through the placeholder type specifier `auto`,
but you must anyway know that the result type is a `boost::optional<boost::variant<..> >`,
in order to unpack the point or segment.
<A HREF="https://www.boost.org/libs/optional/">`boost::optional`</A> comes in
as there might be no intersection. <A HREF="https://www.boost.org/libs/variant/">`boost::variant`</A> comes in
@ -380,7 +386,7 @@ a standard library algorithm.
*/
template <typename Kernel>
cpp11::result_of<Kernel::Intersect_23(Type1, Type2)>::type
decltype(auto)
intersection(Type1<Kernel> obj1, Type2<Kernel> obj2);
/*!
@ -388,7 +394,7 @@ returns the intersection of 3 planes, which can be a
point, a line, a plane, or empty.
*/
template <typename Kernel>
boost::optional< boost::variant< Point_3, Line_3, Plane_3 > >
decltype(auto)
intersection(const Plane_3<Kernel>& pl1,
const Plane_3<Kernel>& pl2,
const Plane_3<Kernel>& pl3);

View File

@ -8409,8 +8409,6 @@ public:
\cgalRefines `AdaptableFunctor` (with two arguments)
\sa \link intersection_grp `CGAL::intersection()` \endlink
\sa `CGAL::cpp11::result_of`
*/
class Intersect_2 {
public:
@ -8424,7 +8422,7 @@ public:
`Type1` and `Type2`, for all pairs `Type1` and `Type2`.
For details see the reference manual page for \link intersection_grp `CGAL::intersection()` \endlink.
*/
CGAL::cpp11::result_of<Kernel::Intersect_2(Type1, Type2)>::type
decltype(auto)
operator()(Type1 obj1, Type2 obj2);
/// @}
@ -8438,8 +8436,6 @@ public:
\cgalRefines `AdaptableFunctor` (with two or three arguments)
\sa intersection_linear_grp
\sa `CGAL::cpp11::result_of`
*/
class Intersect_3 {
public:
@ -8453,8 +8449,8 @@ public:
objects of type `Type1` and `Type2`.
For details see the reference manual page for \ref intersection_linear_grp.
*/
CGAL::cpp11::result_of<Kernel::Intersect_3(Type1, Type2)>::type
operator()(Type1 obj1, Type2 obj2);
decltype(auto)
operator()(Type1 obj1, Type2 obj2);

View File

@ -493,23 +493,19 @@ especially integer types and rationals.
\subsection Kernel_23VariantReturnValues Intersections and Variant Return Types
Some functions, for example \link intersection_linear_grp `intersection()`\endlink, can return different types of objects. To achieve this
in a type-safe way \cgal uses return values of type
`boost::optional< boost::variant< T... > >` were `T...` is a
list of all possible resulting geometric objects. The exact result
type of an intersection can be determined through the metafunction
`cpp11::result_of<Kernel::Intersect_2(Type1, Type2)>` or
`cpp11::result_of<Kernel::Intersect_3(Type1, Type2)>`, where
`Type1` and `Type2` are the types of the objects used in the
intersection computation.
Some functions, for example \link intersection_linear_grp `intersection()`\endlink,
can return different types of objects. To achieve this in a type-safe way \cgal uses
return values of type `boost::optional< boost::variant< T... > >` where `T...` is a
list of all possible resulting geometric objects. The exact result type of an intersection
can be specified through the placeholder type specifier `auto`.
Example
-------
In the following example, `result_of` is used to query the type of the
return value for the intersection computation:
In the following example, `auto` is used to specify the type of the return value
for the intersection computation:
\code{.cpp}
typedef Cartesian<double> K;
@ -521,13 +517,9 @@ Segment_2 segment_1, segment_2;
std::cin >> segment_1 >> segment_2;
/* C++11 */
// auto v = intersection(segment_1, segment_2);
/* C++03 */
cpp11::result_of<K::Intersect_2(Segment_2, Segment_2)>::type
v = intersection(segment_1, segment_2);
if(v) {
/* use auto */
auto v = intersection(segment_1, segment_2);
if (v) {
/* not empty */
if (const Point_2 *p = boost::get<Point_2>(&*v) ) {
/* do something with *p */

View File

@ -56,8 +56,7 @@ int main()
K::Intersect_2 intersection;
CGAL::cpp11::result_of<K::Intersect_2(Segment, Segment)>::type
intersect = intersection(s1, s2);
const auto intersect = intersection(s1, s2);
K::Construct_cartesian_const_iterator_2 construct_it;
K::Cartesian_const_iterator_2 cit = construct_it(a);

View File

@ -25,8 +25,7 @@ int main(){
EK::Triangle_3 t2=to_exact(t1);
EK::Line_3 l2=to_exact(l1);
CGAL::cpp11::result_of<EK::Intersect_3(EK::Triangle_3, EK::Line_3)>::type
inter = CGAL::intersection(t2,l2);
const auto inter = CGAL::intersection(t2,l2);
// As we are sure that there IS an intersection
// and that the intersection IS a point

View File

@ -12,8 +12,7 @@ int main()
Segment_2 seg(Point_2(0,0), Point_2(2,2));
Line_2 lin(1,-1,0);
CGAL::cpp11::result_of<Intersect_2(Segment_2, Line_2)>::type
result = intersection(seg, lin);
const auto result = intersection(seg, lin);
if (result) {
if (const Segment_2* s = boost::get<Segment_2>(&*result)) {
std::cout << *s << std::endl;

View File

@ -26,11 +26,7 @@ int main()
Segment_2 seg(Point_2(0,0), Point_2(1,1));
Line_2 lin(1,-1,0);
// with C++11 support
// auto result = intersection(seg, lin);
// without C++11
CGAL::cpp11::result_of<Intersect_2(Segment_2, Line_2)>::type
result = intersection(seg, lin);
const auto result = intersection(seg, lin);
if (result) {
boost::apply_visitor(Intersection_visitor(), *result);
} else {

View File

@ -13,13 +13,12 @@ typedef CGAL::Creator_uniform_2< Point, Segment> Seg_creator;
typedef CGAL::Join_input_iterator_2< P1, P2, Seg_creator> Seg_iterator;
struct Intersector{
typedef CGAL::cpp11::result_of<K::Intersect_2(Segment,Segment)>::type result_type;
const Segment& s;
K::Intersect_2 intersect;
Intersector(const Segment& seg): s(seg) {}
result_type
decltype(auto)
operator() ( const Segment& other) const
{
return intersect(s, other);

View File

@ -18,7 +18,6 @@
#include <CGAL/config.h>
#include <CGAL/kernel_assertions.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h>
#include <CGAL/Dimension.h>
#include <CGAL/array.h>

View File

@ -24,7 +24,6 @@
#include <CGAL/Bbox_2.h>
#include <CGAL/Dimension.h>
#include <CGAL/number_utils.h>
#include <CGAL/result_of.h>
namespace CGAL {
@ -89,13 +88,13 @@ public:
Circle_2(const Point_2 & center)
: RCircle_2(typename R::Construct_circle_2()(Return_base_tag(), center, FT(0), COUNTERCLOCKWISE)) {}
typename cpp11::result_of<typename R::Construct_center_2(Circle_2)>::type
decltype(auto)
center() const
{
return R().construct_center_2_object()(*this);
}
typename cpp11::result_of<typename R::Compute_squared_radius_2(Circle_2)>::type
decltype(auto)
squared_radius() const
{
return R().compute_squared_radius_2_object()(*this);

View File

@ -93,8 +93,7 @@ public:
Circle_3(const Rep& r)
: Rep(r) {}
typename cpp11::result_of
<typename R::Construct_sphere_3( Circle_3)>::type
decltype(auto)
diametral_sphere() const
{
return typename R::Construct_sphere_3()(*this);
@ -110,8 +109,7 @@ public:
return typename R::Construct_sphere_3()(*this).squared_radius();
}
typename cpp11::result_of
<typename R::Construct_plane_3( Circle_3)>::type
decltype(auto)
supporting_plane() const
{
return typename R::Construct_plane_3()(*this);

View File

@ -23,7 +23,6 @@
#include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/representation_tags.h>
#include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h>
namespace CGAL {
@ -93,19 +92,19 @@ public:
return R().construct_perpendicular_direction_2_object()(*this,o);
}
typename cpp11::result_of<typename R::Compute_dx_2( Direction_2)>::type
decltype(auto)
dx() const
{
return R().compute_dx_2_object()(*this);
}
typename cpp11::result_of<typename R::Compute_dy_2( Direction_2)>::type
decltype(auto)
dy() const
{
return R().compute_dy_2_object()(*this);
}
typename cpp11::result_of<typename R::Compute_dx_2( Direction_2)>::type
decltype(auto)
delta(int i) const
{
CGAL_kernel_precondition( ( i == 0 ) || ( i == 1 ) );

View File

@ -23,7 +23,6 @@
#include <CGAL/kernel_assertions.h>
#include <CGAL/representation_tags.h>
#include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h>
namespace CGAL {
@ -99,25 +98,25 @@ public:
Vector_3 vector() const { return to_vector(); }
typename cpp11::result_of<typename R::Compute_dx_3(Direction_3)>::type
decltype(auto)
dx() const
{
return R().compute_dx_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_dy_3(Direction_3)>::type
decltype(auto)
dy() const
{
return R().compute_dy_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_dz_3(Direction_3)>::type
decltype(auto)
dz() const
{
return R().compute_dz_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_dx_3(Direction_3)>::type
decltype(auto)
delta(int i) const
{
CGAL_kernel_precondition( i >= 0 && i <= 2 );

View File

@ -86,67 +86,67 @@ public:
: Rep(typename R::Construct_iso_cuboid_3()(Return_base_tag(), bbox.xmin(), bbox.ymin(), bbox.zmin(),
bbox.xmax(), bbox.ymax(), bbox.zmax())) {}
typename cpp11::result_of<typename R::Construct_min_vertex_3( Iso_cuboid_3 )>::type
decltype(auto)
min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
return R().construct_min_vertex_3_object()(*this);
}
typename cpp11::result_of<typename R::Construct_max_vertex_3( Iso_cuboid_3 )>::type
decltype(auto)
max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
return R().construct_max_vertex_3_object()(*this);
}
typename cpp11::result_of<typename R::Construct_vertex_3( Iso_cuboid_3, int )>::type
decltype(auto)
vertex(int i) const
{
return R().construct_vertex_3_object()(*this,i);
}
typename cpp11::result_of<typename R::Construct_vertex_3( Iso_cuboid_3, int )>::type
decltype(auto)
operator[](int i) const
{
return R().construct_vertex_3_object()(*this,i);
}
typename cpp11::result_of<typename R::Compute_xmin_3( Iso_cuboid_3 )>::type
decltype(auto)
xmin() const
{
return R().compute_xmin_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_xmax_3( Iso_cuboid_3 )>::type
decltype(auto)
xmax() const
{
return R().compute_xmax_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_ymin_3( Iso_cuboid_3 )>::type
decltype(auto)
ymin() const
{
return R().compute_ymin_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_ymax_3( Iso_cuboid_3 )>::type
decltype(auto)
ymax() const
{
return R().compute_ymax_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_zmin_3( Iso_cuboid_3 )>::type
decltype(auto)
zmin() const
{
return R().compute_zmin_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_zmax_3( Iso_cuboid_3 )>::type
decltype(auto)
zmax() const
{
return R().compute_zmax_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_xmin_3( Iso_cuboid_3 )>::type
decltype(auto)
min_coord(int i) const
{
CGAL_kernel_precondition( i == 0 || i == 1 || i == 2 );
@ -158,7 +158,7 @@ public:
return zmin();
}
typename cpp11::result_of<typename R::Compute_xmax_3( Iso_cuboid_3 )>::type
decltype(auto)
max_coord(int i) const
{
CGAL_kernel_precondition( i == 0 || i == 1 || i == 2 );
@ -206,7 +206,7 @@ public:
return R().is_degenerate_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_volume_3( Iso_cuboid_3 )>::type
decltype(auto)
volume() const
{
return R().compute_volume_3_object()(*this);

View File

@ -22,7 +22,6 @@
#include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/Bbox_2.h>
#include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
namespace CGAL {
@ -82,13 +81,13 @@ public:
Iso_rectangle_2(const Bbox_2& bbox)
: Rep(typename R::Construct_iso_rectangle_2()(Return_base_tag(), bbox.xmin(), bbox.ymin(), bbox.xmax(), bbox.ymax())) {}
typename cpp11::result_of<typename R::Construct_min_vertex_2( Iso_rectangle_2 )>::type
decltype(auto)
min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
return R().construct_min_vertex_2_object()(*this);
}
typename cpp11::result_of<typename R::Construct_max_vertex_2( Iso_rectangle_2 )>::type
decltype(auto)
max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
return R().construct_max_vertex_2_object()(*this);
@ -107,43 +106,43 @@ public:
}
typename cpp11::result_of<typename R::Construct_vertex_2( Iso_rectangle_2, int )>::type
decltype(auto)
vertex(int i) const
{
return R().construct_vertex_2_object()(*this,i);
}
typename cpp11::result_of<typename R::Construct_vertex_2( Iso_rectangle_2, int )>::type
decltype(auto)
operator[](int i) const
{
return R().construct_vertex_2_object()(*this,i);
}
typename cpp11::result_of<typename R::Compute_xmin_2( Iso_rectangle_2 )>::type
decltype(auto)
xmin() const
{
return R().compute_xmin_2_object()(*this);
}
typename cpp11::result_of<typename R::Compute_xmax_2( Iso_rectangle_2 )>::type
decltype(auto)
xmax() const
{
return R().compute_xmax_2_object()(*this);
}
typename cpp11::result_of<typename R::Compute_ymin_2( Iso_rectangle_2 )>::type
decltype(auto)
ymin() const
{
return R().compute_ymin_2_object()(*this);
}
typename cpp11::result_of<typename R::Compute_ymax_2( Iso_rectangle_2 )>::type
decltype(auto)
ymax() const
{
return R().compute_ymax_2_object()(*this);
}
typename cpp11::result_of<typename R::Compute_xmin_2( Iso_rectangle_2 )>::type
decltype(auto)
min_coord(int i) const
{
CGAL_kernel_precondition( i == 0 || i == 1 );
@ -153,7 +152,7 @@ public:
return ymin();
}
typename cpp11::result_of<typename R::Compute_xmin_2( Iso_rectangle_2 )>::type
decltype(auto)
max_coord(int i) const
{
CGAL_kernel_precondition( i == 0 || i == 1 );

View File

@ -87,9 +87,13 @@ BOOST_PP_REPEAT_FROM_TO(1, 10, CGAL_VARIANT_TYPEMAP, _)
//};
// Then we specialize for all kernel objects.
// More details on why it is like that are here: https://github.com/CGAL/cgal/pull/4878#discussion_r459986501
#define CGAL_Kernel_obj(X) \
template < typename K1, typename K2 > \
struct Type_mapper_impl < typename K1::X, K1, K2 > \
{ typedef typename K2::X type; }; \
template < typename K1, typename K2 > \
struct Type_mapper_impl < typename K1::X::Rep, K1, K2 > \
{ typedef typename K2::X type; };
#include <CGAL/Kernel/interface_macros.h>

View File

@ -37,6 +37,39 @@ namespace CGAL {
namespace CommonKernelFunctors {
template <typename K>
class Non_zero_dimension_3
{
typedef typename K::Vector_3 Vector_3;
public:
typedef int result_type;
result_type operator()(const Vector_3& vec) const
{
if(certainly_not(is_zero(vec.x()))){
return 0;
} else if(certainly_not(is_zero(vec.y()))){
return 1;
}else if(certainly_not(is_zero(vec.y()))){
return 2;
}
if(! is_zero(vec.x())){
return 0;
} else if(! is_zero(vec.y())){
return 1;
} else if(! is_zero(vec.z())){
return 2;
}
return -1;
}
};
template <typename K>
class Are_ordered_along_line_2
{
@ -1682,8 +1715,7 @@ namespace CommonKernelFunctors {
Line l1 = construct_line(l11, l12);
Line l2 = construct_line(l21, l22);
typename cpp11::result_of<typename K::Intersect_3(Line,Line)>::type
res = typename K::Intersect_3()(l1,l2);
const auto res = typename K::Intersect_3()(l1,l2);
CGAL_assertion(res!=boost::none);
const Point* e_pt = boost::get<Point>(&(*res));
CGAL_assertion(e_pt!=nullptr);
@ -2082,8 +2114,7 @@ namespace CommonKernelFunctors {
Plane plane = construct_plane(p1, p2, p3);
Line line = construct_line( l1, l2 );
typename cpp11::result_of<typename K::Intersect_3(Plane,Line)>::type
res = typename K::Intersect_3()(plane,line);
const auto res = typename K::Intersect_3()(plane,line);
CGAL_assertion(res!=boost::none);
const Point* e_pt = boost::get<Point>(&(*res));
CGAL_assertion(e_pt!=nullptr);
@ -2096,8 +2127,7 @@ namespace CommonKernelFunctors {
{
Line line = construct_line( l1, l2 );
typename cpp11::result_of<typename K::Intersect_3(Plane,Line)>::type
res = typename K::Intersect_3()(plane,line);
const auto res = typename K::Intersect_3()(plane,line);
CGAL_assertion(res!=boost::none);
const Point* e_pt = boost::get<Point>(&(*res));
CGAL_assertion(e_pt!=nullptr);
@ -2560,15 +2590,6 @@ namespace CommonKernelFunctors {
typedef typename K::Triangle_3 Triangle_3;
typedef typename K::Tetrahedron_3 Tetrahedron_3;
public:
template<typename>
struct result {
typedef const Point_3& type;
};
template<typename T>
struct result<T(Iso_cuboid_3, int)> {
typedef Point_3 type;
};
const Point_3&
operator()( const Segment_3& s, int i) const
@ -2752,25 +2773,19 @@ namespace CommonKernelFunctors {
bool
is_inside_triangle_3(const typename K::Point_3& p,
const typename K::Triangle_3& t,
const typename K::Vector_3& w,
typename K::Point_3& result,
const K& k)
{
typedef typename K::Point_3 Point_3;
typedef typename K::Vector_3 Vector_3;
typename K::Construct_vector_3 vector =
k.construct_vector_3_object();
typename K::Construct_vertex_3 vertex_on =
k.construct_vertex_3_object();
typename K::Construct_cross_product_vector_3 cross_product =
k.construct_cross_product_vector_3_object();
const Point_3& t0 = vertex_on(t,0);
const Point_3& t1 = vertex_on(t,1);
const Point_3& t2 = vertex_on(t,2);
Vector_3 w = cross_product(vector(t0,t1), vector(t1,t2));
bool outside = false;
if ( is_inside_triangle_3_aux(w, t0, t1, p, result, outside, k)
|| is_inside_triangle_3_aux(w, t1, t2, p, result, outside, k)
@ -2846,6 +2861,8 @@ namespace CommonKernelFunctors {
typename K::Construct_projected_point_3 projection =
k.construct_projected_point_3_object();
typename K::Is_degenerate_3 is_degenerate = k.is_degenerate_3_object();
typename K::Construct_orthogonal_vector_3 normal =
k.construct_orthogonal_vector_3_object();
const typename K::Plane_3 plane = supporting_plane(triangle);
if(is_degenerate(plane)) {
@ -2892,9 +2909,8 @@ namespace CommonKernelFunctors {
// Project origin on triangle supporting plane
const Point_3 proj = projection(plane, origin);
Point_3 moved_point;
bool inside = is_inside_triangle_3(proj,triangle,moved_point,k);
bool inside = is_inside_triangle_3(proj,triangle,normal(plane),moved_point,k);
// If proj is inside triangle, return it
if ( inside )
@ -3304,11 +3320,10 @@ namespace CommonKernelFunctors {
bool operator()(const Sphere_3& s1, const Sphere_3& s2,
const Point_3& a, const Point_3& b) const
{
typedef typename K::Circle_3 Circle_3;
typedef typename K::Point_3 Point_3;
typedef typename K::Segment_3 Segment_3;
typedef typename K::Plane_3 Plane_3;
typedef typename K::Intersect_3 Intersect_3;
typedef typename K::Circle_3 Circle_3;
typedef typename K::Point_3 Point_3;
typedef typename K::Segment_3 Segment_3;
typedef typename K::Plane_3 Plane_3;
const Has_on_bounded_side_3& has_on_bounded_side = *this;
@ -3328,8 +3343,7 @@ namespace CommonKernelFunctors {
if(!K().do_intersect_3_object()(s1, s2)) return false;
const Circle_3 circ(s1, s2);
const Plane_3& plane = circ.supporting_plane();
typename CGAL::cpp11::result_of<Intersect_3(Plane_3, Segment_3)>::type
optional = K().intersect_3_object()(plane, Segment_3(a, b));
const auto optional = K().intersect_3_object()(plane, Segment_3(a, b));
CGAL_kernel_assertion_msg(bool(optional) == true,
"the segment does not intersect the supporting"
" plane");
@ -3520,17 +3534,10 @@ namespace CommonKernelFunctors {
class Intersect_2
{
public:
template<typename>
struct result;
template<typename F, typename A, typename B>
struct result<F(A,B)> {
typedef typename Intersection_traits<K, A, B>::result_type type;
};
// 25 possibilities, so I keep the template.
template <class T1, class T2>
typename Intersection_traits<K, T1, T2>::result_type
decltype(auto)
operator()(const T1& t1, const T2& t2) const
{ return Intersections::internal::intersection(t1, t2, K()); }
};
@ -3540,29 +3547,14 @@ namespace CommonKernelFunctors {
{
typedef typename K::Plane_3 Plane_3;
public:
template<typename>
struct result;
template<typename F, typename A, typename B>
struct result<F(A, B)> {
typedef typename Intersection_traits<K, A, B>::result_type type;
};
template<typename F>
struct result<F(Plane_3, Plane_3, Plane_3)> {
typedef boost::optional<
boost::variant< typename K::Point_3,
typename K::Line_3,
typename K::Plane_3 > > type;
};
// n possibilities, so I keep the template.
template <class T1, class T2>
typename cpp11::result_of< Intersect_3(T1, T2) >::type
decltype(auto)
operator()(const T1& t1, const T2& t2) const
{ return Intersections::internal::intersection(t1, t2, K() ); }
typename boost::optional< boost::variant< typename K::Point_3, typename K::Line_3, typename K::Plane_3 > >
decltype(auto)
operator()(const Plane_3& pl1, const Plane_3& pl2, const Plane_3& pl3)const
{ return Intersections::internal::intersection(pl1, pl2, pl3, K() ); }
};

View File

@ -582,6 +582,8 @@ CGAL_Kernel_pred(Less_y_3,
less_y_3_object)
CGAL_Kernel_pred(Less_z_3,
less_z_3_object)
CGAL_Kernel_pred(Non_zero_dimension_3,
non_zero_dimension_3_object)
CGAL_Kernel_pred_RT(Orientation_2,
orientation_2_object)
CGAL_Kernel_pred_RT(Orientation_3,

View File

@ -21,7 +21,6 @@
// This file contains the definition of a kernel traits checker.
#include <CGAL/basic.h>
#include <CGAL/result_of.h>
#include <CGAL/use.h>
#include <utility>
@ -80,19 +79,14 @@ public:
{ }
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
decltype(auto)
operator()(const A&... a) const
{
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))
{
CGAL_kernel_assertion(false);
}
return Pairify<result_type_1, result_type_2>()(res1, res2);
auto res1 = p1(a.first...);
auto res2 = p2(a.second...);
CGAL_kernel_assertion(cmp(res1, res2));
return Pairify<decltype(res1), decltype(res2)>()(res1, res2);
}
};

View File

@ -21,7 +21,6 @@
#include <boost/type_traits/is_same.hpp>
#include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h>
namespace CGAL {
@ -107,25 +106,25 @@ public:
return Direction_3(a(), b(), c());
}
typename cpp11::result_of<typename R::Compute_a_3( Plane_3)>::type
decltype(auto)
a() const
{
return R().compute_a_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_b_3( Plane_3)>::type
decltype(auto)
b() const
{
return R().compute_b_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_c_3( Plane_3)>::type
decltype(auto)
c() const
{
return R().compute_c_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_d_3( Plane_3)>::type
decltype(auto)
d() const
{
return R().compute_d_3_object()(*this);

View File

@ -24,7 +24,6 @@
#include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/representation_tags.h>
#include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
namespace CGAL {
@ -93,26 +92,26 @@ public:
swap(a.rep(), b.rep());
}
typename cpp11::result_of<typename R::Compute_x_2(Point_2)>::type
decltype(auto)
x() const
{
return typename R::Compute_x_2()(*this);
}
typename cpp11::result_of<typename R::Compute_y_2(Point_2)>::type
decltype(auto)
y() const
{
return typename R::Compute_y_2()(*this);
}
typename cpp11::result_of<typename R::Compute_x_2(Point_2)>::type
decltype(auto)
cartesian(int i) const
{
CGAL_kernel_precondition( (i == 0) || (i == 1) );
return (i==0) ? x() : y();
}
typename cpp11::result_of<typename R::Compute_x_2(Point_2)>::type
decltype(auto)
operator[](int i) const
{
return cartesian(i);
@ -129,19 +128,19 @@ public:
}
typename cpp11::result_of<typename R::Compute_hx_2(Point_2)>::type
decltype(auto)
hx() const
{
return typename R::Compute_hx_2()(*this);
}
typename cpp11::result_of<typename R::Compute_hy_2(Point_2)>::type
decltype(auto)
hy() const
{
return typename R::Compute_hy_2()(*this);
}
typename cpp11::result_of<typename R::Compute_hw_2(Point_2)>::type
decltype(auto)
hw() const
{
return typename R::Compute_hw_2()(*this);
@ -152,7 +151,7 @@ public:
return 2;
}
typename cpp11::result_of<typename R::Compute_hx_2(Point_2)>::type
decltype(auto)
homogeneous(int i) const
{
CGAL_kernel_precondition( (i >= 0) || (i <= 2) );

View File

@ -90,49 +90,49 @@ public:
swap(a.rep(), b.rep());
}
typename cpp11::result_of<typename R::Compute_x_3( Point_3)>::type
decltype(auto)
x() const
{
return typename R::Compute_x_3()(*this);
}
typename cpp11::result_of<typename R::Compute_y_3( Point_3)>::type
decltype(auto)
y() const
{
return typename R::Compute_y_3()(*this);
}
typename cpp11::result_of<typename R::Compute_z_3( Point_3)>::type
decltype(auto)
z() const
{
return typename R::Compute_z_3()(*this);
}
typename cpp11::result_of<typename R::Compute_hx_3( Point_3)>::type
decltype(auto)
hx() const
{
return R().compute_hx_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_hy_3( Point_3)>::type
decltype(auto)
hy() const
{
return R().compute_hy_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_hz_3( Point_3)>::type
decltype(auto)
hz() const
{
return R().compute_hz_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_hw_3( Point_3)>::type
decltype(auto)
hw() const
{
return R().compute_hw_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_x_3( Point_3)>::type
decltype(auto)
cartesian(int i) const
{
CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) );
@ -151,7 +151,7 @@ public:
return hw();
}
typename cpp11::result_of<typename R::Compute_x_3(Point_3)>::type
decltype(auto)
operator[](int i) const
{
return cartesian(i);

View File

@ -23,7 +23,6 @@
#include <CGAL/kernel_assertions.h>
#include <CGAL/representation_tags.h>
#include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h>
namespace CGAL {
@ -81,13 +80,13 @@ public:
: RRay_2(typename R::Construct_ray_2()(Return_base_tag(), sp, l)) {}
typename cpp11::result_of<typename R_::Construct_source_2( Ray_2)>::type
decltype(auto)
source() const
{
return R().construct_source_2_object()(*this);
}
typename cpp11::result_of<typename R_::Construct_second_point_2( Ray_2)>::type
decltype(auto)
second_point() const
{
return R().construct_second_point_2_object()(*this);
@ -108,7 +107,7 @@ public:
construct_scaled_vector(construct_vector(source(), second_point()), i));
}
typename cpp11::result_of<typename R_::Construct_source_2( Ray_2 )>::type
decltype(auto)
start() const
{
return source();

View File

@ -22,7 +22,6 @@
#include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/representation_tags.h>
#include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h>
namespace CGAL {
@ -99,25 +98,25 @@ public:
bool collinear_has_on(const Point_3 &p) const;
*/
typename cpp11::result_of<typename R::Construct_point_on_3(Ray_3, FT)>::type
decltype(auto)
point(const FT i) const
{
return R().construct_point_on_3_object()(*this, i);
}
typename cpp11::result_of<typename R::Construct_source_3(Ray_3)>::type
decltype(auto)
source() const
{
return R().construct_source_3_object()(*this);
}
typename cpp11::result_of<typename R::Construct_second_point_3(Ray_3)>::type
decltype(auto)
second_point() const
{
return R().construct_second_point_3_object()(*this);
}
typename cpp11::result_of<typename R::Construct_source_3(Ray_3)>::type
decltype(auto)
start() const
{
return source();

View File

@ -23,7 +23,6 @@
#include <CGAL/Bbox_2.h>
#include <CGAL/Dimension.h>
#include <CGAL/kernel_config.h>
#include <CGAL/result_of.h>
namespace CGAL {
@ -70,45 +69,53 @@ public:
Segment_2(const Point_2 &sp, const Point_2 &ep)
: RSegment_2(typename R::Construct_segment_2()(Return_base_tag(), sp,ep)) {}
typename cpp11::result_of<typename R::Construct_source_2( Segment_2)>::type
decltype(auto)
source() const
{
return R_().construct_source_2_object()(*this);
}
typename cpp11::result_of<typename R::Construct_target_2( Segment_2)>::type
decltype(auto)
target() const
{
return R_().construct_target_2_object()(*this);
}
typename cpp11::result_of<typename R::Construct_source_2( Segment_2)>::type
decltype(auto)
start() const
{
return source();
}
typename cpp11::result_of<typename R::Construct_target_2( Segment_2)>::type
decltype(auto)
end() const
{
return target();
}
decltype(auto)
min BOOST_PREVENT_MACRO_SUBSTITUTION() const {
typename R_::Less_xy_2 less_xy;
return less_xy(source(), target()) ? source() : target();
}
typename cpp11::result_of<typename R_::Construct_min_vertex_2(Segment_2)>::type
min BOOST_PREVENT_MACRO_SUBSTITUTION() const;
decltype(auto)
max BOOST_PREVENT_MACRO_SUBSTITUTION() const {
typename R_::Less_xy_2 less_xy;
return less_xy(source(), target()) ? target() : source();
}
typename cpp11::result_of<typename R_::Construct_max_vertex_2( Segment_2)>::type
max BOOST_PREVENT_MACRO_SUBSTITUTION () const;
decltype(auto)
vertex(int i) const
{ return (i%2 == 0) ? source() : target(); }
typename cpp11::result_of<typename R_::Construct_vertex_2( Segment_2, int)>::type
vertex(int i) const;
decltype(auto)
point(int i) const
{ return vertex(i); }
typename cpp11::result_of<typename R_::Construct_vertex_2( Segment_2, int)>::type
point(int i) const;
typename cpp11::result_of<typename R_::Construct_vertex_2( Segment_2, int)>::type
operator[](int i) const;
decltype(auto)
operator[](int i) const
{ return vertex(i); }
bool is_horizontal() const;
bool is_vertical() const;
@ -170,47 +177,6 @@ public:
}
};
template < class R_ >
CGAL_KERNEL_INLINE
typename cpp11::result_of<typename R_::Construct_min_vertex_2( Segment_2<R_> )>::type
Segment_2<R_>::min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
typename R_::Less_xy_2 less_xy;
return less_xy(source(),target()) ? source() : target();
}
template < class R_ >
CGAL_KERNEL_INLINE
typename cpp11::result_of<typename R_::Construct_max_vertex_2( Segment_2<R_> )>::type
Segment_2<R_>::max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
typename R_::Less_xy_2 less_xy;
return less_xy(source(),target()) ? target() : source();
}
template < class R_ >
CGAL_KERNEL_INLINE
typename cpp11::result_of<typename R_::Construct_vertex_2( Segment_2<R_>, int )>::type
Segment_2<R_>::vertex(int i) const
{
return (i%2 == 0) ? source() : target();
}
template < class R_ >
inline
typename cpp11::result_of<typename R_::Construct_vertex_2( Segment_2<R_>, int )>::type
Segment_2<R_>::point(int i) const
{
return vertex(i);
}
template < class R_ >
inline
typename cpp11::result_of<typename R_::Construct_vertex_2( Segment_2<R_>, int )>::type
Segment_2<R_>::operator[](int i) const
{
return vertex(i);
}
template < class R_ >
CGAL_KERNEL_INLINE

View File

@ -68,44 +68,51 @@ public:
Segment_3(const Point_3& sp, const Point_3& ep)
: Rep(typename R::Construct_segment_3()(Return_base_tag(), sp, ep)) {}
typename cpp11::result_of<typename R::Construct_source_3(Segment_3)>::type
decltype(auto)
source() const
{
return R_().construct_source_3_object()(*this);
}
typename cpp11::result_of<typename R::Construct_target_3(Segment_3)>::type
decltype(auto)
target() const
{
return R_().construct_target_3_object()(*this);
}
typename cpp11::result_of<typename R::Construct_source_3(Segment_3)>::type
decltype(auto)
start() const
{
return source();
}
typename cpp11::result_of<typename R::Construct_target_3(Segment_3)>::type
decltype(auto)
end() const
{
return target();
}
typename cpp11::result_of<typename R_::Construct_min_vertex_3(Segment_3)>::type
min BOOST_PREVENT_MACRO_SUBSTITUTION () const;
decltype(auto)
min BOOST_PREVENT_MACRO_SUBSTITUTION() const {
typename R_::Less_xyz_3 less_xyz;
return less_xyz(source(), target()) ? source() : target();
}
typename cpp11::result_of<typename R_::Construct_max_vertex_3(Segment_3)>::type
max BOOST_PREVENT_MACRO_SUBSTITUTION () const;
decltype(auto)
max BOOST_PREVENT_MACRO_SUBSTITUTION() const {
typename R_::Less_xyz_3 less_xyz;
return less_xyz(source(), target()) ? target() : source();
}
typename cpp11::result_of<typename R_::Construct_vertex_3(Segment_3, int)>::type
vertex(int i) const;
decltype(auto)
vertex(int i) const
{ return (i%2 == 0) ? source() : target(); }
typename cpp11::result_of<typename R::Construct_vertex_3(Segment_3, int)>::type
decltype(auto)
point(int i) const
{ return vertex(i); }
typename cpp11::result_of<typename R::Construct_vertex_3(Segment_3, int)>::type
decltype(auto)
operator[](int i) const
{ return vertex(i); }
@ -161,32 +168,6 @@ public:
};
template < class R_ >
CGAL_KERNEL_INLINE
typename cpp11::result_of<typename R_::Construct_min_vertex_3( Segment_3<R_> ) >::type
Segment_3<R_>::min BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
typename R_::Less_xyz_3 less_xyz;
return less_xyz(source(),target()) ? source() : target();
}
template < class R_ >
CGAL_KERNEL_INLINE
typename cpp11::result_of<typename R_::Construct_max_vertex_3( Segment_3<R_> ) >::type
Segment_3<R_>::max BOOST_PREVENT_MACRO_SUBSTITUTION () const
{
typename R_::Less_xyz_3 less_xyz;
return less_xyz(source(),target()) ? target() : source();
}
template < class R_ >
CGAL_KERNEL_INLINE
typename cpp11::result_of<typename R_::Construct_vertex_3( Segment_3<R_>, int ) >::type
Segment_3<R_>::vertex(int i) const
{
return (i%2 == 0) ? source() : target();
}
template < class R >
std::ostream &

View File

@ -86,7 +86,7 @@ public:
Sphere_3 orthogonal_transform(const Aff_transformation_3 &t) const;
typename cpp11::result_of<typename R::Construct_center_3( Sphere_3)>::type
decltype(auto)
center() const
{
return R().construct_center_3_object()(*this);

View File

@ -70,13 +70,13 @@ public:
t.transform(this->vertex(3)));
}
typename cpp11::result_of<typename R::Construct_vertex_3( Tetrahedron_3, int)>::type
decltype(auto)
vertex(int i) const
{
return R().construct_vertex_3_object()(*this,i);
}
typename cpp11::result_of<typename R::Construct_vertex_3( Tetrahedron_3, int)>::type
decltype(auto)
operator[](int i) const
{
return vertex(i);
@ -128,7 +128,7 @@ public:
return R().has_on_unbounded_side_3_object()(*this, p);
}
typename cpp11::result_of<typename R::Compute_volume_3( Tetrahedron_3)>::type
decltype(auto)
volume() const
{
return R().compute_volume_3_object()(*this);

View File

@ -22,7 +22,6 @@
#include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/Bbox_2.h>
#include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h>
namespace CGAL {
@ -101,13 +100,13 @@ public:
return !(*this == t);
}
typename cpp11::result_of<typename R::Construct_vertex_2( Triangle_2, int)>::type
decltype(auto)
vertex(int i) const
{
return R().construct_vertex_2_object()(*this,i);
}
typename cpp11::result_of<typename R::Construct_vertex_2( Triangle_2, int)>::type
decltype(auto)
operator[](int i) const
{
return vertex(i);

View File

@ -82,13 +82,13 @@ public:
}
typename cpp11::result_of<typename R::Construct_vertex_3( Triangle_3, int )>::type
decltype(auto)
vertex(int i) const
{
return R().construct_vertex_3_object()(*this, i);
}
typename cpp11::result_of<typename R::Construct_vertex_3( Triangle_3, int )>::type
decltype(auto)
operator[](int i) const
{
return vertex(i);

View File

@ -25,7 +25,6 @@
#include <CGAL/kernel_assertions.h>
#include <CGAL/representation_tags.h>
#include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h>
namespace CGAL {
@ -103,26 +102,26 @@ public:
}
typename cpp11::result_of<typename R::Compute_x_2(Vector_2)>::type
decltype(auto)
x() const
{
return R().compute_x_2_object()(*this);
}
typename cpp11::result_of<typename R::Compute_y_2(Vector_2)>::type
decltype(auto)
y() const
{
return R().compute_y_2_object()(*this);
}
typename cpp11::result_of<typename R::Compute_y_2(Vector_2)>::type
decltype(auto)
cartesian(int i) const
{
CGAL_kernel_precondition( (i == 0) || (i == 1) );
return (i==0) ? x() : y();
}
typename cpp11::result_of<typename R::Compute_x_2(Vector_2)>::type
decltype(auto)
operator[](int i) const
{
return cartesian(i);
@ -138,26 +137,26 @@ public:
return typename R::Construct_cartesian_const_iterator_2()(*this,2);
}
typename cpp11::result_of<typename R::Compute_hx_2(Vector_2)>::type
decltype(auto)
hx() const
{
return R().compute_hx_2_object()(*this);
}
typename cpp11::result_of<typename R::Compute_hy_2(Vector_2)>::type
decltype(auto)
hy() const
{
return R().compute_hy_2_object()(*this);
}
typename cpp11::result_of<typename R::Compute_hw_2(Vector_2)>::type
decltype(auto)
hw() const
{
return R().compute_hw_2_object()(*this);
}
typename cpp11::result_of<typename R::Compute_hx_2(Vector_2)>::type
decltype(auto)
homogeneous(int i) const
{
CGAL_kernel_precondition( (i >= 0) || (i <= 2) );

View File

@ -25,7 +25,6 @@
#include <boost/type_traits/is_same.hpp>
#include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/IO/io.h>
namespace CGAL {
@ -173,49 +172,49 @@ public:
return *this;
}
typename cpp11::result_of<typename R::Compute_x_3(Vector_3)>::type
decltype(auto)
x() const
{
return R().compute_x_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_y_3(Vector_3)>::type
decltype(auto)
y() const
{
return R().compute_y_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_z_3(Vector_3)>::type
decltype(auto)
z() const
{
return R().compute_z_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_hx_3(Vector_3)>::type
decltype(auto)
hx() const
{
return R().compute_hx_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_hy_3(Vector_3)>::type
decltype(auto)
hy() const
{
return R().compute_hy_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_hz_3(Vector_3)>::type
decltype(auto)
hz() const
{
return R().compute_hz_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_hw_3(Vector_3)>::type
decltype(auto)
hw() const
{
return R().compute_hw_3_object()(*this);
}
typename cpp11::result_of<typename R::Compute_x_3(Vector_3)>::type
decltype(auto)
cartesian(int i) const
{
CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) );
@ -224,7 +223,7 @@ public:
return z();
}
typename cpp11::result_of<typename R::Compute_hw_3(Vector_3)>::type
decltype(auto)
homogeneous(int i) const
{
CGAL_kernel_precondition( (i >= 0) || (i <= 3) );
@ -239,7 +238,7 @@ public:
return 3;
}
typename cpp11::result_of<typename R::Compute_x_3(Vector_3)>::type
decltype(auto)
operator[](int i) const
{
return cartesian(i);
@ -255,7 +254,7 @@ public:
return typename R::Construct_cartesian_const_iterator_3()(*this,3);
}
typename cpp11::result_of<typename R::Compute_squared_length_3(Vector_3)>::type
decltype(auto)
squared_length() const
{
return R().compute_squared_length_3_object()(*this);

View File

@ -24,7 +24,6 @@
#include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/Bbox_2.h>
#include <CGAL/Dimension.h>
#include <CGAL/result_of.h>
#include <CGAL/Point_2.h>
namespace CGAL {
@ -83,50 +82,50 @@ public:
: Rep(typename R::Construct_weighted_point_2()(Return_base_tag(), x, y))
{}
typename cpp11::result_of<typename R::Construct_point_2( Weighted_point_2)>::type
decltype(auto)
point() const
{
return typename R::Construct_point_2()(*this);
}
typename cpp11::result_of<typename R::Compute_weight_2( Weighted_point_2)>::type
decltype(auto)
weight() const
{
return typename R::Compute_weight_2()(*this);
}
typename cpp11::result_of<typename R::Compute_x_2( Point_2)>::type
decltype(auto)
x() const
{
return typename R::Compute_x_2()(point());
}
typename cpp11::result_of<typename R::Compute_y_2( Point_2)>::type
decltype(auto)
y() const
{
return typename R::Compute_y_2()(point());
}
typename cpp11::result_of<typename R::Compute_hx_2( Point_2)>::type
decltype(auto)
hx() const
{
return R().compute_hx_2_object()(point());
}
typename cpp11::result_of<typename R::Compute_hy_2( Point_2)>::type
decltype(auto)
hy() const
{
return R().compute_hy_2_object()(point());
}
typename cpp11::result_of<typename R::Compute_hw_2( Point_2)>::type
decltype(auto)
hw() const
{
return R().compute_hw_2_object()(point());
}
typename cpp11::result_of<typename R::Compute_x_2( Point_2)>::type
decltype(auto)
cartesian(int i) const
{
CGAL_kernel_precondition( (i == 0) || (i == 1) );
@ -143,7 +142,7 @@ public:
return hw();
}
typename cpp11::result_of<typename R::Compute_x_2(Point_2)>::type
decltype(auto)
operator[](int i) const
{
return cartesian(i);

View File

@ -84,62 +84,62 @@ public:
: Rep(typename R::Construct_weighted_point_3()(Return_base_tag(), x, y, z))
{}
typename cpp11::result_of<typename R::Construct_point_3(Weighted_point_3)>::type
decltype(auto)
point() const
{
return typename R::Construct_point_3()(*this);
}
typename cpp11::result_of<typename R::Compute_weight_3(Weighted_point_3)>::type
decltype(auto)
weight() const
{
return typename R::Compute_weight_3()(*this);
}
typename cpp11::result_of<typename R::Compute_x_3(Point_3)>::type
decltype(auto)
x() const
{
return typename R::Compute_x_3()(point());
}
typename cpp11::result_of<typename R::Compute_y_3(Point_3)>::type
decltype(auto)
y() const
{
return typename R::Compute_y_3()(point());
}
typename cpp11::result_of<typename R::Compute_z_3(Point_3)>::type
decltype(auto)
z() const
{
return typename R::Compute_z_3()(point());
}
typename cpp11::result_of<typename R::Compute_hx_3(Point_3)>::type
decltype(auto)
hx() const
{
return R().compute_hx_3_object()(point());
}
typename cpp11::result_of<typename R::Compute_hy_3(Point_3)>::type
decltype(auto)
hy() const
{
return R().compute_hy_3_object()(point());
}
typename cpp11::result_of<typename R::Compute_hz_3(Point_3)>::type
decltype(auto)
hz() const
{
return R().compute_hz_3_object()(point());
}
typename cpp11::result_of<typename R::Compute_hw_3(Point_3)>::type
decltype(auto)
hw() const
{
return R().compute_hw_3_object()(point());
}
typename cpp11::result_of<typename R::Compute_x_3(Point_3)>::type
decltype(auto)
cartesian(int i) const
{
CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) );
@ -158,7 +158,7 @@ public:
return hw();
}
typename cpp11::result_of<typename R::Compute_x_3(Point_3)>::type
decltype(auto)
operator[](int i) const
{
return cartesian(i);

View File

@ -23,11 +23,6 @@
#include <iostream>
#include <cstdlib>
// This cannot be disabled for now until we have a clear idea which
// compilers implement N3276.
#include <CGAL/result_of.h>
#include <CGAL/assertions.h>
#include <CGAL/tags.h>
#include <CGAL/number_type_basic.h>

View File

@ -327,8 +327,7 @@ public:
//compute intersection points in projected plane
//We know that none of the segment is degenerate
typename CGAL::cpp11::result_of<typename R::Intersect_2(Segment_2, Segment_2)>::type
o = intersection(s1_2,s2_2);
auto o = intersection(s1_2,s2_2);
if(! o){
return boost::none;
}

View File

@ -17,8 +17,7 @@ template <class K1, class K2, class T1, class T2>
void test_2d(const T1& t1, const T2& t2)
{
CGAL::Cartesian_converter<K1,K2> convert;
typename CGAL::cpp11::result_of<typename K1::Intersect_2(T1, T2)>::type res1 =
CGAL::intersection(t1, t2);
const auto res1 = CGAL::intersection(t1, t2);
assert( is_intersection_empty( convert(res1) ) == is_intersection_empty(res1) );
}
@ -26,8 +25,7 @@ template <class K1, class K2, class T1, class T2>
void test_3d(const T1& t1, const T2& t2)
{
CGAL::Cartesian_converter<K1,K2> convert;
typename CGAL::cpp11::result_of<typename K1::Intersect_3(T1, T2)>::type res1 =
CGAL::intersection(t1, t2);
const auto res1 = CGAL::intersection(t1, t2);
assert( is_intersection_empty( convert(res1) ) == is_intersection_empty(res1) );
}
@ -112,7 +110,6 @@ void test_linear_intersections()
test_3d<K1,K2>(triangle_3, triangle_3);
CGAL::Cartesian_converter<K1,K2> convert;
typename CGAL::cpp11::result_of<typename K1::Intersect_3(Plane_3, Plane_3, Plane_3)>::type res1 =
CGAL::intersection(plane_3, plane_3, plane_3);
const auto res1 = CGAL::intersection(plane_3, plane_3, plane_3);
assert( is_intersection_empty( convert(res1) ) == is_intersection_empty(res1) );
}

View File

@ -747,7 +747,7 @@ test_new_3(const R& rep)
= rep.oriented_side_3_object();
Oriented_side tmp39 = oriented_side(h2,p2);
tmp39 = oriented_side(sp9,p2);
tmp39 = oriented_side(p2,v1,p2);
tmp39 = oriented_side(p2,v3,p2);
(void) tmp39;
typename R::Bounded_side_3 bounded_side

View File

@ -34,14 +34,16 @@ The same functionality is also available through the functor `Kernel::Intersect_
The following table gives the possible values for `Type1` and `Type2`.
The return type can be obtained through `cpp11::result_of<Kernel::Intersect_d(A, B)>::%type`.
It is equivalent to `boost::optional< boost::variant< T... > >`, the last column in the table providing the template parameter pack.
The return type of intersecting two objects of the types `Type1` and `Type2` can be
specified through the placeholder type specifier `auto`. It is equivalent to
`boost::optional< boost::variant< T... > >`, the last column in the table providing
the template parameter pack.
<DIV ALIGN="CENTER">
<TABLE CELLPADDING=3 BORDER="1">
<TR> <TH> Type1 </TH>
<TR>
<TH> Type1 </TH>
<TH> Type2 </TH>
<TH> `T...` </TH>
</TR>
@ -143,13 +145,8 @@ struct Intersection_visitor {
template <class R>
void foo(Segment_d<R> seg, Line_d<R> lin)
{
// with C++11 support
// auto result = intersection(seg, lin);
// without C++11 support
typename cpp11::result_of<R::Intersect_d(Segment_d<R>, Line_d<R>)>::type
result = intersection(seg, lin);
// use auto
auto result = intersection(seg, lin);
if(result) { boost::apply_visitor(Intersection_visitor<R>(), *result); }
else { // no intersection
}
@ -160,10 +157,10 @@ void foo(Segment_d<R> seg, Line_d<R> lin)
\sa `Kernel_d::Intersect_d`
\sa <a HREF="https://www.boost.org/doc/libs/release/libs/optional/index.html">`boost::optional`</a>
\sa <a HREF="https://www.boost.org/doc/html/variant.html">`boost::variant`</a>
\sa `cpp11::result_of`
*/
cpp11::result_of<R::Intersect_d(Type1<R>, Type2<R>)>::type intersection(Type1<R> f1, Type2<R> f2);
decltype(auto)
intersection(Type1<R> f1, Type2<R> f2);
} /* namespace CGAL */

View File

@ -23,7 +23,7 @@ For a list of the possible return types, see `CGAL::intersection()`.
\pre `p` and `q` have the same dimension.
*/
template <class Type1, class Type2>
cpp11::result_of<Kernel::Intersect_d(Type1, Type2)>::type
decltype(auto)
operator()(const Type1& p, const Type2& q);
/// @}

View File

@ -480,17 +480,14 @@ that are part of flats (`R::Segment_d`, `R::Ray_d`,
returns a `boost::optional< boost::variant< T... > >`
where `T...` is a list of all possible resulting geometric objects.
The exact result type of an intersection can be determined by using
`cpp11::result_of<Kernel::Intersect_d(Type1, Type2)>::%type`
where `Type1` and `Type2` are the types of the objects
used in the intersection computation.
The return type of intersecting two objects of the types `Type1` and `Type2` can be
specified through the placeholder type specifier `auto`.
\subsubsection Kernel_dExample Example
In the following example, the object type is used as a return value for
the intersection computation, as there are
possibly different return values.
In the following example, the `auto` is used for the intersection computation,
as there are possibly different return values.
\code{.cpp}
typedef Cartesian_d<double> K;
@ -500,9 +497,9 @@ typedef Segment_d<K> Segment;
Segment s1, s2;
std::cin >> s1 >> s2;
cpp11::result_of<K::Intersect_d(Segment, Segment)>::type
v = intersection(s1, s2);
if(v) {
// use auto
auto v = intersection(s1, s2);
if (v) {
// not empty
if (const Point *p = boost::get<Point>(&*v) ) {
// do something with *p

View File

@ -25,7 +25,7 @@ namespace Intersections {
namespace internal {
template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Line_d, typename R::Line_d)>::type
decltype(auto)
intersection(const typename R::Line_d& l1, const typename R::Line_d& l2, const R&)
{
typedef typename R::Line_d_Line_d_pair ll_pair;
@ -46,7 +46,7 @@ intersection(const typename R::Line_d& l1, const typename R::Line_d& l2, const R
}
template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Ray_d, typename R::Ray_d)>::type
decltype(auto)
intersection(const typename R::Ray_d& l1, const typename R::Ray_d& l2, const R&)
{
typedef typename R::Ray_d_Ray_d_pair ll_pair;
@ -75,7 +75,7 @@ intersection(const typename R::Ray_d& l1, const typename R::Ray_d& l2, const R&)
}
template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Segment_d, typename R::Segment_d)>::type
decltype(auto)
intersection(const typename R::Segment_d& l1, const typename R::Segment_d& l2, const R&)
{
typedef typename R::Segment_d_Segment_d_pair ll_pair;
@ -99,7 +99,7 @@ intersection(const typename R::Segment_d& l1, const typename R::Segment_d& l2, c
}
template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Line_d, typename R::Ray_d)>::type
decltype(auto)
intersection(const typename R::Line_d& l, const typename R::Ray_d& r, const R&)
{
typedef typename R::Line_d_Ray_d_pair lr_pair;
@ -121,12 +121,12 @@ intersection(const typename R::Line_d& l, const typename R::Ray_d& r, const R&)
}
template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Ray_d, typename R::Line_d)>::type
decltype(auto)
intersection(const typename R::Ray_d& r, const typename R::Line_d& l, const R& k)
{ return intersection(l,r,k); }
template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Ray_d, typename R::Segment_d)>::type
decltype(auto)
intersection(const typename R::Ray_d& r, const typename R::Segment_d& s, const R&)
{
typedef typename R::Ray_d_Segment_d_pair rs_pair;
@ -150,12 +150,12 @@ intersection(const typename R::Ray_d& r, const typename R::Segment_d& s, const R
}
template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Segment_d, typename R::Ray_d)>::type
decltype(auto)
intersection(const typename R::Segment_d& s, const typename R::Ray_d& r, const R& k)
{ return intersection(r,s, k); }
template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Line_d, typename R::Segment_d)>::type
decltype(auto)
intersection(const typename R::Line_d& l, const typename R::Segment_d& s, const R&)
{
typedef typename R::Line_d_Segment_d_pair rs_pair;
@ -179,12 +179,12 @@ intersection(const typename R::Line_d& l, const typename R::Segment_d& s, const
}
template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Segment_d, typename R::Line_d)>::type
decltype(auto)
intersection(const typename R::Segment_d& s, const typename R::Line_d& l, const R& r)
{ return intersection(l,s,r); }
template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Line_d, typename R::Hyperplane_d)>::type
decltype(auto)
intersection(const typename R::Line_d& l, const typename R::Hyperplane_d& h, const R&)
{
typedef typename R::Line_d_Hyperplane_d_pair lh_pair;
@ -205,12 +205,12 @@ intersection(const typename R::Line_d& l, const typename R::Hyperplane_d& h, con
}
template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Hyperplane_d, typename R::Line_d)>::type
decltype(auto)
intersection(const typename R::Hyperplane_d& h, const typename R::Line_d& l, const R& r)
{ return intersection(l,h,r); }
template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Ray_d, typename R::Hyperplane_d)>::type
decltype(auto)
intersection(const typename R::Ray_d& r, const typename R::Hyperplane_d& h, const R&)
{
typedef typename R::Ray_d_Hyperplane_d_pair rh_pair;
@ -231,12 +231,12 @@ intersection(const typename R::Ray_d& r, const typename R::Hyperplane_d& h, cons
}
template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Hyperplane_d, typename R::Ray_d)>::type
decltype(auto)
intersection(const typename R::Hyperplane_d& h, const typename R::Ray_d& r, const R& k)
{ return intersection(r,h,k); }
template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Segment_d, typename R::Hyperplane_d)>::type
decltype(auto)
intersection(const typename R::Segment_d& s, const typename R::Hyperplane_d& h, const R&)
{
typedef typename R::Segment_d_Hyperplane_d_pair sh_pair;
@ -258,7 +258,7 @@ intersection(const typename R::Segment_d& s, const typename R::Hyperplane_d& h,
}
template <class R>
typename cpp11::result_of<typename R::Intersect_d(typename R::Hyperplane_d, typename R::Segment_d)>::type
decltype(auto)
intersection(const typename R::Hyperplane_d& h, const typename R::Segment_d& s, const R& r)
{ return intersection(s,h,r); }

View File

@ -15,6 +15,7 @@
#include <CGAL/IO/OFF.h>
#include <CGAL/Linear_cell_complex_incremental_builder.h>
#include <algorithm>
#include <iostream>
#include <fstream>
#include <map>
@ -28,65 +29,41 @@ namespace CGAL {
* CGAL data structures.
*/
/** Import an embedded plane graph read into a flux into a
* linear cell complex.
* @param alcc the linear cell complex where the graph will be imported.
* @param ais the istream where read the graph.
* @return A dart created during the convertion.
/**
* Imports a plane-embedded graph from a list of points and edges represented as pairs of vertex indices
*/
template< class LCC >
typename LCC::Dart_handle import_from_plane_graph(LCC& alcc,
std::istream& ais)
const std::vector<typename LCC::Point>& vertices,
const std::vector<size_t>& edge_indices)
{
CGAL_static_assertion( LCC::dimension>=2 && LCC::ambient_dimension==2 );
typedef typename LCC::Traits::Construct_direction_2 Construct_direction_2;
typedef typename LCC::Traits::Construct_vector Construct_vector;
typedef typename LCC::Dart_handle Dart_handle;
typedef typename LCC::Traits::Direction_2 Direction;
typedef typename std::list<Dart_handle>::iterator List_iterator;
typedef typename std::map<Direction, Dart_handle>::iterator LCC_iterator;
typedef typename std::list<Dart_handle>::iterator List_iterator;
typedef typename LCC::Point Point;
CGAL_static_assertion( LCC::dimension>=2 && LCC::ambient_dimension==2 );
CGAL_assertion(edge_indices.size() % 2 == 0);
// Arrays of vertices
std::vector< typename LCC::Vertex_attribute_handle > initVertices;
std::vector< std::list<Dart_handle> > testVertices;
initVertices.reserve(vertices.size());
std::transform(vertices.begin(),
vertices.end(),
std::back_inserter(initVertices),
[&](const Point& point) {
return alcc.create_vertex_attribute(point);
});
std::string txt;
typename LCC::FT x, y;
Dart_handle d1=alcc.null_handle;
unsigned int v1, v2;
unsigned int nbSommets = 0;
unsigned int nbAretes = 0;
ais >> nbSommets >> nbAretes;
while (nbSommets > 0)
{
if (!ais.good())
{
std::cout << "Problem: file does not contain enough vertices."
<< std::endl;
return alcc.null_handle;
}
ais >> iformat(x) >> iformat(y);
initVertices.push_back(alcc.create_vertex_attribute
(typename LCC::Point(x, y)));
testVertices.push_back(std::list<Dart_handle>());
--nbSommets;
}
while (nbAretes>0)
{
if (!ais.good())
{
std::cout << "Problem: file does not contain enough edges."
<< std::endl;
return alcc.null_handle;
}
// We read an egde (given by the number of its two vertices).
ais >> v1 >> v2;
--nbAretes;
std::vector< std::list<Dart_handle> > testVertices{vertices.size(), std::list<Dart_handle>()};
Dart_handle d1 = alcc.null_handle;
for (std::size_t i = 0; (i + 1) < edge_indices.size(); i += 2) {
const auto& v1 = edge_indices[i];
const auto& v2 = edge_indices[i + 1];
CGAL_assertion(v1 < initVertices.size());
CGAL_assertion(v2 < initVertices.size());
@ -103,7 +80,6 @@ namespace CGAL {
Dart_handle first = alcc.null_handle;
Dart_handle prec = alcc.null_handle;
typename LCC::Point sommet1, sommet2;
for (unsigned int i=0; i<initVertices.size(); ++i)
{
@ -113,22 +89,22 @@ namespace CGAL {
// 1. We insert all the darts and sort them depending on the direction
tabDart.clear();
sommet1 = alcc.point(*it);
sommet2 = alcc.point(alcc.other_extremity(*it));
Point vertex1 = alcc.point(*it);
Point vertex2 = alcc.point(alcc.other_extremity(*it));
tabDart.insert(std::pair<Direction, Dart_handle>
(typename LCC::Traits::Construct_direction_2()
(typename LCC::Traits::Construct_vector()
(sommet1,sommet2)), *it));
(Construct_direction_2()
(Construct_vector()
(vertex1,vertex2)), *it));
++it;
while (it!=testVertices[i].end())
{
sommet2 = alcc.point(alcc.other_extremity(*it));
vertex2 = alcc.point(alcc.other_extremity(*it));
tabDart.insert(std::pair<Direction, Dart_handle>
(typename LCC::Traits::Construct_direction_2()
(typename LCC::Traits::Construct_vector()
(sommet1,sommet2)), *it));
(Construct_direction_2()
(Construct_vector()
(vertex1,vertex2)), *it));
++it;
}
@ -152,6 +128,64 @@ namespace CGAL {
return first;
}
/**
* Imports a plane-embedded graph from a file into a LinearCellComplex.
*
* @param alcc the linear cell complex where the graph will be imported.
* @param ais the istream where read the graph.
* @return A dart created during the convertion.
*/
template< class LCC >
typename LCC::Dart_handle import_from_plane_graph(LCC& alcc,
std::istream& ais)
{
using FT = typename LCC::FT;
using Point = typename LCC::Point;
std::vector<Point> vertices;
unsigned int numVertices = 0;
unsigned int numEdges = 0;
ais >> numVertices >> numEdges;
while (numVertices > 0)
{
if (!ais.good())
{
std::cout << "Problem: file does not contain enough vertices."
<< std::endl;
return alcc.null_handle;
}
FT x, y;
ais >> iformat(x) >> iformat(y);
vertices.push_back(Point{x, y});
--numVertices;
}
std::vector<size_t> edge_indices;
while (numEdges>0)
{
if (!ais.good())
{
std::cout << "Problem: file does not contain enough edges."
<< std::endl;
return alcc.null_handle;
}
// We read an edge (given by the number of its two vertices).
unsigned int v1, v2;
ais >> v1 >> v2;
--numEdges;
CGAL_assertion(v1 < vertices.size());
CGAL_assertion(v2 < vertices.size());
edge_indices.push_back(v1);
edge_indices.push_back(v2);
}
return import_from_plane_graph(alcc, vertices, edge_indices);
}
template < class LCC >
typename LCC::Dart_handle
import_from_plane_graph(LCC& alcc, const char* filename)

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