Merge pull request #2562 from afabri/Filtered_kernel-Do_intersect_2-GF

Add Static Filters for the Exact Construction Kernel
This commit is contained in:
Laurent Rineau 2017-12-19 16:29:53 +01:00
commit f2391a30a5
28 changed files with 1005 additions and 207 deletions

View File

@ -715,7 +715,8 @@ public:
typename Kernel::Construct_opposite_direction_3 opposite_3 =
kernel->construct_opposite_direction_3_object();
Point_2 tmp1 = opposite_3(p); // pacify msvc 10
if (!kernel->equal_3_object()(tmp1, r1)) return EQUAL;
if (!kernel->equal_3_object()(Direction_3(tmp1), Direction_3(r1)))
return EQUAL;
Sign xsign = Traits::x_sign(p);
Sign ysign = Traits::y_sign(p);
@ -782,8 +783,8 @@ public:
equal_3(xc1.normal(), xc2.normal()));
}
return (equal_3(xc1.left(), xc2.left()) &&
equal_3(xc1.right(), xc2.right()));
return (equal_3(Direction_3(xc1.left()), Direction_3(xc2.left())) &&
equal_3(Direction_3(xc1.right()), Direction_3(xc2.right())));
}
/*! Determines whether the two points are the same.
@ -794,7 +795,7 @@ public:
bool operator()(const Point_2& p1, const Point_2& p2) const
{
const Kernel* kernel = m_traits;
return kernel->equal_3_object()(p1, p2);
return kernel->equal_3_object()(Direction_3(p1), Direction_3(p2));
}
};
@ -1561,8 +1562,8 @@ public:
CGAL_precondition_code(const Kernel* kernel = m_traits);
CGAL_precondition_code
(typename Kernel::Equal_3 equal_3 = kernel->equal_3_object());
CGAL_precondition(!equal_3(p, source));
CGAL_precondition(!equal_3(p, target));
CGAL_precondition(!equal_3(Direction_3(p), Direction_3(source)));
CGAL_precondition(!equal_3(Direction_3(p), Direction_3(target)));
xc1.set_normal(xc.normal());
xc1.set_is_vertical(xc.is_vertical());
@ -2467,7 +2468,8 @@ public:
typedef Arr_geodesic_arc_on_sphere_traits_2<Kernel> Traits;
Kernel kernel;
CGAL_precondition(!kernel.equal_3_object()(m_source, m_target));
CGAL_precondition(!kernel.equal_3_object()(Direction_3(m_source),
Direction_3(m_target)));
// Check whether any one of the endpoint coincide with a pole:
if (m_source.is_max_boundary()) {
@ -2538,7 +2540,8 @@ public:
// The arc is not vertical!
set_is_vertical(false);
set_is_directed_right(orient == LEFT_TURN);
set_is_full(kernel.equal_3_object()(m_source, m_target));
set_is_full(kernel.equal_3_object()(Direction_3(m_source),
Direction_3(m_target)));
}
/*! Construct a full spherical_arc from a plane
@ -2937,7 +2940,8 @@ public:
typedef typename Kernel::Direction_3 Direction_3;
Kernel kernel;
CGAL_precondition(!kernel.equal_3_object()(source, target));
CGAL_precondition(!kernel.equal_3_object()(Direction_3(source),
Direction_3(target)));
CGAL_precondition(!kernel.equal_3_object()
(kernel.construct_opposite_direction_3_object()(source),
static_cast<const Direction_3&>(target)));

View File

@ -76,7 +76,7 @@ void build_segments(std::vector< Segment_2 >& all_segments)
for( int i = 0; i < numArrays; ++i )
{
double angle = M_PI * (double)rand() / RAND_MAX;
double angle = CGAL_PI * (double)rand() / RAND_MAX;
double scale = 1 + (double)rand() / RAND_MAX;
get_rotated_line_array( x0, y0, angle, scale, all_segments );

View File

@ -0,0 +1,354 @@
// Copyright (c) 2017 GeometryFactory
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0+
//
//
// Author(s) : Andreas Fabri, Laurent Rineau
#ifndef CGAL_EPIC_CONVERTER_H
#define CGAL_EPIC_CONVERTER_H
#include <CGAL/basic.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
namespace CGAL {
template<typename IK>
class Epic_converter {
typedef typename Exact_predicates_inexact_constructions_kernel::Point_2 Point_2;
typedef typename Exact_predicates_inexact_constructions_kernel::Direction_2 Direction_2;
typedef typename Exact_predicates_inexact_constructions_kernel::Vector_2 Vector_2;
typedef typename Exact_predicates_inexact_constructions_kernel::Weighted_point_2 Weighted_point_2;
typedef typename Exact_predicates_inexact_constructions_kernel::Segment_2 Segment_2;
typedef typename Exact_predicates_inexact_constructions_kernel::Line_2 Line_2;
typedef typename Exact_predicates_inexact_constructions_kernel::Ray_2 Ray_2;
typedef typename Exact_predicates_inexact_constructions_kernel::Triangle_2 Triangle_2;
typedef typename Exact_predicates_inexact_constructions_kernel::Circle_2 Circle_2;
typedef typename Exact_predicates_inexact_constructions_kernel::Iso_rectangle_2 Iso_rectangle_2;
typedef typename Exact_predicates_inexact_constructions_kernel::Line_3 Line_3;
typedef typename Exact_predicates_inexact_constructions_kernel::Plane_3 Plane_3;
typedef typename Exact_predicates_inexact_constructions_kernel::Triangle_3 Triangle_3;
typedef typename Exact_predicates_inexact_constructions_kernel::Tetrahedron_3 Tetrahedron_3;
typedef typename Exact_predicates_inexact_constructions_kernel::Ray_3 Ray_3;
typedef typename Exact_predicates_inexact_constructions_kernel::Point_3 Point_3;
typedef typename Exact_predicates_inexact_constructions_kernel::Direction_3 Direction_3;
typedef typename Exact_predicates_inexact_constructions_kernel::Vector_3 Vector_3;
typedef typename Exact_predicates_inexact_constructions_kernel::Segment_3 Segment_3;
typedef typename Exact_predicates_inexact_constructions_kernel::Weighted_point_3 Weighted_point_3;
typedef typename Exact_predicates_inexact_constructions_kernel::Sphere_3 Sphere_3;
typedef typename Exact_predicates_inexact_constructions_kernel::Circle_3 Circle_3;
typedef typename Exact_predicates_inexact_constructions_kernel::Iso_cuboid_3 Iso_cuboid_3;
public:
std::pair<double,bool> operator()(const typename IK::FT n) const
{
double d;
if(fit_in_double(n,d)){
return std::make_pair(d,true);
}
return std::make_pair(0,false);
}
std::pair<Bbox_2,bool> operator()(const Bbox_2 b) const
{
return std::make_pair(b,true);
}
std::pair<Bbox_3,bool> operator()(const Bbox_3 b) const
{
return std::make_pair(b,true);
}
std::pair<Point_2,bool> operator()(const typename IK::Point_2& p) const
{
double x, y;
if(fit_in_double(p.x(),x) && fit_in_double(p.y(),y)){
return std::make_pair(Point_2(x,y),true);
}
return std::make_pair(ORIGIN,false);
}
std::pair<Vector_2,bool> operator()(const typename IK::Vector_2& v) const
{
double x, y;
if(fit_in_double(v.x(),x) && fit_in_double(v.y(),y)){
return std::make_pair(Vector_2(x,y),true);
}
return std::make_pair(Vector_2(),false);
}
std::pair<Direction_2,bool> operator()(const typename IK::Direction_2& d) const
{
double x, y;
if(fit_in_double(d.dx(),x) && fit_in_double(d.dy(),y)){
return std::make_pair(Direction_2(x,y),true);
}
return std::make_pair(Direction_2(),false);
}
std::pair<Weighted_point_2,bool> operator()(const typename IK::Weighted_point_2& wp) const
{
std::pair<Point_2,bool> sp = operator()(wp.point());
std::pair<double,bool> w = operator()(wp.weight());
if(sp.second && w.second){
return std::make_pair(Weighted_point_2(sp.first,w.first),true);
}
return std::make_pair(Weighted_point_2(),false);
}
std::pair<Segment_2,bool> operator()(const typename IK::Segment_2& s) const
{
std::pair<Point_2,bool> sp = operator()(s.source());
if(! sp.second){
return std::make_pair(Segment_2(),false);
}
std::pair<Point_2,bool> tp = operator()(s.target());
if(! tp.second){
return std::make_pair(Segment_2(),false);
}
return std::make_pair(Segment_2(sp.first,tp.first), true);
}
std::pair<Line_2,bool> operator()(const typename IK::Line_2& li) const
{
std::pair<double,bool> a = operator()(li.a()), b = operator()(li.b()) , c = operator()(li.c());
if(a.second && b.second && c.second){
return std::make_pair(Line_2(a.first, b.first, c.first),true);
}
return std::make_pair(Line_2(), false);
}
std::pair<Ray_2,bool> operator()(const typename IK::Ray_2& r) const
{
std::pair<Point_2,bool> sp = operator()(r.source());
if(! sp.second){
return std::make_pair(Ray_2(),false);
}
std::pair<Point_2,bool> tp = operator()(r.second_point());
if(! tp.second){
return std::make_pair(Ray_2(),false);
}
return std::make_pair(Ray_2(sp.first,tp.first), true);
}
std::pair<Triangle_2,bool> operator()(const typename IK::Triangle_2& t) const
{
std::pair<Point_2,bool> v0 = operator()(t.vertex(0));
if(! v0.second){
return std::make_pair(Triangle_2(),false);
}
std::pair<Point_2,bool> v1 = operator()(t.vertex(1));
if(! v1.second){
return std::make_pair(Triangle_2(),false);
}
std::pair<Point_2,bool> v2 = operator()(t.vertex(2));
if(! v2.second){
return std::make_pair(Triangle_2(),false);
}
return std::make_pair(Triangle_2(v0.first,v1.first, v2.first), true);
}
std::pair<Circle_2,bool> operator()(const typename IK::Circle_2& ci) const
{
std::pair<Point_2,bool> c = operator()(ci.center());
std::pair<double, bool> sr = operator()(ci.squared_radius());
if(c.second && sr.second){
return std::make_pair(Circle_2(c.first, sr.first, ci.orientation()),true);
}
return std::make_pair(Circle_2(), false);
}
std::pair<Iso_rectangle_2,bool> operator()(const typename IK::Iso_rectangle_2& ir) const
{
std::pair<Point_2,bool> sp = operator()((ir.min)());
if(! sp.second){
return std::make_pair(Iso_rectangle_2(),false);
}
std::pair<Point_2,bool> tp = operator()((ir.max)());
if(! tp.second){
return std::make_pair(Iso_rectangle_2(),false);
}
return std::make_pair(Iso_rectangle_2(sp.first,tp.first), true);
}
std::pair<Line_3,bool> operator()(const typename IK::Line_3& li) const
{
std::pair<Point_3,bool> sp = operator()(li.point());
if(! sp.second){
return std::make_pair(Line_3(),false);
}
std::pair<Vector_3,bool> tp = operator()(li.to_vector());
if(! tp.second){
return std::make_pair(Line_3(),false);
}
return std::make_pair(Line_3(sp.first,tp.first), true);
}
std::pair<Plane_3,bool> operator()(const typename IK::Plane_3& pl) const
{
std::pair<double,bool> a = operator()(pl.a()), b = operator()(pl.b()) , c = operator()(pl.c()) , d = operator()(pl.d());
if(a.second && b.second && c.second && d.second){
return std::make_pair(Plane_3(a.first, b.first, c.first, d.first),true);
}
return std::make_pair(Plane_3(), false);
}
std::pair<Triangle_3,bool> operator()(const typename IK::Triangle_3& t) const
{
std::pair<Point_3,bool> v0 = operator()(t.vertex(0));
if(! v0.second){
return std::make_pair(Triangle_3(),false);
}
std::pair<Point_3,bool> v1 = operator()(t.vertex(1));
if(! v1.second){
return std::make_pair(Triangle_3(),false);
}
std::pair<Point_3,bool> v2 = operator()(t.vertex(2));
if(! v2.second){
return std::make_pair(Triangle_3(),false);
}
return std::make_pair(Triangle_3(v0.first,v1.first, v2.first), true);
}
std::pair<Tetrahedron_3,bool> operator()(const typename IK::Tetrahedron_3& t) const
{
std::pair<Point_3,bool> v0 = operator()(t.vertex(0));
if(! v0.second){
return std::make_pair(Tetrahedron_3(),false);
}
std::pair<Point_3,bool> v1 = operator()(t.vertex(1));
if(! v1.second){
return std::make_pair(Tetrahedron_3(),false);
}
std::pair<Point_3,bool> v2 = operator()(t.vertex(2));
if(! v2.second){
return std::make_pair(Tetrahedron_3(),false);
}
std::pair<Point_3,bool> v3 = operator()(t.vertex(3));
if(! v3.second){
return std::make_pair(Tetrahedron_3(),false);
}
return std::make_pair(Tetrahedron_3(v0.first,v1.first, v2.first, v3.first), true);
}
std::pair<Ray_3,bool> operator()(const typename IK::Ray_3& r) const
{
std::pair<Point_3,bool> sp = operator()(r.source());
if(! sp.second){
return std::make_pair(Ray_3(),false);
}
std::pair<Point_3,bool> tp = operator()(r.second_point());
if(! tp.second){
return std::make_pair(Ray_3(),false);
}
return std::make_pair(Ray_3(sp.first,tp.first), true);
}
std::pair<Point_3,bool> operator()(const typename IK::Point_3& p) const
{
double x, y, z;
if(fit_in_double(p.x(),x) && fit_in_double(p.y(),y) && fit_in_double(p.z(),z)){
return std::make_pair(Point_3(x,y,z),true);
}
return std::make_pair(ORIGIN,false);
}
std::pair<Vector_3,bool> operator()(const typename IK::Vector_3& v) const
{
double x, y, z;
if(fit_in_double(v.x(),x) && fit_in_double(v.y(),y) && fit_in_double(v.z(),z)){
return std::make_pair(Vector_3(x,y,z),true);
}
return std::make_pair(Vector_3(),false);
}
std::pair<Direction_3,bool> operator()(const typename IK::Direction_3& d) const
{
double x, y, z;
if(fit_in_double(d.dx(),x) && fit_in_double(d.dy(),y) && fit_in_double(d.dz(),z)){
return std::make_pair(Direction_3(x,y,z),true);
}
return std::make_pair(Direction_3(),false);
}
std::pair<Segment_3,bool> operator()(const typename IK::Segment_3& s) const
{
std::pair<Point_3,bool> sp = operator()(s.source());
if(! sp.second){
return std::make_pair(Segment_3(),false);
}
std::pair<Point_3,bool> tp = operator()(s.target());
if(! tp.second){
return std::make_pair(Segment_3(),false);
}
return std::make_pair(Segment_3(sp.first,tp.first), true);
}
std::pair<Weighted_point_3,bool> operator()(const typename IK::Weighted_point_3& wp) const
{
std::pair<Point_3,bool> sp = operator()(wp.point());
std::pair<double,bool> w = operator()(wp.weight());
if(sp.second && w.second){
return std::make_pair(Weighted_point_3(sp.first,w.first),true);
}
return std::make_pair(Weighted_point_3(),false);
}
std::pair<Sphere_3,bool> operator()(const typename IK::Sphere_3& s) const
{
std::pair<Point_3,bool> c = operator()(s.center());
std::pair<double, bool> sr = operator()(s.squared_radius());
if(c.second && sr.second){
return std::make_pair(Sphere_3(c.first, sr.first, s.orientation()),true);
}
return std::make_pair(Sphere_3(), false);
}
std::pair<Circle_3,bool> operator()(const typename IK::Circle_3& ci) const
{
std::pair<Sphere_3, bool> sr = operator()(ci.diametral_sphere());
std::pair<Plane_3,bool> c = operator()(ci.supporting_plane());
if(c.second && sr.second){
return std::make_pair(Circle_3(sr.first, c.first),true);
}
return std::make_pair(Circle_3(), false);
}
std::pair<Iso_cuboid_3,bool> operator()(const typename IK::Iso_cuboid_3& ic) const
{
std::pair<Point_3,bool> sp = operator()((ic.min)());
if(! sp.second){
return std::make_pair(Iso_cuboid_3(),false);
}
std::pair<Point_3,bool> tp = operator()((ic.max)());
if(! tp.second){
return std::make_pair(Iso_cuboid_3(),false);
}
return std::make_pair(Iso_cuboid_3(sp.first,tp.first), true);
}
};
} // CGAL
#endif // CGAL_EPIC_CONVERTER_H

View File

@ -24,6 +24,7 @@
#include <CGAL/basic.h>
//#include <CGAL/Filtered_predicate.h>
#include <CGAL/Static_filtered_predicate.h>
#include <CGAL/Filtered_kernel.h>
#include <CGAL/Cartesian_converter.h>
#include <CGAL/Simple_cartesian.h>
@ -32,7 +33,8 @@
#include <CGAL/Filtered_kernel/Cartesian_coordinate_iterator_2.h>
#include <CGAL/Filtered_kernel/Cartesian_coordinate_iterator_3.h>
#include <CGAL/Lazy.h>
#include <CGAL/internal/Static_filters/tools.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <boost/none.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/or.hpp>
@ -110,6 +112,8 @@ public:
typedef E2A_ E2A;
typedef Kernel_ Kernel;
typedef Lazy_kernel_generic_base<EK_, AK_, E2A_, Kernel_> Self;
// synonym identical to Filtered_kernel
typedef AK_ FK;
@ -268,12 +272,16 @@ private:
public:
// We don't touch the predicates.
// FIXME TODO : better use a layer of Filtered_kernel on top of everything,
// so that semi-static filters are used as well (?).
#ifdef CGAL_NO_STATIC_FILTERS_FOR_LAZY_KERNEL
#define CGAL_Kernel_pred(P, Pf) \
typedef Filtered_predicate<typename Exact_kernel::P, typename Approximate_kernel::P, C2E, C2F> P; \
P Pf() const { return P(); }
#else
#define CGAL_Kernel_pred(P, Pf) \
typedef Static_filtered_predicate<Approximate_kernel, Filtered_predicate<typename Exact_kernel::P, typename Approximate_kernel::P, C2E, C2F>, Exact_predicates_inexact_constructions_kernel::P> P; \
P Pf() const { return P(); }
#endif
#define CGAL_Kernel_cons(C, Cf) \
typedef typename Select_wrapper<typename Approximate_kernel::C>::template apply<Kernel, typename Approximate_kernel::C, typename Exact_kernel::C>::type C; \
@ -282,6 +290,10 @@ public:
#include <CGAL/Kernel/interface_macros.h>
};
template < typename EK_, typename AK_, typename E2A_, typename Kernel_ >
class Lazy_kernel_base
: public Lazy_kernel_generic_base<EK_, AK_, E2A_, Kernel_>
@ -341,13 +353,6 @@ public:
{ return Compute_approximate_area_3(); }
}; // end class Lazy_kernel_base<EK_, AK_, E2A_, Kernel_2>
#ifndef CGAL_LAZY_KERNEL_USE_STATIC_FILTERS_BY_DEFAULT
# ifdef CGAL_NO_STATIC_FILTERS
# define CGAL_LAZY_KERNEL_USE_STATIC_FILTERS_BY_DEFAULT false
# else
# define CGAL_LAZY_KERNEL_USE_STATIC_FILTERS_BY_DEFAULT true
# endif
#endif
template <class Exact_kernel, class Approximate_kernel, class E2A>
struct Lazy_kernel_without_type_equality
@ -356,21 +361,11 @@ struct Lazy_kernel_without_type_equality
template <class Exact_kernel,
class Approximate_kernel = Simple_cartesian<Interval_nt_advanced>,
class E2A = Cartesian_converter<Exact_kernel, Approximate_kernel>,
bool UseStaticFilters = CGAL_LAZY_KERNEL_USE_STATIC_FILTERS_BY_DEFAULT >
class E2A = Cartesian_converter<Exact_kernel, Approximate_kernel> >
struct Lazy_kernel
: public Type_equality_wrapper<
Lazy_kernel_base< Exact_kernel, Approximate_kernel, E2A,
Lazy_kernel<Exact_kernel, Approximate_kernel, E2A, UseStaticFilters> >,
Lazy_kernel<Exact_kernel, Approximate_kernel, E2A, UseStaticFilters> >
{};
template <class Exact_kernel, class Approximate_kernel, class E2A>
struct Lazy_kernel<Exact_kernel, Approximate_kernel, E2A, true>
: public internal::Static_filters<
Type_equality_wrapper<
Lazy_kernel_base< Exact_kernel, Approximate_kernel, E2A, Lazy_kernel<Exact_kernel, Approximate_kernel, E2A, true> > ,
Lazy_kernel<Exact_kernel, Approximate_kernel, E2A, true> >, false >
Lazy_kernel_base< Exact_kernel, Approximate_kernel, E2A, Lazy_kernel<Exact_kernel, Approximate_kernel, E2A> >,
Lazy_kernel<Exact_kernel, Approximate_kernel, E2A> >
{
// WARNING: If you change the definition of Lazy_kernel, then you need to
// change also the definition of Epeck in

View File

@ -0,0 +1,329 @@
// Copyright (c) 2017 GeometryFactory
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0+
//
//
// Author(s) : Andreas Fabri, Laurent Rineau
#ifndef CGAL_STATIC_FILTERED_PREDICATE_H
#define CGAL_STATIC_FILTERED_PREDICATE_H
#include <CGAL/Epic_converter.h>
namespace CGAL {
template <typename AK, typename FP, typename EpicP>
class Static_filtered_predicate {
public:
FP fp;
EpicP epicp;
typedef typename AK::FT IA;
typedef typename FP::result_type result_type;
template <typename A1>
result_type operator()(const A1& a1) const
{
CGAL::Epic_converter<AK> convert;
typedef typename Kernel_traits<A1>::type EK;
typedef typename Type_mapper<A1,EK,Exact_predicates_inexact_constructions_kernel>::type T1;
std::pair<T1,bool> aa1 = convert(a1.approx());
if(! aa1.second){
return fp(a1);
}
return epicp(aa1.first);
}
template <typename A1>
result_type operator()(const A1& a1, const Null_vector& v) const
{
CGAL::Epic_converter<AK> convert;
typedef typename Kernel_traits<A1>::type EK;
typedef typename Type_mapper<A1,EK,Exact_predicates_inexact_constructions_kernel>::type T1;
std::pair<T1,bool> aa1 = convert(a1.approx());
if(! aa1.second){
return fp(a1, v);
}
return epicp(aa1.first, v);
}
template <typename A1, typename A2>
result_type operator()(const A1& a1, const A2& a2) const
{
CGAL::Epic_converter<AK> convert;
typedef typename Kernel_traits<A1>::type EK;
typedef typename Type_mapper<A1,EK, Exact_predicates_inexact_constructions_kernel>::type T1;
std::pair<T1,bool> aa1 = convert(approx(a1));
if(! aa1.second){
return fp(a1, a2);
}
typedef typename Type_mapper<A2,EK, Exact_predicates_inexact_constructions_kernel>::type T2;
std::pair<T2,bool> aa2 = convert(approx(a2));
if(! aa2.second){
return fp(a1, a2);
}
return epicp(aa1.first, aa2.first);
}
// We need these two specializations as in general we determine
// the kernel for the template argument A1, and this does not work for Bbox_2 and Bbox_3
template <typename A2>
result_type operator()(const Bbox_2& bb, const A2& a2) const
{
CGAL::Epic_converter<AK> convert;
typedef typename Kernel_traits<A2>::type EK;
typedef typename Type_mapper<A2,EK, Exact_predicates_inexact_constructions_kernel>::type T2;
std::pair<T2,bool> aa2 = convert(approx(a2));
if(! aa2.second){
return fp(bb, a2);
}
return epicp(bb, aa2.first);
}
template <typename A2>
result_type operator()(const Bbox_3& bb, const A2& a2) const
{
CGAL::Epic_converter<AK> convert;
typedef typename Kernel_traits<A2>::type EK;
typedef typename Type_mapper<A2,EK, Exact_predicates_inexact_constructions_kernel>::type T2;
std::pair<T2,bool> aa2 = convert(approx(a2));
if(! aa2.second){
return fp(bb, a2);
}
return epicp(bb, aa2.first);
}
template <typename A1, typename A2, typename A3>
result_type operator()(const A1& a1, const A2& a2, const A3& a3) const
{
CGAL::Epic_converter<AK> convert;
typedef typename Kernel_traits<A1>::type EK;
typedef typename Type_mapper<A1,EK, Exact_predicates_inexact_constructions_kernel>::type T1;
std::pair<T1,bool> aa1 = convert(a1.approx());
if(! aa1.second){
return fp(a1, a2, a3);
}
typedef typename Type_mapper<A2, EK, Exact_predicates_inexact_constructions_kernel>::type T2;
std::pair<T2,bool> aa2 = convert(a2.approx());
if(! aa2.second){
return fp(a1, a2, a3);
}
typedef typename Type_mapper<A3,EK, Exact_predicates_inexact_constructions_kernel>::type T3;
std::pair<T3,bool> aa3 = convert(a3.approx());
if(! aa3.second){
return fp(a1, a2, a3);
}
return epicp(aa1.first, aa2.first, aa3.first);
}
template <typename A1, typename A2, typename A3, typename A4>
result_type operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4) const
{
CGAL::Epic_converter<AK> convert;
typedef typename Kernel_traits<A1>::type EK;
typedef typename Type_mapper<A1,EK,Exact_predicates_inexact_constructions_kernel>::type T1;
std::pair<T1,bool> aa1 = convert(a1.approx());
if(! aa1.second){
return fp(a1, a2, a3, a4);
}
typedef typename Type_mapper<A2,EK,Exact_predicates_inexact_constructions_kernel>::type T2;
std::pair<T2,bool> aa2 = convert(a2.approx());
if(! aa2.second){
return fp(a1, a2, a3, a4);
}
typedef typename Type_mapper<A3,EK,Exact_predicates_inexact_constructions_kernel>::type T3;
std::pair<T3,bool> aa3 = convert(a3.approx());
if(! aa3.second){
return fp(a1, a2, a3, a4);
}
typedef typename Type_mapper<A4,EK,Exact_predicates_inexact_constructions_kernel>::type T4;
std::pair<T4,bool> aa4 = convert(a4.approx());
if(! aa4.second){
return fp(a1, a2, a3, a4);
}
return epicp(aa1.first, aa2.first, aa3.first, aa4.first);
}
template <typename A1, typename A2, typename A3, typename A4, typename A5>
result_type operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5) const
{
CGAL::Epic_converter<AK> convert;
typedef typename Kernel_traits<A1>::type EK;
typedef typename Type_mapper<A1,EK,Exact_predicates_inexact_constructions_kernel>::type T1;
std::pair<T1,bool> aa1 = convert(a1.approx());
if(! aa1.second){
return fp(a1, a2, a3, a4, a5);
}
typedef typename Type_mapper<A2,EK,Exact_predicates_inexact_constructions_kernel>::type T2;
std::pair<T2,bool> aa2 = convert(a2.approx());
if(! aa2.second){
return fp(a1, a2, a3, a4, a5);
}
typedef typename Type_mapper<A3,EK,Exact_predicates_inexact_constructions_kernel>::type T3;
std::pair<T3,bool> aa3 = convert(a3.approx());
if(! aa3.second){
return fp(a1, a2, a3, a4, a5);
}
typedef typename Type_mapper<A4,EK,Exact_predicates_inexact_constructions_kernel>::type T4;
std::pair<T4,bool> aa4 = convert(a4.approx());
if(! aa4.second){
return fp(a1, a2, a3, a4, a5);
}
typedef typename Type_mapper<A5,EK,Exact_predicates_inexact_constructions_kernel>::type T5;
std::pair<T5,bool> aa5 = convert(a5.approx());
if(! aa5.second){
return fp(a1, a2, a3, a4, a5);
}
return epicp(aa1.first, aa2.first, aa3.first, aa4.first, aa5.first);
}
template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6>
result_type operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6) const
{
CGAL::Epic_converter<AK> convert;
typedef typename Kernel_traits<A1>::type EK;
typedef typename Type_mapper<A1,EK,Exact_predicates_inexact_constructions_kernel>::type T1;
std::pair<T1,bool> aa1 = convert(a1.approx());
if(! aa1.second){
return fp(a1, a2, a3, a4, a5, a6);
}
typedef typename Type_mapper<A2,EK,Exact_predicates_inexact_constructions_kernel>::type T2;
std::pair<T2,bool> aa2 = convert(a2.approx());
if(! aa2.second){
return fp(a1, a2, a3, a4, a5, a6);
}
typedef typename Type_mapper<A3,EK,Exact_predicates_inexact_constructions_kernel>::type T3;
std::pair<T3,bool> aa3 = convert(a3.approx());
if(! aa3.second){
return fp(a1, a2, a3, a4, a5, a6);
}
typedef typename Type_mapper<A4,EK,Exact_predicates_inexact_constructions_kernel>::type T4;
std::pair<T4,bool> aa4 = convert(a4.approx());
if(! aa4.second){
return fp(a1, a2, a3, a4, a5, a6);
}
typedef typename Type_mapper<A5,EK,Exact_predicates_inexact_constructions_kernel>::type T5;
std::pair<T5,bool> aa5 = convert(a5.approx());
if(! aa5.second){
return fp(a1, a2, a3, a4, a5, a6);
}
typedef typename Type_mapper<A6,EK,Exact_predicates_inexact_constructions_kernel>::type T6;
std::pair<T6,bool> aa6 = convert(a6.approx());
if(! aa6.second){
return fp(a1, a2, a3, a4, a5, a6);
}
return epicp(aa1.first, aa2.first, aa3.first, aa4.first, aa5.first, aa6.first);
}
template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7>
result_type operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A6& a7) const
{
CGAL::Epic_converter<AK> convert;
typedef typename Kernel_traits<A1>::type EK;
typedef typename Type_mapper<A1,EK,Exact_predicates_inexact_constructions_kernel>::type T1;
std::pair<T1,bool> aa1 = convert(a1.approx());
if(! aa1.second){
return fp(a1, a2, a3, a4, a5, a6, a7);
}
typedef typename Type_mapper<A2,EK,Exact_predicates_inexact_constructions_kernel>::type T2;
std::pair<T2,bool> aa2 = convert(a2.approx());
if(! aa2.second){
return fp(a1, a2, a3, a4, a5, a6, a7);
}
typedef typename Type_mapper<A3,EK,Exact_predicates_inexact_constructions_kernel>::type T3;
std::pair<T3,bool> aa3 = convert(a3.approx());
if(! aa3.second){
return fp(a1, a2, a3, a4, a5, a6, a7);
}
typedef typename Type_mapper<A4,EK,Exact_predicates_inexact_constructions_kernel>::type T4;
std::pair<T4,bool> aa4 = convert(a4.approx());
if(! aa4.second){
return fp(a1, a2, a3, a4, a5, a6, a7);
}
typedef typename Type_mapper<A5,EK,Exact_predicates_inexact_constructions_kernel>::type T5;
std::pair<T5,bool> aa5 = convert(a5.approx());
if(! aa5.second){
return fp(a1, a2, a3, a4, a5, a6, a7);
}
typedef typename Type_mapper<A6,EK,Exact_predicates_inexact_constructions_kernel>::type T6;
std::pair<T6,bool> aa6 = convert(a6.approx());
if(! aa6.second){
return fp(a1, a2, a3, a4, a5, a6, a7);
}
typedef typename Type_mapper<A7,EK,Exact_predicates_inexact_constructions_kernel>::type T7;
std::pair<T7,bool> aa7 = convert(a7.approx());
if(! aa7.second){
return fp(a1, a2, a3, a4, a5, a6, a7);
}
return epicp(aa1.first, aa2.first, aa3.first, aa4.first, aa5.first, aa6.first, aa7.first);
}
template <typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8>
result_type operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, const A5& a5, const A6& a6, const A7& a7, const A8& a8) const
{
CGAL::Epic_converter<AK> convert;
typedef typename Kernel_traits<A1>::type EK;
typedef typename Type_mapper<A1,EK,Exact_predicates_inexact_constructions_kernel>::type T1;
std::pair<T1,bool> aa1 = convert(a1.approx());
if(! aa1.second){
return fp(a1, a2, a3, a4, a5, a6, a7, a8);
}
typedef typename Type_mapper<A2,EK,Exact_predicates_inexact_constructions_kernel>::type T2;
std::pair<T2,bool> aa2 = convert(a2.approx());
if(! aa2.second){
return fp(a1, a2, a3, a4, a5, a6, a7, a8);
}
typedef typename Type_mapper<A3,EK,Exact_predicates_inexact_constructions_kernel>::type T3;
std::pair<T3,bool> aa3 = convert(a3.approx());
if(! aa3.second){
return fp(a1, a2, a3, a4, a5, a6, a7, a8);
}
typedef typename Type_mapper<A4,EK,Exact_predicates_inexact_constructions_kernel>::type T4;
std::pair<T4,bool> aa4 = convert(a4.approx());
if(! aa4.second){
return fp(a1, a2, a3, a4, a5, a6, a7, a8);
}
typedef typename Type_mapper<A5,EK,Exact_predicates_inexact_constructions_kernel>::type T5;
std::pair<T5,bool> aa5 = convert(a5.approx());
if(! aa5.second){
return fp(a1, a2, a3, a4, a5, a6, a7, a8);
}
typedef typename Type_mapper<A6,EK,Exact_predicates_inexact_constructions_kernel>::type T6;
std::pair<T6,bool> aa6 = convert(a6.approx());
if(! aa6.second){
return fp(a1, a2, a3, a5, a5, a6, a7, a8);
}
typedef typename Type_mapper<A7,EK,Exact_predicates_inexact_constructions_kernel>::type T7;
std::pair<T7,bool> aa7 = convert(a7.approx());
if(! aa7.second){
return fp(a1, a2, a3, a5, a5, a6, a7, a8);
}
typedef typename Type_mapper<A8,EK,Exact_predicates_inexact_constructions_kernel>::type T8;
std::pair<T8,bool> aa8 = convert(a8.approx());
if(! aa8.second){
return fp(a1, a2, a3, a4, a5, a6, a7, a8);
}
return epicp(aa1.first, aa2.first, aa3.first, aa4.first, aa5.first, aa6.first, aa7.first, aa8.first);
}
};
} // CGAL
#endif // CGAL_STATIC_FILTERED_PREDICATE_H

View File

@ -25,7 +25,6 @@
#include <CGAL/Profile_counter.h>
#include <CGAL/internal/Static_filters/Static_filter_error.h>
#include <CGAL/internal/Static_filters/tools.h>
#include <cmath>
namespace CGAL { namespace internal { namespace Static_filters_predicates {
@ -60,23 +59,18 @@ namespace CGAL { namespace internal { namespace Static_filters_predicates {
) const {
CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Compare_squared_radius_3 with 4 points", tmp);
Get_approx<Point_3> get_approx; // Identity functor for all points
// but lazy ones.
Get_approx<FT> get_approx_ft; // Identity functor for all FT
// but Lazy ones.
double px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz, alpha;
init_double(px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz, alpha, (FT*)(0));
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) &&
fit_in_double(get_approx(q).x(), qx) && fit_in_double(get_approx(q).y(), qy) &&
fit_in_double(get_approx(q).z(), qz) &&
fit_in_double(get_approx(r).x(), rx) && fit_in_double(get_approx(r).y(), ry) &&
fit_in_double(get_approx(r).z(), rz) &&
fit_in_double(get_approx(s).x(), sx) && fit_in_double(get_approx(s).y(), sy) &&
fit_in_double(get_approx(s).z(), sz) &&
fit_in_double(get_approx_ft(w), alpha)
if( fit_in_double(p.x(), px) && fit_in_double(p.y(), py) &&
fit_in_double(p.z(), pz) &&
fit_in_double(q.x(), qx) && fit_in_double(q.y(), qy) &&
fit_in_double(q.z(), qz) &&
fit_in_double(r.x(), rx) && fit_in_double(r.y(), ry) &&
fit_in_double(r.z(), rz) &&
fit_in_double(s.x(), sx) && fit_in_double(s.y(), sy) &&
fit_in_double(s.z(), sz) &&
fit_in_double(w, alpha)
)
{
CGAL_BRANCH_PROFILER_BRANCH_1(tmp);

View File

@ -0,0 +1,91 @@
// Copyright (c) 2008 ETH Zurich (Switzerland)
// Copyright (c) 2008-2009 INRIA Sophia-Antipolis (France)
// Copyright (c) 2017 GeometryFactory Sarl (France)
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0+
//
//
// Author(s) : Andreas Fabri, Laurent Rineau
#ifndef CGAL_INTERNAL_STATIC_FILTERS_DO_INTERSECT_2_H
#define CGAL_INTERNAL_STATIC_FILTERS_DO_INTERSECT_2_H
#include <iostream>
namespace CGAL {
namespace internal {
namespace Static_filters_predicates {
template < typename K_base, typename SFK >
class Do_intersect_2
: public K_base::Do_intersect_2
{
typedef typename K_base::Point_2 Point_2;
typedef typename K_base::Segment_2 Segment_2;
typedef typename K_base::Do_intersect_2 Base;
typedef K_base TA1;
typedef SFK TA2;
public:
typedef typename Base::result_type result_type;
#ifndef CGAL_CFG_MATCHING_BUG_6
using Base::operator();
#else // CGAL_CFG_MATCHING_BUG_6
template <typename T1, typename T2>
result_type
operator()(const T1& t1, const T2& t2) const
{
return Base()(t1,t2);
}
#endif // CGAL_CFG_MATCHING_BUG_6
// The internal::do_intersect(..) function
// only performs orientation tests on the vertices
// of the segment
// By calling the do_intersect function with
// the statically filtered kernel we avoid
// that doubles are put into Interval_nt
// to get taken out again with fit_in_double
result_type
operator()(const Segment_2 &s, const Segment_2& t) const
{
return internal::do_intersect(s,t, SFK());
}
result_type
operator()(const Point_2 &p, const Segment_2& t) const
{
return internal::do_intersect(p,t, SFK());
}
result_type
operator()(const Segment_2& t, const Point_2 &p) const
{
return internal::do_intersect(p,t, SFK());
}
};
} // Static_filters_predicates
} // internal
} // CGAL
#endif

View File

@ -84,7 +84,7 @@ public:
// of the triangle and the segment
// By calling the do_intersect function with
// the statically filtered kernel we avoid
// that doubles are put into Inteval_nt
// that doubles are put into Interval_nt
// to get taken out again with fit_in_double
result_type
operator()(const Segment_3 &s, const Triangle_3& t) const

View File

@ -66,11 +66,10 @@ public:
CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Orientation_2", tmp);
double px, py, qx, qy, rx, ry;
Get_approx<Point_2> get_approx;
if (fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(p).y(), py) &&
fit_in_double(get_approx(q).x(), qx) && fit_in_double(get_approx(q).y(), qy) &&
fit_in_double(get_approx(r).x(), rx) && fit_in_double(get_approx(r).y(), ry))
if (fit_in_double(p.x(), px) && fit_in_double(p.y(), py) &&
fit_in_double(q.x(), qx) && fit_in_double(q.y(), qy) &&
fit_in_double(r.x(), rx) && fit_in_double(r.y(), ry))
{
CGAL_BRANCH_PROFILER_BRANCH_1(tmp);

View File

@ -24,7 +24,6 @@
#include <CGAL/Profile_counter.h>
#include <CGAL/internal/Static_filters/Static_filter_error.h>
#include <CGAL/internal/Static_filters/tools.h>
#include <cmath>
namespace CGAL { namespace internal { namespace Static_filters_predicates {
@ -74,19 +73,16 @@ public:
{
CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Orientation_3", tmp);
Get_approx<Point_3> get_approx; // Identity functor for all points
// but lazy points.
double px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz;
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) &&
fit_in_double(get_approx(q).x(), qx) && fit_in_double(get_approx(q).y(), qy) &&
fit_in_double(get_approx(q).z(), qz) &&
fit_in_double(get_approx(r).x(), rx) && fit_in_double(get_approx(r).y(), ry) &&
fit_in_double(get_approx(r).z(), rz) &&
fit_in_double(get_approx(s).x(), sx) && fit_in_double(get_approx(s).y(), sy) &&
fit_in_double(get_approx(s).z(), sz))
if (fit_in_double(p.x(), px) && fit_in_double(p.y(), py) &&
fit_in_double(p.z(), pz) &&
fit_in_double(q.x(), qx) && fit_in_double(q.y(), qy) &&
fit_in_double(q.z(), qz) &&
fit_in_double(r.x(), rx) && fit_in_double(r.y(), ry) &&
fit_in_double(r.z(), rz) &&
fit_in_double(s.x(), sx) && fit_in_double(s.y(), sy) &&
fit_in_double(s.z(), sz))
{
CGAL_BRANCH_PROFILER_BRANCH_1(tmp);

View File

@ -42,15 +42,12 @@ public:
{
CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Side_of_oriented_circle_2", tmp);
Get_approx<Point_2> get_approx; // Identity functor for all points
// but lazy points.
double px, py, qx, qy, rx, ry, tx, ty;
if (fit_in_double(get_approx(p).x(), px) && fit_in_double(get_approx(p).y(), py) &&
fit_in_double(get_approx(q).x(), qx) && fit_in_double(get_approx(q).y(), qy) &&
fit_in_double(get_approx(r).x(), rx) && fit_in_double(get_approx(r).y(), ry) &&
fit_in_double(get_approx(t).x(), tx) && fit_in_double(get_approx(t).y(), ty))
if (fit_in_double(p.x(), px) && fit_in_double(p.y(), py) &&
fit_in_double(q.x(), qx) && fit_in_double(q.y(), qy) &&
fit_in_double(r.x(), rx) && fit_in_double(r.y(), ry) &&
fit_in_double(t.x(), tx) && fit_in_double(t.y(), ty))
{
CGAL_BRANCH_PROFILER_BRANCH_1(tmp);

View File

@ -24,7 +24,6 @@
#include <CGAL/Profile_counter.h>
#include <CGAL/internal/Static_filters/Static_filter_error.h>
#include <CGAL/internal/Static_filters/tools.h>
namespace CGAL { namespace internal { namespace Static_filters_predicates {
@ -43,21 +42,18 @@ public:
{
CGAL_BRANCH_PROFILER_3("semi-static failures/attempts/calls to : Side_of_oriented_sphere_3", tmp);
Get_approx<Point_3> get_approx; // Identity functor for all points
// but lazy points.
double px, py, pz, qx, qy, qz, rx, ry, rz, sx, sy, sz, tx, ty, tz;
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) &&
fit_in_double(get_approx(q).x(), qx) && fit_in_double(get_approx(q).y(), qy) &&
fit_in_double(get_approx(q).z(), qz) &&
fit_in_double(get_approx(r).x(), rx) && fit_in_double(get_approx(r).y(), ry) &&
fit_in_double(get_approx(r).z(), rz) &&
fit_in_double(get_approx(s).x(), sx) && fit_in_double(get_approx(s).y(), sy) &&
fit_in_double(get_approx(s).z(), sz) &&
fit_in_double(get_approx(t).x(), tx) && fit_in_double(get_approx(t).y(), ty) &&
fit_in_double(get_approx(t).z(), tz))
if (fit_in_double(p.x(), px) && fit_in_double(p.y(), py) &&
fit_in_double(p.z(), pz) &&
fit_in_double(q.x(), qx) && fit_in_double(q.y(), qy) &&
fit_in_double(q.z(), qz) &&
fit_in_double(r.x(), rx) && fit_in_double(r.y(), ry) &&
fit_in_double(r.z(), rz) &&
fit_in_double(s.x(), sx) && fit_in_double(s.y(), sy) &&
fit_in_double(s.z(), sz) &&
fit_in_double(t.x(), tx) && fit_in_double(t.y(), ty) &&
fit_in_double(t.z(), tz))
{
CGAL_BRANCH_PROFILER_BRANCH_1(tmp);

View File

@ -46,7 +46,8 @@
# define CGAL_NO_COMPARE_X_2_STATIC_FILTERS 1
# define CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS 1
# define CGAL_NO_ANGLE_3_STATIC_FILTERS 1
# define CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS 1
# define CGAL_NO_DO_INTERSECT_STATIC_FILTERS 1
#endif // CGAL_DISABLE_STATIC_FILTERS_ADDED_2011
@ -68,9 +69,10 @@
# include <CGAL/internal/Static_filters/Angle_3.h>
#endif // NOT CGAL_NO_ANGLE_3_STATIC_FILTERS
#ifndef CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
#ifndef CGAL_NO_DO_INTERSECT_STATIC_FILTERS
# include <CGAL/internal/Static_filters/Do_intersect_3.h>
#endif // NOT NOT CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
# include <CGAL/internal/Static_filters/Do_intersect_2.h>
#endif // NOT NOT CGAL_NO_DO_INTERSECT_STATIC_FILTERS
#include <CGAL/internal/Static_filters/Compare_y_at_x_2.h>
#include <CGAL/internal/Static_filters/Side_of_oriented_circle_2.h>
@ -95,28 +97,13 @@
// compiler. g++ 4.0 should be able to cprop the second part...
// Note about the second parameter of Static_filters<K,bool>:
// - if the access to Cartesian exact coordinates is cheap
// (Simple_cartesian, Cartesian), then one can implement predicates that
// just compare coordinates without filtering, using unfiltered
// predicates defined in the namespace CartesianKernelFunctors.
//
// - in the case of Lazy_kernel, where the access to p.x(), for a point p,
// triggers the construction of a Lazy_exact_nt object, one does not want
// to use the functors from the namespace CartesianKernelFunctors.
namespace CGAL { namespace internal {
// Here is the case when has_cheap_access_to_cartesian_coordinates is
// false, used by Lazy_kernel
// The K_base argument is supposed to provide exact primitives.
template < typename K_base,
bool has_cheap_access_to_cartesian_coordinates = true>
class Static_filters : public K_base {
typedef Static_filters<K_base,
has_cheap_access_to_cartesian_coordinates> Self;
template < typename K_base >
class Static_filters : public K_base
{
typedef Static_filters<K_base> Self;
public:
#ifndef CGAL_NO_EQUAL_3_STATIC_FILTERS
@ -140,9 +127,6 @@ public:
typedef Static_filters_predicates::Angle_3<K_base> Angle_3;
#endif // NOT CGAL_NO_ANGLE_3_STATIC_FILTERS
#ifndef CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
typedef Static_filters_predicates::Do_intersect_3<K_base,Self> Do_intersect_3;
#endif // NOT CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
typedef Static_filters_predicates::Side_of_oriented_circle_2<K_base> Side_of_oriented_circle_2;
typedef Static_filters_predicates::Side_of_oriented_sphere_3<K_base> Side_of_oriented_sphere_3;
typedef Static_filters_predicates::Compare_squared_radius_3<K_base> Compare_squared_radius_3;
@ -180,6 +164,7 @@ public:
Compare_y_2
compare_y_2_object() const
{ return Compare_y_2(); }
#endif // NOT CGAL_NO_COMPARE_Y_2_STATIC_FILTERS
#ifndef CGAL_NO_IS_DEGENERATE_3_STATIC_FILTERS
@ -194,12 +179,6 @@ Compare_y_2
{ return Angle_3(); }
#endif // NOT CGAL_NO_ANGLE_3_STATIC_FILTERS
#ifndef CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
Do_intersect_3
do_intersect_3_object() const
{ return Do_intersect_3(); }
#endif // NOT CGAL_NO_DO_INTERSECT_3_STATIC_FILTERS
Side_of_oriented_circle_2
side_of_oriented_circle_2_object() const
{ return Side_of_oriented_circle_2(); }
@ -221,20 +200,8 @@ Compare_y_2
enum { Has_static_filters = true };
}; // end of class template Static_filters<K_base, false>
// Here is the case when has_cheap_access_to_cartesian_coordinates is true,
// the default, used by Filtered_kernel<CK>.
// The K_base argument is supposed to provide exact primitives.
template < typename K_base>
class Static_filters<K_base, true> // has_cheap_access_to_cartesian_coordinates==true
: public Static_filters<K_base, false>
{
typedef Static_filters<K_base, true> Self;
public:
typedef Static_filters_predicates::Compare_y_at_x_2<K_base,Self> Compare_y_at_x_2;
// The following do not require filtering as they only do
@ -262,6 +229,11 @@ public:
typedef CartesianKernelFunctors::Compare_xy_3<Self> Compare_xy_3;
typedef CartesianKernelFunctors::Compare_xyz_3<Self> Compare_xyz_3;
#ifndef CGAL_NO_DO_INTERSECT_STATIC_FILTERS
typedef Static_filters_predicates::Do_intersect_2<K_base,Self> Do_intersect_2;
typedef Static_filters_predicates::Do_intersect_3<K_base,Self> Do_intersect_3;
#endif // NOT CGAL_NO_DO_INTERSECT_STATIC_FILTERS
Compare_xy_2
compare_xy_2_object() const
{ return Compare_xy_2(); }
@ -330,6 +302,17 @@ public:
compare_y_at_x_2_object() const
{ return Compare_y_at_x_2(); }
#ifndef CGAL_NO_DO_INTERSECT_STATIC_FILTERS
Do_intersect_3
do_intersect_3_object() const
{ return Do_intersect_3(); }
Do_intersect_2
do_intersect_2_object() const
{ return Do_intersect_2(); }
#endif // NOT CGAL_NO_DO_INTERSECT_STATIC_FILTERS
// The two following are for degenerate cases, so I'll update them later.
//
// typedef Static_filters_predicates::Coplanar_orientation_3<Point_3, Orientation_2>

View File

@ -60,20 +60,6 @@ class Epeck
#else // no CGAL_DONT_USE_LAZY_KERNEL
// Equivalent to Lazy_kernel<Simple_cartesian<Epeck_ft> >
#ifdef CGAL_LAZY_KERNEL_USE_STATIC_FILTERS_BY_DEFAULT
class Epeck
: public internal::Static_filters<
Type_equality_wrapper<
Lazy_kernel_base< Simple_cartesian<Epeck_ft>,
Simple_cartesian<Interval_nt_advanced>,
Cartesian_converter< Simple_cartesian<Epeck_ft>,
Simple_cartesian<Interval_nt_advanced> >,
Epeck>,
Epeck >, false>
{};
#else // no CGAL_LAZY_KERNEL_USE_STATIC_FILTERS_BY_DEFAULT
class Epeck
: public Type_equality_wrapper<
Lazy_kernel_base< Simple_cartesian<Epeck_ft>,
@ -83,7 +69,6 @@ class Epeck
Epeck>,
Epeck >
{};
#endif // no CGAL_LAZY_KERNEL_USE_STATIC_FILTERS_BY_DEFAULT
#endif // no CGAL_DONT_USE_LAZY_KERNEL

View File

@ -103,6 +103,10 @@ BOOST_PP_REPEAT_FROM_TO(1, 10, CGAL_VARIANT_TYPEMAP, _)
#include <CGAL/Kernel/interface_macros.h>
template < typename K1, typename K2 >
struct Type_mapper_impl < typename K1::FT, K1, K2 >
{ typedef typename K2::FT type; };
} // internal
// This is a tool to obtain the K2::Point_2 from K1 and K1::Point_2.

View File

@ -72,7 +72,8 @@ between $p$ and $q$. If $p$ and $q$ are antipodal of each other then we
create any great circle that contains $p$ and $q$.}*/
{ Point_3 p1(0,0,0), p4 = CGAL::ORIGIN + ((Base*) this)->orthogonal_vector();
if ( p != q.antipode() ) {
if (R_().orientation_3_object()(p1,p,q,p4) != CGAL::POSITIVE )
if (R_().orientation_3_object()(p1,Point_3(p),
Point_3(q), p4) != CGAL::POSITIVE )
*this = Self(opposite());
} else {
/* previous method was: *this = Self(Plane_3(p1,q-p));

View File

@ -194,13 +194,18 @@ void split_halfcircle(Sphere_segment<R>& s1,
bool is_short() const
/*{\Mop a segment is short iff it is shorter than a halfcircle.}*/
{
return R().orientation_3_object()(Point_3(0,0,0), source(), target(),
CGAL::ORIGIN + this->ptr()->c_.orthogonal_vector())
return R().orientation_3_object()(Point_3(0,0,0),
Point_3(source()),
Point_3(target()),
CGAL::ORIGIN +
this->ptr()->c_.orthogonal_vector())
== CGAL::POSITIVE; }
bool is_long() const
/*{\Mop a segment is long iff it is longer than a halfcircle.}*/
{ return R().orientation_3_object()(Point_3(0,0,0), source(), target(),
{ return R().orientation_3_object()(Point_3(0,0,0),
Point_3(source()),
Point_3(target()),
CGAL::ORIGIN + this->ptr()->c_.orthogonal_vector())
== CGAL::NEGATIVE; }

View File

@ -62,19 +62,19 @@ class Indirect_edge_compare
ForwardCirculator edge_vtx_2 = edge_vtx_1;
edge_vtx_2++;
// check for horizontal edge
if (_compare_y_2((*edge_vtx_1), (*edge_vtx_2)) == EQUAL)
if(_compare_y_2(Point_2(*edge_vtx_1), Point_2(*edge_vtx_2)) == EQUAL)
{
// compare the smaller x and vertex x
if (_compare_x_2(*edge_vtx_1, *edge_vtx_2) == SMALLER)
return _compare_x_2(*edge_vtx_1, *vertex) == LARGER;
if(_compare_x_2(Point_2(*edge_vtx_1), Point_2(*edge_vtx_2)) == SMALLER)
return _compare_x_2(Point_2(*edge_vtx_1), Point_2(*vertex)) == LARGER;
else
return _compare_x_2(*edge_vtx_2, *vertex) == LARGER;
return _compare_x_2(Point_2(*edge_vtx_2), Point_2(*vertex)) == LARGER;
}
else
{
// construct supporting line for edge
Line_2 line = _construct_line_2(*edge_vtx_1, *edge_vtx_2);
return _compare_x_at_y_2(*vertex, line) == SMALLER;
return _compare_x_at_y_2(Point_2(*vertex), line) == SMALLER;
}
}
@ -111,11 +111,11 @@ class Indirect_edge_compare
{
Point_2 p_max;
Point_2 q_max;
if (_compare_x_2(*p, *after_p) == SMALLER)
if (_compare_x_2(Point_2(*p), Point_2(*after_p)) == SMALLER)
p_max = *after_p;
else
p_max = *p;
if (_compare_x_2(*q, *after_q) == SMALLER)
if (_compare_x_2(Point_2(*q), Point_2(*after_q)) == SMALLER)
q_max = *after_q;
else
q_max = *q;
@ -123,12 +123,12 @@ class Indirect_edge_compare
}
else // p and after_p must both be on same side of l_q
{
return (_compare_x_at_y_2(*p, l_q) == LARGER);
return (_compare_x_at_y_2(Point_2(*p), l_q) == LARGER);
}
}
bool q_larger_x = _compare_x_at_y_2(*q, l_p) == SMALLER;
bool after_q_larger_x = _compare_x_at_y_2(*after_q, l_p) == SMALLER;
bool q_larger_x =_compare_x_at_y_2(Point_2(*q), l_p) == SMALLER;
bool after_q_larger_x = _compare_x_at_y_2(Point_2(*after_q), l_p) == SMALLER;
if (q_larger_x == after_q_larger_x)
return q_larger_x;
@ -137,9 +137,9 @@ class Indirect_edge_compare
Line_2 l_q = _construct_line_2(*q, *after_q);
if (_is_horizontal_2(l_q)) // p is not horizontal
{
return _compare_x_at_y_2((*q), l_p) == LARGER;
return _compare_x_at_y_2(Point_2(*q), l_p) == LARGER;
}
return _compare_x_at_y_2((*p), l_q) != SMALLER;
return _compare_x_at_y_2(Point_2(*p), l_q) != SMALLER;
}
private:

View File

@ -30,7 +30,8 @@ namespace CGAL {
template <class Traits>
class Indirect_not_less_yx_2
{
public:
public:
typedef typename Traits::Point_2 Point_2;
typedef typename Traits::Less_yx_2 Less_yx_2;
Indirect_not_less_yx_2(const Traits& traits) :
@ -39,7 +40,7 @@ class Indirect_not_less_yx_2
template <class Iterator>
bool
operator()( const Iterator& p, const Iterator& q) const
{ return less_yx_2( *q, *p); }
{ return less_yx_2( Point_2(*q), Point_2(*p)); }
private:
Less_yx_2 less_yx_2;

View File

@ -68,7 +68,8 @@ public:
_validity = PARTITION_OPT_CVX_NOT_VALID;
Turn_reverser<Point_2_, Left_turn_2> right_turn(left_turn);
Turn_reverser<typename Traits::Point_2,
Left_turn_2> right_turn(left_turn);
if (right_turn(p1, p2, p3))
_validity = PARTITION_OPT_CVX_START_VALID;
if (right_turn(p4, p5, p6)) {

View File

@ -48,15 +48,15 @@ public:
_vertex(vertex),
_prev_v_ref(prev_ref)
{
_vertex_orientation = _orientation(*_prev_v_ref, vertex, *next_ref);
_vertex_orientation = _orientation(Point_2(*_prev_v_ref), Point_2(vertex), Point_2(*next_ref));
}
bool
operator()(Iterator d1, Iterator d2)
{
Orientation d1_orientation = _orientation(*_prev_v_ref, _vertex, *d1);
Orientation d2_orientation = _orientation(*_prev_v_ref, _vertex, *d2);
Orientation d1_to_d2 = _orientation(*d1, _vertex, *d2);
Orientation d1_orientation = _orientation(Point_2(*_prev_v_ref), Point_2(_vertex), Point_2(*d1));
Orientation d2_orientation = _orientation(Point_2(*_prev_v_ref), Point_2(_vertex), Point_2(*d2));
Orientation d1_to_d2 = _orientation(Point_2(*d1), Point_2(_vertex), Point_2(*d2));
// if both diagonals are on the same side of the line from previous
// vertex to this vertex then d1 comes before d2 (in CW order from
@ -278,7 +278,7 @@ private:
next = *next_d_it;
// return _right_turn(*prev, *vertex_ref, *next);
return _left_turn(*vertex_ref, *prev, *next);
return _left_turn(Point_2(*vertex_ref), Point_2(*prev), Point_2(*next));
}
bool diagonal_is_necessary(Circulator diag_ref1, Circulator diag_ref2)

View File

@ -56,6 +56,18 @@ public:
using internal::vector< Rotation_tree_node_2<Traits_> >::push_back;
class Greater {
typename Traits::Less_xy_2 less;
typedef typename Traits::Point_2 Point;
public:
Greater(typename Traits::Less_xy_2 less) : less(less) {}
template <typename Point_like>
bool operator()(const Point_like& p1, const Point_like& p2) {
return less(Point(p2), Point(p1));
}
};
// constructor
template<class ForwardIterator>
Rotation_tree_2(ForwardIterator first, ForwardIterator beyond)
@ -63,8 +75,8 @@ public:
for (ForwardIterator it = first; it != beyond; it++)
push_back(*it);
std::sort(this->begin(), this->end(),
boost::bind(Traits().less_xy_2_object(), _2, _1));
Greater greater (Traits().less_xy_2_object());
std::sort(this->begin(), this->end(), greater);
std::unique(this->begin(), this->end());
// front() is the point with the largest x coordinate
@ -167,3 +179,8 @@ private:
#include <CGAL/Partition_2/Rotation_tree_2_impl.h>
#endif // CGAL_ROTATION_TREE_H
// For the Emacs editor:
// Local Variables:
// c-basic-offset: 3
// End:

View File

@ -58,9 +58,11 @@ private:
Circulator _p0, _p1, _p2;
};
template <class Compare_x_2>
template <class Traits>
class Indirect_compare_x_2
{
typedef typename Traits::Compare_x_2 Compare_x_2;
typedef typename Traits::Point_2 Point;
public:
Indirect_compare_x_2(const Compare_x_2& compare_x_2)
: _compare_x_2(compare_x_2)
@ -69,16 +71,18 @@ public:
template <class Point_2_ptr>
Comparison_result operator()(Point_2_ptr p1, Point_2_ptr p2)
{
return _compare_x_2(*p1, *p2);
return _compare_x_2(Point(*p1), Point(*p2));
}
private:
Compare_x_2 _compare_x_2;
};
template <class Compare_y_2>
template <class Traits>
class Indirect_compare_y_2
{
typedef typename Traits::Compare_y_2 Compare_y_2;
typedef typename Traits::Point_2 Point;
public:
Indirect_compare_y_2(const Compare_y_2& compare_y_2)
: _compare_y_2(compare_y_2)
@ -87,16 +91,18 @@ public:
template <class Point_2_ptr>
Comparison_result operator()(Point_2_ptr p1, Point_2_ptr p2)
{
return _compare_y_2(*p1, *p2);
return _compare_y_2(Point(*p1), Point(*p2));
}
private:
Compare_y_2 _compare_y_2;
};
template <class Orientation_2>
template <class Traits>
class Indirect_orientation_2
{
typedef typename Traits::Orientation_2 Orientation_2;
typedef typename Traits::Point_2 Point;
public:
Indirect_orientation_2(const Orientation_2& orientation_2)
: _orientation_2(orientation_2)
@ -105,7 +111,7 @@ public:
template <class Point_2_ptr>
Orientation operator()(Point_2_ptr p1, Point_2_ptr p2, Point_2_ptr p3)
{
return _orientation_2(*p1, *p2, *p3);
return _orientation_2(Point(*p1), Point(*p2), Point(*p3));
}
private:
@ -140,9 +146,9 @@ public:
typedef Indirect_segment<Circulator> Segment_2;
typedef Indirect_triangle<Circulator> Triangle_2;
typedef Indirect_orientation_2<typename Traits::Orientation_2> Orientation_2;
typedef Indirect_compare_x_2<typename Traits::Compare_x_2> Compare_x_2;
typedef Indirect_compare_y_2<typename Traits::Compare_y_2> Compare_y_2;
typedef Indirect_orientation_2<Traits> Orientation_2;
typedef Indirect_compare_x_2<Traits> Compare_x_2;
typedef Indirect_compare_y_2<Traits> Compare_y_2;
typedef Construct_indirect_segment_2<Circulator> Construct_segment_2;
typedef Construct_circulator_2<Circulator> Construct_point_2;
@ -182,3 +188,8 @@ private:
}
#endif // CGAL_TRIANGULATION_INDIRECT_TRAITS_2_H
// For the Emacs editor
// Local Variables:
// c-basic-offset: 3
// End:

View File

@ -228,20 +228,21 @@ Vertex_visibility_graph_2<Traits>::left_turn_to_parent(
Tree_iterator q,
Tree& tree)
{
typedef typename Traits::Point_2 Point;
if (tree.parent_is_p_infinity(q))
{
return (less_xy_2(*p, *q));
return (less_xy_2(Point(*p), Point(*q)));
}
else if (orientation_2(*p, *q, *(*q).parent()) == COLLINEAR &&
(collinear_ordered_2(*p, *q, *(*q).parent()) ||
collinear_ordered_2(*p, *q, *(*q).parent())))
else if (orientation_2(Point(*p), Point(*q), Point(*q->parent())) == COLLINEAR &&
(collinear_ordered_2(Point(*p), Point(*q), Point(*q->parent())) ||
collinear_ordered_2(Point(*p), Point(*q), Point(*q->parent()))))
{
return true;
}
else
{
return left_turn_2(*p, *q, *(*q).parent());
return left_turn_2(Point(*p), Point(*q), Point(*q->parent()));
}
}

View File

@ -54,8 +54,9 @@ bool partition_appx_cvx_is_edge_through_interior(const Point_2& before_s,
{
// determine if the edge goes through the interior of the polygon or not
typedef typename Traits::Left_turn_2 Left_turn_2;
typedef typename Traits::Point_2 Bare_point_2;
Left_turn_2 left_turn = traits.left_turn_2_object();
Turn_reverser<Point_2, Left_turn_2> right_turn(left_turn);
Turn_reverser<Bare_point_2, Left_turn_2> right_turn(left_turn);
if (right_turn(before_s, source, after_s)) // concave angle
{
if (right_turn(before_s, source, target) &&

View File

@ -210,11 +210,13 @@ bool collinearly_visible(unsigned int edge_num1, unsigned int e_num,
const Traits& traits)
{
typedef typename Traits::Orientation_2 Orientation_2;
typedef typename Traits::Point_2 Point_2;
Orientation_2 orientation = traits.orientation_2_object();
if ((e_num == edge_num1+1 || e_num+1 == edge_num2) &&
edges[edge_num1][edge_num2].is_visible() &&
orientation(polygon[edge_num1], polygon[e_num], polygon[edge_num2]) ==
orientation(Point_2(polygon[edge_num1]), Point_2(polygon[e_num]),
Point_2(polygon[edge_num2])) ==
COLLINEAR)
return true;
else
@ -365,6 +367,7 @@ void make_collinear_vertices_visible(Polygon& polygon,
{
typedef typename Polygon::size_type size_type;
typedef typename Traits::Orientation_2 Orientation_2;
typedef typename Traits::Point_2 Point_2;
Orientation_2 orientation = traits.orientation_2_object();
size_type i;
@ -381,7 +384,7 @@ void make_collinear_vertices_visible(Polygon& polygon,
j = 1;
size_type start_i = 0;
while (i > 0 &&
orientation(polygon[i], polygon[prev_j], polygon[j]) == COLLINEAR)
orientation(Point_2(polygon[i]), Point_2(polygon[prev_j]), Point_2(polygon[j])) == COLLINEAR)
{
prev_j = i;
start_i = i;
@ -391,7 +394,7 @@ void make_collinear_vertices_visible(Polygon& polygon,
prev_j = 1;
j = 2;
while (j < polygon.size() &&
orientation(polygon[i], polygon[prev_j], polygon[j]) == COLLINEAR)
orientation(Point_2(polygon[i]), Point_2(polygon[prev_j]), Point_2(polygon[j])) == COLLINEAR)
{
i++;
prev_j++;
@ -420,7 +423,7 @@ void make_collinear_vertices_visible(Polygon& polygon,
prev_j = i+1;
j = i+2;
while (j < polygon.size() &&
orientation(polygon[i], polygon[prev_j], polygon[j]) ==
orientation(Point_2(polygon[i]), Point_2(polygon[prev_j]), Point_2(polygon[j])) ==
COLLINEAR)
{
j++;

View File

@ -73,6 +73,7 @@ Partition_y_mono_vertex_type partition_y_mono_vertex_type(
BidirectionalCirculator c,
const Traits& traits)
{
typedef typename Traits::Point_2 Point_2;
BidirectionalCirculator previous = c;
previous--;
BidirectionalCirculator next = c;
@ -83,17 +84,17 @@ Partition_y_mono_vertex_type partition_y_mono_vertex_type(
#endif
typename Traits::Compare_y_2 compare_y_2 = traits.compare_y_2_object();
if (compare_y_2(*previous, *c) == EQUAL &&
compare_y_2(*next, *c) == EQUAL)
if (compare_y_2(Point_2(*previous), Point_2(*c)) == EQUAL &&
compare_y_2(Point_2(*next), Point_2(*c)) == EQUAL)
return PARTITION_Y_MONO_COLLINEAR_VERTEX;
typename Traits::Less_yx_2 less_yx = traits.less_yx_2_object();
typename Traits::Left_turn_2 left_turn = traits.left_turn_2_object();
if (less_yx(*previous, *c))
if(less_yx(Point_2(*previous), Point_2(*c)))
{
if (less_yx(*next, *c)) // previous and next both less_yx
if (left_turn(*previous, *c, *next)) // interior angle less than pi
if(less_yx(Point_2(*next), Point_2(*c))) // previous and next both less_yx
if(left_turn(Point_2(*previous), Point_2(*c), Point_2(*next))) // interior angle less than pi
return PARTITION_Y_MONO_START_VERTEX;
else // interior angle greater than pi
return PARTITION_Y_MONO_SPLIT_VERTEX;
@ -102,8 +103,8 @@ Partition_y_mono_vertex_type partition_y_mono_vertex_type(
}
else
{
if (less_yx(*c, *next)) // previous and next both not less_yx
if (left_turn(*previous, *c, *next)) // interior angle less than pi
if(less_yx(Point_2(*c), Point_2(*next))) // previous and next both not less_yx
if(left_turn(Point_2(*previous), Point_2(*c), Point_2(*next))) // interior angle less than pi
return PARTITION_Y_MONO_END_VERTEX;
else // interior angle greater than pi
return PARTITION_Y_MONO_MERGE_VERTEX;
@ -300,16 +301,17 @@ template <class BidirectionalCirculator, class Traits>
bool partition_y_mono_interior_to_right(BidirectionalCirculator c,
const Traits& traits)
{
typedef typename Traits::Point_2 Point_2;
typename Traits::Compare_y_2 compare_y_2 = traits.compare_y_2_object();
BidirectionalCirculator previous = c; previous--;
Comparison_result cmp_y = compare_y_2(*previous, *c);
Comparison_result cmp_y = compare_y_2(Point_2(*previous), Point_2(*c));
if (cmp_y == LARGER) return true;
BidirectionalCirculator next = c; next++;
if (cmp_y == EQUAL && compare_y_2(*next, *c) == SMALLER) return true;
if (cmp_y == EQUAL && compare_y_2(Point_2(*next), Point_2(*c)) == SMALLER) return true;
return false;
}

View File

@ -53,6 +53,25 @@ bool is_simple_2(ForwardIterator first,
return is_simple_polygon(first, last, traits);
}
namespace internal { namespace Polygon_2 {
template <typename Traits>
class Compare_vertices {
typedef typename Traits::Less_xy_2 Less_xy_2;
typedef typename Traits::Point_2 Point_2;
Less_xy_2 less;
public:
Compare_vertices(Less_xy_2 less) : less(less) {}
// `Point_like` derives from `Point_2`
template <typename Point_like>
bool operator()(const Point_like& p1, const Point_like& p2) {
return less(Point_2(p1), Point_2(p2));
}
}; // end Compare_vertices
} // end namespace Polygon_2
} // end namespace internal
//-----------------------------------------------------------------------//
// left_vertex_2
@ -65,7 +84,9 @@ ForwardIterator left_vertex_2(ForwardIterator first,
const PolygonTraits&traits)
{
CGAL_polygon_precondition(first != last);
return std::min_element(first, last, traits.less_xy_2_object());
internal::Polygon_2::Compare_vertices<PolygonTraits>
less(traits.less_xy_2_object());
return std::min_element(first, last, less);
}
//-----------------------------------------------------------------------//
@ -79,7 +100,9 @@ ForwardIterator right_vertex_2(ForwardIterator first,
const PolygonTraits &traits)
{
CGAL_polygon_precondition(first != last);
return std::max_element(first, last, traits.less_xy_2_object());
internal::Polygon_2::Compare_vertices<PolygonTraits>
less(traits.less_xy_2_object());
return std::max_element(first, last, less);
}
//-----------------------------------------------------------------------//
@ -417,9 +440,14 @@ Orientation orientation_2(ForwardIterator first,
// of the points (prev,i,next) will coincide
// return the orientation of the triple (prev,i,next)
return traits.orientation_2_object()(*prev, *i, *next);
typedef typename Traits::Point_2 Point;
return traits.orientation_2_object()(Point(*prev), Point(*i), Point(*next));
}
} //namespace CGAL
/// \endcond
// Local Variables:
// c-basic-offset: 4
// End: