fixed ch3, inter3, otr2, psp, pmp, smsp, mesh3 + cleanup

This commit is contained in:
Dmitry Anisimov 2020-08-20 18:25:01 +02:00
parent 371db977c8
commit 263ad6bc99
16 changed files with 61 additions and 106 deletions

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

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

@ -145,7 +145,6 @@
#include <boost/type_traits/remove_reference.hpp>
#include <boost/utility.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/utility/result_of.hpp>
#include <boost/variant.hpp>
#include <boost/version.hpp>

View File

@ -312,11 +312,11 @@ public:
/*!
A constructor object that must provide the function operators:
`CGAL::cpp11::result_of< Kernel::Intersect_3(Segment_3, Plane_3)>::%type operator()(Segment_3 s, Plane_3 p)`
`boost::optional< boost::variant< T... > > operator()(Segment_3 s, Plane_3 p)`
`CGAL::cpp11::result_of< Kernel::Intersect_3(Ray_3, Iso_cuboid_3)>::%type operator()(Ray_3 r, Iso_cuboid i)`
`boost::optional< boost::variant< T... > > operator()(Ray_3 r, Iso_cuboid i)`
`CGAL::cpp11::result_of< Kernel::Intersect_3(Segment_3, Iso_cuboid_3)>::%type operator()(Segment_3 s, Iso_cuboid i)`
`boost::optional< boost::variant< T... > > operator()(Segment_3 s, Iso_cuboid i)`
which returns the intersection region of two geometrical objects.
*/

View File

@ -31,7 +31,6 @@
#include <CGAL/tuple.h>
#include <CGAL/Origin.h>
#include <CGAL/result_of.h>
#include <functional>
#include <CGAL/internal/Mesh_3/Handle_IO_for_pair_of_int.h>
@ -590,9 +589,7 @@ public:
template<typename Query>
Surface_patch clip_to_segment(const Query& query) const
{
typename cpp11::result_of<typename BGT::Intersect_3(Query, Iso_cuboid_3)>::type
clipped = CGAL::intersection(query, r_domain_.bbox_);
const auto clipped = CGAL::intersection(query, r_domain_.bbox_);
if(clipped)
if(const Segment_3* s = boost::get<Segment_3>(&*clipped))
return this->operator()(*s);
@ -720,9 +717,7 @@ public:
template<typename Query>
Intersection clip_to_segment(const Query& query) const
{
typename cpp11::result_of<typename BGT::Intersect_3(Query, Iso_cuboid_3)>::type
clipped = CGAL::intersection(query, r_domain_.bbox_);
const auto clipped = CGAL::intersection(query, r_domain_.bbox_);
if(clipped)
if(const Segment_3* s = boost::get<Segment_3>(&*clipped))
return this->operator()(*s);

View File

@ -261,15 +261,15 @@ lp_intersection(const typename K::Point_3& p, const typename K::Point_3& q,
// returns a point or the empty Object. In case of degeneracy, the empty
// Object is returned as well.
template <class K>
typename cpp11::result_of<
typename K::Intersect_3(typename K::Segment_3, typename K::Triangle_3)>::type
decltype(auto)
ts_intersection(const typename K::Triangle_3 &t,
const typename K::Segment_3 &s,
const K & k)
{
typedef typename cpp11::result_of<
typename K::Intersect_3(typename K::Segment_3, typename K::Triangle_3)
>::type result_type;
typedef decltype(
std::declval<typename K::Intersect_3>()(
std::declval<typename K::Segment_3>(),
std::declval<typename K::Triangle_3>())) result_type;
CGAL_MESH_3_BRANCH_PROFILER(std::string("coplanar/calls in : ") +
std::string(CGAL_PRETTY_FUNCTION), tmp);
@ -399,8 +399,7 @@ ts_intersection(const typename K::Triangle_3 &t,
template <class K>
typename cpp11::result_of<
typename K::Intersect_3(typename K::Ray_3, typename K::Triangle_3)>::type
decltype(auto)
tr_intersection(const typename K::Triangle_3 &t,
const typename K::Ray_3 &r,
const K& k)
@ -410,9 +409,10 @@ tr_intersection(const typename K::Triangle_3 &t,
CGAL_kernel_precondition( ! k.is_degenerate_3_object()(t) ) ;
CGAL_kernel_precondition( ! k.is_degenerate_3_object()(r) ) ;
typedef typename cpp11::result_of<
typename K::Intersect_3(typename K::Ray_3, typename K::Triangle_3)
>::type result_type;
typedef decltype(
std::declval<typename K::Intersect_3>()(
std::declval<typename K::Ray_3>(),
std::declval<typename K::Triangle_3>())) result_type;
typedef typename K::Point_3 Point_3;
@ -471,20 +471,12 @@ public:
typedef typename K_::Segment_3 Segment_3;
typedef typename K_::Ray_3 Ray_3;
template <typename>
struct result;
template <typename F, typename A, typename B>
struct result<F(A, B)> {
typedef typename cpp11::result_of<typename K_::Intersect_3(A, B)>::type type;
};
typedef Exact_predicates_exact_constructions_kernel EK;
typedef Cartesian_converter<typename K_::Kernel, EK> To_exact;
typedef Cartesian_converter<EK, typename K_::Kernel> Back_from_exact;
template<class T1, class T2>
typename cpp11::result_of<typename K_::Intersect_3(T1, T2)>::type
decltype(auto)
operator() (const T1& t, const T2& s) const
{
// Switch to exact
@ -493,28 +485,31 @@ public:
EK::Intersect_3 exact_intersection = EK().intersect_3_object();
// Cartesian converters have an undocumented, optional< variant > operator
return typename cpp11::result_of<typename K_::Intersect_3(T1, T2)>::type
(back_from_exact(exact_intersection(to_exact(t), to_exact(s))));
typedef decltype(
std::declval<typename K_::Intersect_3>()(
std::declval<T1>(), std::declval<T2>())) result_type;
return result_type(back_from_exact(exact_intersection(to_exact(t), to_exact(s))));
}
typename cpp11::result_of<typename K_::Intersect_3(Segment_3, Triangle_3)>::type
decltype(auto)
operator()(const Segment_3& s, const Triangle_3& t) const
{
return ts_intersection(t, s, K_());
}
typename cpp11::result_of<typename K_::Intersect_3(Segment_3, Triangle_3)>::type
decltype(auto)
operator()(const Triangle_3& t, const Segment_3& s) const
{
return ts_intersection(t, s, K_());
}
typename cpp11::result_of<typename K_::Intersect_3(Ray_3, Triangle_3)>::type
decltype(auto)
operator()(const Ray_3& r, const Triangle_3& t) const {
return tr_intersection(t, r, K_());
}
typename cpp11::result_of<typename K_::Intersect_3(Ray_3, Triangle_3)>::type
decltype(auto)
operator()(const Triangle_3& t, const Ray_3& r) const
{
return tr_intersection(t, r, K_());
@ -531,20 +526,12 @@ public:
typedef typename K_::Triangle_3 Triangle_3;
typedef typename K_::Segment_3 Segment_3;
template <typename>
struct result;
template <typename F, typename A, typename B>
struct result<F(A, B)> {
typedef typename cpp11::result_of<typename K_::Intersect_3(A, B)>::type type;
};
typedef Exact_predicates_exact_constructions_kernel EK;
typedef Cartesian_converter<typename K_::Kernel, EK> To_exact;
typedef Cartesian_converter<EK, typename K_::Kernel> Back_from_exact;
template<class T1, class T2>
typename cpp11::result_of<typename K_::Intersect_3(T1, T2)>::type
decltype(auto)
operator() (const T1& t, const T2& s) const
{
// Switch to exact
@ -553,8 +540,11 @@ public:
EK::Intersect_3 exact_intersection = EK().intersect_3_object();
// Cartesian converters have an undocumented, optional< variant > operator
return typename cpp11::result_of<typename K_::Intersect_3(T1, T2)>::type
(back_from_exact(exact_intersection(to_exact(t), to_exact(s))));
typedef decltype(
std::declval<typename K_::Intersect_3>()(
std::declval<T1>(), std::declval<T2>())) result_type;
return result_type(back_from_exact(exact_intersection(to_exact(t), to_exact(s))));
}
};

View File

@ -384,8 +384,6 @@ struct Sizing_field_with_aabb_tree
//Compute distance to the curve on which p lies
typedef typename GeomTraits::Segment_3 Segment_3;
typedef typename GeomTraits::Plane_3 Plane_3;
typedef typename CGAL::cpp11::result_of<
typename GeomTraits::Intersect_3(Segment_3, Plane_3)>::type Intersection_result;
const typename Input_curves_AABB_tree_::Point_and_primitive_id& ppid
= domain.curves_aabb_tree().closest_point_and_primitive(p);
@ -416,8 +414,7 @@ struct Sizing_field_with_aabb_tree
if (curve_id != prim.id().first->first)
continue;//don't deal with the same curves as what is done above
Intersection_result int_res
= CGAL::intersection(prim.datum(), curr_ortho_plane);
const auto int_res = CGAL::intersection(prim.datum(), curr_ortho_plane);
if (int_res)
{
if (const Point_3* pp = boost::get<Point_3>(&*int_res))

View File

@ -439,9 +439,7 @@ public:
if(r_domain_.query_is_cached(q))
{
const AABB_primitive_id primitive_id = r_domain_.cached_primitive_id();
typename cpp11::result_of<
typename IGT::Intersect_3(typename Primitive::Datum, Query)>::type o
= IGT().intersect_3_object()(Primitive(primitive_id).datum(),q);
const auto o = IGT().intersect_3_object()(Primitive(primitive_id).datum(),q);
intersection = o ?
Intersection_and_primitive_id(*o, primitive_id) :
AABB_intersection();

View File

@ -787,8 +787,7 @@ public:
pt, geom_traits().construct_vector_2_object()(pt, ps));
boost::optional<FT> Dqt;
typename CGAL::cpp11::result_of<typename Traits_::Intersect_2(Line, Line)>::type
result = intersection(lab, lts);
const auto result = intersection(lab, lts);
if (result)
{
const Point* iq = boost::get<Point>(&(*result));

View File

@ -780,9 +780,7 @@ private:
double angle_A = std::acos (CGAL::abs (plane1.orthogonal_vector() * plane2.orthogonal_vector()));
double angle_B = CGAL_PI - angle_A;
typename cpp11::result_of<typename Kernel::Intersect_3(Plane, Plane)>::type
result = CGAL::intersection(plane1, plane2);
const auto result = CGAL::intersection(plane1, plane2);
if (!result)
{
#ifdef CGAL_PSP3_VERBOSE
@ -1009,8 +1007,7 @@ private:
pts2.push_back (m_points[inde]);
}
typename cpp11::result_of<typename Kernel::Intersect_3(Plane, Plane)>::type
result = CGAL::intersection (plane1, ortho);
auto result = CGAL::intersection (plane1, ortho);
if (result)
{
if (const Line* l = boost::get<Line>(&*result))
@ -1174,16 +1171,12 @@ private:
const Plane& plane2 = m_planes[m_corners[i].planes[1]];
const Plane& plane3 = m_planes[m_corners[i].planes[2]];
typename cpp11::result_of<typename Kernel::Intersect_3(Plane, Plane)>::type
result = CGAL::intersection(plane1, plane2);
const auto result = CGAL::intersection(plane1, plane2);
if (result)
{
if (const Line* l = boost::get<Line>(&*result))
{
typename cpp11::result_of<typename Kernel::Intersect_3(Line, Plane)>::type
result2 = CGAL::intersection(*l, plane3);
const auto result2 = CGAL::intersection(*l, plane3);
if (result2)
{
if (const Point* p = boost::get<Point>(&*result2))

View File

@ -246,9 +246,7 @@ public:
p3(to_exact( get(vpm, source(h3,tm)) ),
to_exact( get(vpm, target(h3,tm)) ),
to_exact( get(vpm, target(next(h3,tm),tm))));
typename cpp11::result_of<
Exact_kernel::Intersect_3(Plane_3, Plane_3, Plane_3)
>::type inter_res = exact_intersection(p1, p2, p3);
const auto inter_res = exact_intersection(p1, p2, p3);
CGAL_assertion(inter_res != boost::none);
const Exact_kernel::Point_3* pt =
@ -363,9 +361,7 @@ public:
p3(get(vpm, source(h3,tm)),
get(vpm, target(h3,tm)),
get(vpm, target(next(h3,tm),tm)));
typename cpp11::result_of<
typename Exact_kernel::Intersect_3(Plane_3, Plane_3, Plane_3)
>::type inter_res = intersection(p1, p2, p3);
const auto inter_res = intersection(p1, p2, p3);
CGAL_assertion(inter_res != boost::none);
const Point_3* pt =

View File

@ -84,11 +84,8 @@ bool sorted_around_edge(
typename Kernel::Orientation_3 orientation;
typedef typename Kernel::Point_3 Point_3;
typedef typename cpp11::result_of<
typename Kernel::Orientation_3(Point_3, Point_3, Point_3, Point_3)>::type
Orientation;
Orientation s0 = orientation(o_prime, o, p1, p2);
const auto s0 = orientation(o_prime, o, p1, p2);
if ( s0==COPLANAR ) {
//o, o_prime, p1 and p2 are coplanar
@ -98,8 +95,8 @@ bool sorted_around_edge(
}
//o, o_prime, p1 and p2 are not coplanar
Orientation s1 = orientation(o_prime, o, p1, q);
Orientation s2 = orientation(o_prime, o, q , p2);
const auto s1 = orientation(o_prime, o, p1, q);
const auto s2 = orientation(o_prime, o, q , p2);
if (s0 == POSITIVE) // the angle p1,o,p2 is smaller that Pi.
return ( s1 == POSITIVE )

View File

@ -276,8 +276,7 @@ class Polygon_mesh_slicer
get(m_vpmap, source(ed, m_tmesh)),
get(m_vpmap,target(ed, m_tmesh))
);
typename cpp11::result_of<typename Traits_::Intersect_3(Plane_3, Segment_3)>::type
inter = intersect_3(m_plane, s);
const auto inter = intersect_3(m_plane, s);
CGAL_assertion(inter != boost::none);
const Point_3* pt_ptr = boost::get<Point_3>(&(*inter));
current_poly.push_back( *pt_ptr );

View File

@ -152,7 +152,7 @@ public:
/*!
Function object type.
Must provide
`CGAL::cpp11::result_of<Intersect_2(A,B)>::%type operator()(A obj1, B obj2)`
`boost::optional< boost::variant< T... > > operator()(A obj1, B obj2)`
to compute the intersection between `obj1` and `obj2`, where `A` and `B` can be any type amongst
`Line_2`, `Ray_2`, `Segment_2`.
*/

View File

@ -977,8 +977,6 @@ private:
typename Traits::Construct_point_on_2 cpo2(m_traits.construct_point_on_2_object());
typename Traits::Compute_parametric_distance_along_segment_2 pdas2(m_traits.compute_parametric_distance_along_segment_2_object());
typedef typename cpp11::result_of<typename Traits::Intersect_2(Line_2, Line_2)>::type LineLineIntersectResult;
Point_2 leftPoint;
Point_2 rightPoint;
@ -1003,7 +1001,7 @@ private:
}
else
{
LineLineIntersectResult cgalIntersection = i2(cl2(segment), cl2(leftBoundary));
const auto cgalIntersection = i2(cl2(segment), cl2(leftBoundary));
if (!cgalIntersection || !boost::get<Point_2>(&*cgalIntersection))
{
@ -1015,7 +1013,7 @@ private:
}
else
{
Point_2* result = boost::get<Point_2>(&*cgalIntersection);
const Point_2* result = boost::get<Point_2>(&*cgalIntersection);
FT t0 = pdas2(cs2(segment), ct2(segment), *result);
if (t0 >= FT(1))
@ -1061,7 +1059,7 @@ private:
}
else
{
LineLineIntersectResult cgalIntersection = i2(cl2(segment), cl2(rightBoundary));
const auto cgalIntersection = i2(cl2(segment), cl2(rightBoundary));
if (!cgalIntersection || !boost::get<Point_2>(&*cgalIntersection))
{
@ -1073,7 +1071,7 @@ private:
}
else
{
Point_2* result = boost::get<Point_2>(&*cgalIntersection);
const Point_2* result = boost::get<Point_2>(&*cgalIntersection);
FT t0 = pdas2(cs2(segment), ct2(segment), *result);
if (t0 <= FT(0))
@ -1695,8 +1693,6 @@ private:
typename Traits::Construct_target_2 construct_target_2(m_traits.construct_target_2_object());
typename Traits::Intersect_2 intersect_2(m_traits.intersect_2_object());
typedef typename cpp11::result_of<typename Traits::Intersect_2 (Line_2, Line_2)>::type LineLineIntersectResult;
Cone_tree_node* current = startNode;
Point_2 currentLocation(startLocation);
@ -1711,7 +1707,7 @@ private:
const Point_2& currentSourceImage = current->source_image();
Ray_2 rayToLocation(construct_ray_2(currentSourceImage, currentLocation));
LineLineIntersectResult cgalIntersection = intersect_2(construct_line_2(entrySegment), construct_line_2(rayToLocation));
const auto cgalIntersection = intersect_2(construct_line_2(entrySegment), construct_line_2(rayToLocation));
CGAL_assertion(bool(cgalIntersection));

View File

@ -25,7 +25,6 @@
#include <CGAL/assertions.h>
#include <CGAL/boost/graph/helpers.h>
#include <CGAL/number_utils.h>
#include <CGAL/result_of.h>
#include <CGAL/Cartesian_converter.h>
#include <cmath>
@ -459,12 +458,10 @@ public:
result_type operator () (const Segment_2& s1, const Line_2& l1, const Segment_2& s2, const Line_2& l2) const
{
typedef typename CGAL::cpp11::result_of<Intersect_2(Line_2, Line_2)>::type LineLineIntersectResult;
Line_2 s1Line(m_construct_line_2(s1));
Line_2 s2Line(m_construct_line_2(s2));
LineLineIntersectResult intersectResult1(m_intersect_2(s1Line, l1));
const auto intersectResult1 = m_intersect_2(s1Line, l1);
CGAL_assertion(bool(intersectResult1));
if (!intersectResult1) return CGAL::SMALLER;
@ -476,7 +473,7 @@ public:
CGAL_assertion_code(FT t1 = m_parametric_distance_along_segment_2(s1, *p1_ptr);)
CGAL_assertion(t1 >= FT(-1)/FT(100000) && t1 <= FT(1)+FT(1)/FT(100000));
LineLineIntersectResult intersectResult2 = m_intersect_2(s2Line, l2);
const auto intersectResult2 = m_intersect_2(s2Line, l2);
CGAL_assertion(bool(intersectResult2));
if (!intersectResult2) return CGAL::SMALLER;