Merge pull request #6866 from lrineau/Kernel-Compare_distance_3_RT_FT__always_Filtered_predicate_RT_FT-GF

fix undefined
This commit is contained in:
Laurent Rineau 2022-12-05 16:00:00 +01:00 committed by GitHub
commit 72d590ef44
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
114 changed files with 1638 additions and 829 deletions

View File

@ -17,6 +17,7 @@
#ifndef CGAL_CARTESIAN_FUNCTION_OBJECTS_H
#define CGAL_CARTESIAN_FUNCTION_OBJECTS_H
#include <CGAL/tags.h>
#include <CGAL/Kernel/function_objects.h>
#include <CGAL/predicates/kernel_ftC2.h>
#include <CGAL/predicates/kernel_ftC3.h>
@ -445,14 +446,14 @@ namespace CartesianKernelFunctors {
}
template <class T1, class T2, class T3>
result_type
Needs_FT<result_type>
operator()(const T1& p, const T2& q, const T3& r) const
{
return CGAL::compare(squared_distance(p, q), squared_distance(p, r));
}
template <class T1, class T2, class T3, class T4>
result_type
Needs_FT<result_type>
operator()(const T1& p, const T2& q, const T3& r, const T4& s) const
{
return CGAL::compare(squared_distance(p, q), squared_distance(r, s));
@ -591,14 +592,14 @@ namespace CartesianKernelFunctors {
}
template <class T1, class T2, class T3>
result_type
Needs_FT<result_type>
operator()(const T1& p, const T2& q, const T3& r) const
{
return CGAL::compare(squared_distance(p, q), squared_distance(p, r));
}
template <class T1, class T2, class T3, class T4>
result_type
Needs_FT<result_type>
operator()(const T1& p, const T2& q, const T3& r, const T4& s) const
{
return CGAL::compare(squared_distance(p, q), squared_distance(r, s));
@ -668,28 +669,34 @@ namespace CartesianKernelFunctors {
result_type
operator()(const Point_3& p, const Point_3& q, const Point_3& r, const Point_3& s, const FT& ft) const
{
return CGAL::compare(squared_radiusC3(p.x(), p.y(), p.z(),
FT num, den;
squared_radiusC3(p.x(), p.y(), p.z(),
q.x(), q.y(), q.z(),
r.x(), r.y(), r.z(),
s.x(), s.y(), s.z() ),
ft);
s.x(), s.y(), s.z(),
num, den);
return CGAL::compare(num, den * ft);
}
result_type
operator()(const Point_3& p, const Point_3& q, const Point_3& r, const FT& ft) const
{
return CGAL::compare(squared_radiusC3(p.x(), p.y(), p.z(),
FT num, den;
squared_radiusC3(p.x(), p.y(), p.z(),
q.x(), q.y(), q.z(),
r.x(), r.y(), r.z()),
ft);
r.x(), r.y(), r.z(),
num, den);
return CGAL::compare(num, den * ft);
}
result_type
operator()(const Point_3& p, const Point_3& q, const FT& ft) const
{
return CGAL::compare(squared_radiusC3(p.x(), p.y(), p.z(),
q.x(), q.y(), q.z() ),
ft);
FT num, den;
squared_radiusC3(p.x(), p.y(), p.z(),
q.x(), q.y(), q.z(),
num, den);
return CGAL::compare(num, den * ft);
}
result_type
@ -1234,26 +1241,35 @@ namespace CartesianKernelFunctors {
result_type
operator()( const Point_3& p, const Point_3& q) const
{
return squared_radiusC3(p.x(), p.y(), p.z(),
q.x(), q.y(), q.z());
FT num, den;
squared_radiusC3(p.x(), p.y(), p.z(),
q.x(), q.y(), q.z(),
num, den);
return num / den;
}
result_type
operator()( const Point_3& p, const Point_3& q, const Point_3& r) const
{
return squared_radiusC3(p.x(), p.y(), p.z(),
FT num, den;
squared_radiusC3(p.x(), p.y(), p.z(),
q.x(), q.y(), q.z(),
r.x(), r.y(), r.z());
r.x(), r.y(), r.z(),
num, den);
return num / den;
}
result_type
operator()( const Point_3& p, const Point_3& q,
const Point_3& r, const Point_3& s) const
{
return squared_radiusC3(p.x(), p.y(), p.z(),
FT num, den;
squared_radiusC3(p.x(), p.y(), p.z(),
q.x(), q.y(), q.z(),
r.x(), r.y(), r.z(),
s.x(), s.y(), s.z());
s.x(), s.y(), s.z(),
num, den);
return num / den;
}
};
@ -2505,7 +2521,7 @@ namespace CartesianKernelFunctors {
FT rsy = psz*qsx-psx*qsz;
FT rsz = psx*qsy-psy*qsx;
// The following determinants can be developped and simplified.
// The following determinants can be developed and simplified.
//
// FT num_x = determinant(psy,psz,ps2,
// qsy,qsz,qs2,
@ -3961,7 +3977,7 @@ namespace CartesianKernelFunctors {
operator()(const Circle_3 &a, const Point_3 &p) const
{ return a.rep().has_on(p); }
result_type
Needs_FT<result_type>
operator()(const Sphere_3 &a, const Circle_3 &p) const
{ return a.rep().has_on(p); }
@ -4205,8 +4221,7 @@ namespace CartesianKernelFunctors {
public:
typedef typename K::Orientation result_type;
result_type
operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
result_type operator()(const Point_2& p, const Point_2& q, const Point_2& r) const
{
return orientationC2(p.x(), p.y(), q.x(), q.y(), r.x(), r.y());
}

View File

@ -142,11 +142,12 @@ centroidC3( const FT &px, const FT &py, const FT &pz,
template < class FT >
CGAL_KERNEL_MEDIUM_INLINE
FT
void
squared_radiusC3(const FT &px, const FT &py, const FT &pz,
const FT &qx, const FT &qy, const FT &qz,
const FT &rx, const FT &ry, const FT &rz,
const FT &sx, const FT &sy, const FT &sz)
const FT &sx, const FT &sy, const FT &sz,
FT &num, FT &den)
{
// Translate p to origin to simplify the expression.
FT qpx = qx-px;
@ -171,21 +172,22 @@ squared_radiusC3(const FT &px, const FT &py, const FT &pz,
FT num_z = determinant(qpx,qpy,qp2,
rpx,rpy,rp2,
spx,spy,sp2);
FT den = determinant(qpx,qpy,qpz,
FT dden = determinant(qpx,qpy,qpz,
rpx,rpy,rpz,
spx,spy,spz);
CGAL_kernel_assertion( ! CGAL_NTS is_zero(den) );
CGAL_kernel_assertion( ! CGAL_NTS is_zero(dden) );
return (CGAL_NTS square(num_x) + CGAL_NTS square(num_y)
+ CGAL_NTS square(num_z)) / CGAL_NTS square(2 * den);
num = CGAL_NTS square(num_x) + CGAL_NTS square(num_y) + CGAL_NTS square(num_z);
den = CGAL_NTS square(2 * dden);
}
template < class FT >
CGAL_KERNEL_MEDIUM_INLINE
FT
void
squared_radiusC3(const FT &px, const FT &py, const FT &pz,
const FT &qx, const FT &qy, const FT &qz,
const FT &sx, const FT &sy, const FT &sz)
const FT &sx, const FT &sy, const FT &sz,
FT &num, FT &den)
{
// Translate s to origin to simplify the expression.
FT psx = px-sx;
@ -207,14 +209,14 @@ squared_radiusC3(const FT &px, const FT &py, const FT &pz,
FT num_z = ps2 * determinant(qsx,qsy,rsx,rsy)
- qs2 * determinant(psx,psy,rsx,rsy);
FT den = determinant(psx,psy,psz,
FT dden = determinant(psx,psy,psz,
qsx,qsy,qsz,
rsx,rsy,rsz);
CGAL_kernel_assertion( den != 0 );
CGAL_kernel_assertion( dden != 0 );
return (CGAL_NTS square(num_x) + CGAL_NTS square(num_y)
+ CGAL_NTS square(num_z)) / CGAL_NTS square(2 * den);
num = CGAL_NTS square(num_x) + CGAL_NTS square(num_y) + CGAL_NTS square(num_z);
den = CGAL_NTS square(2 * dden);
}
template <class FT>
@ -305,11 +307,13 @@ squared_distanceC3( const FT &px, const FT &py, const FT &pz,
template < class FT >
CGAL_KERNEL_INLINE
FT
void
squared_radiusC3( const FT &px, const FT &py, const FT &pz,
const FT &qx, const FT &qy, const FT &qz)
const FT &qx, const FT &qy, const FT &qz,
FT &num, FT &den)
{
return squared_distanceC3(px, py, pz, qx, qy, qz) / 4;
num = squared_distanceC3(px, py, pz, qx, qy, qz);
den = FT(4);
}
template < class FT >

View File

@ -754,7 +754,7 @@ power_side_of_bounded_power_sphereC3(
}
// return the sign of the power test of weighted point (rx,ry,rz,rw)
// with respect to the smallest sphere orthogoanal to
// with respect to the smallest sphere orthogonal to
// p,q
template< class FT >
typename Same_uncertainty_nt<Bounded_side, FT>::type
@ -764,20 +764,19 @@ power_side_of_bounded_power_sphereC3(
const FT &rx, const FT &ry, const FT &rz, const FT &rw)
{
FT FT2(2);
FT FT4(4);
FT dpx = px - qx;
FT dpy = py - qy;
FT dpz = pz - qz;
FT dpw = pw - qw;
FT dp2 = CGAL_NTS square(dpx) + CGAL_NTS square(dpy) + CGAL_NTS square(dpz);
FT drx = rx - (px + qx)/FT2;
FT dry = ry - (py + qy)/FT2;
FT drz = rz - (pz + qz)/FT2;
FT drw = rw - (pw + qw)/FT2;
FT drx = FT2 * rx - (px + qx);
FT dry = FT2 * ry - (py + qy);
FT drz = FT2 * rz - (pz + qz);
FT drw = FT2 * rw - (pw + qw);
FT dr2 = CGAL_NTS square(drx) + CGAL_NTS square(dry) + CGAL_NTS square(drz);
FT dpr = dpx*drx + dpy*dry +dpz*drz;
return enum_cast<Bounded_side>(
- CGAL_NTS sign (dr2 - dp2/FT4 + dpr*dpw/dp2 - drw ));
- CGAL_NTS sign (dr2*dp2 - dp2*dp2 + FT2*dpr*dpw - FT2*drw*dp2 ));
}
} // namespace CGAL

View File

@ -81,13 +81,16 @@ struct Filtered_kernel_base
Approximate_kernel approximate_kernel() const { return {}; }
// We change the predicates.
#define CGAL_Kernel_pred(P, Pf) \
typedef Filtered_predicate<typename Exact_kernel::P, typename Approximate_kernel::P, C2E, C2F> P; \
#define CGAL_Kernel_pred_RT_or_FT(P, Pf) \
typedef Filtered_predicate_RT_FT<typename Exact_kernel_rt::P, \
typename Exact_kernel::P, \
typename Approximate_kernel::P, \
C2E_rt, \
C2E, \
C2F> P; \
P Pf() const { return P(); }
#define CGAL_Kernel_pred_RT(P, Pf) \
typedef Filtered_predicate<typename Exact_kernel_rt::P, typename Approximate_kernel::P, C2E_rt, C2F> P; \
P Pf() const { return P(); }
#define CGAL_Kernel_pred(P, Pf) CGAL_Kernel_pred_RT_or_FT(P, Pf)
// We don't touch the constructions.
#define CGAL_Kernel_cons(Y,Z)

View File

@ -19,6 +19,8 @@
#include <CGAL/Uncertain.h>
#include <CGAL/Profile_counter.h>
#include <type_traits>
namespace CGAL {
// This template class is a wrapper that implements the filtering for any
@ -84,15 +86,8 @@ public:
template <typename... Args>
result_type
operator()(const Args&... args) const;
};
template <class EP, class AP, class C2E, class C2A, bool Protection>
template <typename... Args>
typename Filtered_predicate<EP,AP,C2E,C2A,Protection>::result_type
Filtered_predicate<EP,AP,C2E,C2A,Protection>::
operator()(const Args&... args) 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
{
@ -109,8 +104,76 @@ Filtered_predicate<EP,AP,C2E,C2A,Protection>::
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST);
CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST);
return ep(c2e(args)...);
}
}
};
} //namespace CGAL
template <class EP_RT, class EP_FT, class AP, class C2E_RT, class C2E_FT, class C2A, bool Protection = true>
class Filtered_predicate_RT_FT
{
C2E_RT c2e_rt;
C2E_FT c2e_ft;
C2A c2a;
EP_RT ep_rt;
EP_FT ep_ft;
AP ap;
using Ares = typename Remove_needs_FT<typename AP::result_type>::Type;
public:
using result_type = typename Remove_needs_FT<typename EP_FT::result_type>::Type;
private:
template <typename... Args>
struct Call_operator_needs_FT
{
using Actual_approx_res = decltype(ap(c2a(std::declval<const Args&>())...));
using Approx_res = std::remove_cv_t<std::remove_reference_t<Actual_approx_res> >;
enum { value = std::is_same<Approx_res, Needs_FT<Ares> >::value };
};
template <typename... Args,
std::enable_if_t<Call_operator_needs_FT<Args...>::value>* = nullptr>
result_type call(const Args&... args) const { return ep_ft(c2e_ft(args)...); }
template <typename... Args,
std::enable_if_t<! Call_operator_needs_FT<Args...>::value>* = nullptr>
result_type call(const Args&... args) const { return ep_rt(c2e_rt(args)...); }
public:
// ## Important note
//
// If you want to remove of rename that member function template `needs_FT`,
// please also change the lines with
// `CGAL_GENERATE_MEMBER_DETECTOR(needs_FT);`
// or `has_needs_FT<typename R::Compare_distance_3>` in
// the file `Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h`.
template <typename... Args>
bool needs_FT(const Args&...) const { return Call_operator_needs_FT<Args...>::value; }
template <typename... Args>
result_type
operator()(const Args&... args) 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
{
Protect_FPU_rounding<Protection> p;
try
{
Ares res = ap(c2a(args)...);
if (is_certain(res))
return get_certain(res);
}
catch (Uncertain_conversion_exception&) {}
}
CGAL_BRANCH_PROFILER_BRANCH(tmp);
Protect_FPU_rounding<!Protection> p(CGAL_FE_TONEAREST);
CGAL_expensive_assertion(FPU_get_cw() == CGAL_FE_TONEAREST);
return call(args...);
}
};
} // namespace CGAL
#endif // CGAL_FILTERED_PREDICATE_H

View File

@ -89,7 +89,7 @@ protected:
// Exact_kernel = exact kernel that will be made lazy
// Kernel = lazy kernel
// the Generic base simplies applies the generic magic functor stupidly.
// the Generic base simply applies the generic magic functor stupidly.
// then the real base fixes up a few special cases.
template < typename EK_, typename AK_, typename E2A_, typename Kernel_ >
class Lazy_kernel_generic_base : protected internal::Enum_holder

View File

@ -97,8 +97,7 @@ function(CGAL_setup_CGAL_dependencies target)
target_compile_definitions(${target} INTERFACE CGAL_TEST_SUITE=1)
endif()
# CGAL now requires C++14. `decltype(auto)` is used as a marker of
# C++14.
# CGAL now requires C++14. `decltype(auto)` is used as a marker of C++14.
target_compile_features(${target} INTERFACE cxx_decltype_auto)
use_CGAL_Boost_support(${target} INTERFACE)

View File

@ -62,19 +62,19 @@
#define CGAL_DO_INTERSECT_FUNCTION(A, B, DIM) \
template<typename K> \
inline bool \
inline typename K::Boolean \
do_intersect(const A<K>& a, const B<K>& b) { \
return BOOST_PP_CAT(K().do_intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \
} \
template<typename K> \
inline bool \
inline typename K::Boolean \
do_intersect(const B<K>& b, const A<K>& a) { \
return BOOST_PP_CAT(K().do_intersect_, BOOST_PP_CAT(DIM, _object()(b, a))); \
}
#define CGAL_DO_INTERSECT_FUNCTION_SELF(A, DIM) \
template<typename K> \
inline bool \
inline typename K::Boolean \
do_intersect(const A<K> & a, const A<K> & b) { \
return BOOST_PP_CAT(K().do_intersect_, BOOST_PP_CAT(DIM, _object()(a, b))); \
}
@ -152,21 +152,21 @@ intersection_impl(const A& a, const B& b, Dynamic_dimension_tag) {
}
template<typename A, typename B>
inline bool
inline auto // K::Boolean
do_intersect_impl(const A& a, const B& b, CGAL::Dimension_tag<2>) {
typedef typename CGAL::Kernel_traits<A>::Kernel Kernel;
return Kernel().do_intersect_2_object()(a, b);
}
template<typename A, typename B>
inline bool
inline auto // K::Boolean
do_intersect_impl(const A& a, const B& b, Dimension_tag<3>) {
typedef typename CGAL::Kernel_traits<A>::Kernel Kernel;
return Kernel().do_intersect_3_object()(a, b);
}
template<typename A, typename B>
inline bool
inline auto // K::Boolean
do_intersect_impl(const A& a, const B& b, Dynamic_dimension_tag) {
typedef typename CGAL::Kernel_traits<A>::Kernel Kernel;
return Kernel().do_intersect_d_object()(a, b);
@ -188,7 +188,7 @@ do_intersect_impl(const A& a, const B& b, Dynamic_dimension_tag) {
// template<typename A, typename B>
// inline
// bool
// auto // K::Boolean
// do_intersect(const A& a, const B& b) {
// CGAL_static_assertion_msg((std::is_same<typename A::Ambient_dimension, typename B::Ambient_dimension>::value),
// "do_intersect with objects of different dimensions not supported");

View File

@ -24,16 +24,17 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const CGAL::Bbox_2& bbox,
typename K::Boolean
do_intersect(const CGAL::Bbox_2& bbox,
const typename K::Circle_2& circle,
const K&)
{
return do_intersect_circle_iso_rectangle_2(circle, bbox, K());
}
template <class K>
bool do_intersect(const typename K::Circle_2& circle,
typename K::Boolean
do_intersect(const typename K::Circle_2& circle,
const CGAL::Bbox_2& bbox,
const K&)
{
@ -44,14 +45,16 @@ bool do_intersect(const typename K::Circle_2& circle,
} // namespace Intersections
template<typename K>
bool do_intersect(const CGAL::Bbox_2& a,
typename K::Boolean
do_intersect(const CGAL::Bbox_2& a,
const Circle_2<K>& b)
{
return K().do_intersect_2_object()(a, b);
}
template<typename K>
bool do_intersect(const Circle_2<K>& a,
typename K::Boolean
do_intersect(const Circle_2<K>& a,
const CGAL::Bbox_2& b)
{
return K().do_intersect_2_object()(a, b);

View File

@ -21,14 +21,18 @@
namespace CGAL {
template <typename K>
inline bool do_intersect(const Iso_rectangle_2<K> &rect,
const Bbox_2 &box)
inline
typename K::Boolean
do_intersect(const Iso_rectangle_2<K>& rect,
const Bbox_2& box)
{
return do_intersect(K::Iso_rectangle_2(box), rect);
}
template <typename K>
inline bool do_intersect(const Bbox_2 &box,
inline
typename K::Boolean
do_intersect(const Bbox_2 &box,
const Iso_rectangle_2<K> &rect)
{
return do_intersect(rect, box);

View File

@ -27,7 +27,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Line_2& line,
typename K::Boolean
do_intersect(const typename K::Line_2& line,
const CGAL::Bbox_2& bbox,
const K& k)
{
@ -36,7 +37,8 @@ bool do_intersect(const typename K::Line_2& line,
}
template <class K>
bool do_intersect(const CGAL::Bbox_2& bbox,
typename K::Boolean
do_intersect(const CGAL::Bbox_2& bbox,
const typename K::Line_2& line,
const K& k)
{
@ -47,13 +49,17 @@ bool do_intersect(const CGAL::Bbox_2& bbox,
} // namespace Intersections
template<typename K>
bool do_intersect(const CGAL::Bbox_2& bbox, const Line_2<K>& line)
typename K::Boolean
do_intersect(const CGAL::Bbox_2& bbox,
const Line_2<K>& line)
{
return K().do_intersect_2_object()(bbox, line);
}
template<typename K>
bool do_intersect(const Line_2<K>& line, const CGAL::Bbox_2& bbox)
typename K::Boolean
do_intersect(const Line_2<K>& line,
const CGAL::Bbox_2& bbox)
{
return K().do_intersect_2_object()(line, bbox);
}

View File

@ -24,7 +24,9 @@ namespace Intersections {
namespace internal {
template <class K>
inline bool do_intersect(const Bbox_2 &bbox,
inline
typename K::Boolean
do_intersect(const Bbox_2 &bbox,
const Point_2<K> &pt,
const K& k)
{
@ -36,7 +38,9 @@ inline bool do_intersect(const Bbox_2 &bbox,
}
template <class K>
inline bool do_intersect(const Point_2<K> &pt,
inline
typename K::Boolean
do_intersect(const Point_2<K> &pt,
const Bbox_2& bbox,
const K& k)
{
@ -69,14 +73,16 @@ intersection(const CGAL::Bbox_2& b,
} // namespace Intersections
template<typename K>
bool do_intersect(const CGAL::Bbox_2& a,
typename K::Boolean
do_intersect(const CGAL::Bbox_2& a,
const Point_2<K>& b)
{
return Intersections::internal::do_intersect(a,b,K());
}
template<typename K>
bool do_intersect(const Point_2<K>& a,
typename K::Boolean
do_intersect(const Point_2<K>& a,
const CGAL::Bbox_2& b)
{
return Intersections::internal::do_intersect(b,a,K());

View File

@ -27,7 +27,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Ray_2& ray,
typename K::Boolean
do_intersect(const typename K::Ray_2& ray,
const CGAL::Bbox_2& bbox,
const K& k)
{
@ -36,7 +37,8 @@ bool do_intersect(const typename K::Ray_2& ray,
}
template <class K>
bool do_intersect(const CGAL::Bbox_2& bbox,
typename K::Boolean
do_intersect(const CGAL::Bbox_2& bbox,
const typename K::Ray_2& ray,
const K& k)
{
@ -47,13 +49,17 @@ bool do_intersect(const CGAL::Bbox_2& bbox,
} // namespace Intersections
template<typename K>
bool do_intersect(const CGAL::Bbox_2& bbox, const Ray_2<K>& ray)
typename K::Boolean
do_intersect(const CGAL::Bbox_2& bbox,
const Ray_2<K>& ray)
{
return K().do_intersect_2_object()(bbox, ray);
}
template<typename K>
bool do_intersect(const Ray_2<K>& ray, const CGAL::Bbox_2& bbox)
typename K::Boolean
do_intersect(const Ray_2<K>& ray,
const CGAL::Bbox_2& bbox)
{
return K().do_intersect_2_object()(ray, bbox);
}

View File

@ -20,20 +20,21 @@
namespace CGAL {
template <class K>
inline bool do_intersect(
const Segment_2<K> &seg,
const Bbox_2 &box)
inline
typename K::Boolean
do_intersect(const Segment_2<K>& seg,
const Bbox_2& box)
{
typename K::Iso_rectangle_2 rec(box.xmin(), box.ymin(), box.xmax(), box.ymax());
return do_intersect(rec, seg);
}
template <class K>
inline bool do_intersect(
const Bbox_2 &box,
const Segment_2<K> &seg)
inline
typename K::Boolean
do_intersect(const Bbox_2& box,
const Segment_2<K>& seg)
{
return do_intersect(seg, box);
}
@ -41,7 +42,8 @@ inline bool do_intersect(
template<typename K>
typename Intersection_traits<K, typename K::Segment_2, Bbox_2>::result_type
intersection(const CGAL::Bbox_2& box,
const Segment_2<K>& seg) {
const Segment_2<K>& seg)
{
typename K::Iso_rectangle_2 rec(box.xmin(), box.ymin(), box.xmax(), box.ymax());
return intersection(rec, seg);
}
@ -49,9 +51,11 @@ intersection(const CGAL::Bbox_2& box,
template<typename K>
typename Intersection_traits<K, typename K::Segment_2, Bbox_2>::result_type
intersection(const Segment_2<K>& seg,
const CGAL::Bbox_2& box) {
const CGAL::Bbox_2& box)
{
return intersection(box, seg);
}
}
} // namespace CGAL
#endif // CGAL_INTERSECTIONS_BBOX_2_SEGMENT_2_H

View File

@ -20,20 +20,21 @@
namespace CGAL {
template <class K>
inline bool do_intersect(
const Triangle_2<K> &tr,
const Bbox_2 &box)
inline
typename K::Boolean
do_intersect(const Triangle_2<K>& tr,
const Bbox_2& box)
{
typename K::Iso_rectangle_2 rec(box.xmin(), box.ymin(), box.xmax(), box.ymax());
return do_intersect(rec, tr);
}
template <class K>
inline bool do_intersect(
const Bbox_2 &box,
const Triangle_2<K> &tr)
inline
typename K::Boolean
do_intersect(const Bbox_2& box,
const Triangle_2<K>& tr)
{
return do_intersect(tr, box);
}
@ -41,7 +42,8 @@ inline bool do_intersect(
template<typename K>
typename Intersection_traits<K, typename K::Triangle_2, Bbox_2>::result_type
intersection(const Bbox_2& box,
const Triangle_2<K>& tr) {
const Triangle_2<K>& tr)
{
typename K::Iso_rectangle_2 rec(box.xmin(), box.ymin(), box.xmax(), box.ymax());
return intersection(rec, tr);
}
@ -49,9 +51,11 @@ intersection(const Bbox_2& box,
template<typename K>
typename Intersection_traits<K, typename K::Triangle_2, Bbox_2>::result_type
intersection(const Triangle_2<K>& tr,
const Bbox_2& box) {
const Bbox_2& box)
{
return intersection(box, tr);
}
}
} // namespace CGAL
#endif // CGAL_INTERSECTIONS_BBOX_2_TRIANGLE_2_H

View File

@ -27,7 +27,7 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Circle_2 & circ1,
typename K::Boolean do_intersect(const typename K::Circle_2& circ1,
const typename K::Circle_2& circ2,
const K&)
{

View File

@ -24,7 +24,7 @@ namespace internal {
// Circle_2 is not a disk, thus if the box is contained within the circle, there is no intersection.
template <class K>
bool do_intersect_circle_iso_rectangle_2(const typename K::Circle_2& circle,
typename K::Boolean do_intersect_circle_iso_rectangle_2(const typename K::Circle_2& circle,
const typename K::Iso_rectangle_2& rec,
const K&)
{
@ -92,16 +92,15 @@ bool do_intersect_circle_iso_rectangle_2(const typename K::Circle_2& circle,
}
template <class K>
bool do_intersect(const typename K::Iso_rectangle_2& rec,
typename K::Boolean do_intersect(const typename K::Iso_rectangle_2& rec,
const typename K::Circle_2& circle,
const K&)
{
return do_intersect_circle_iso_rectangle_2(circle, rec, K());
}
template <class K>
bool do_intersect(const typename K::Circle_2& circle,
typename K::Boolean do_intersect(const typename K::Circle_2& circle,
const typename K::Iso_rectangle_2& rec,
const K&)
{

View File

@ -29,8 +29,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool
do_intersect(const typename K::Circle_2 & c,
typename K::Boolean
do_intersect(const typename K::Circle_2& c,
const typename K::Line_2& l,
const K&)
{
@ -38,9 +38,9 @@ do_intersect(const typename K::Circle_2 & c,
}
template <class K>
bool
typename K::Boolean
do_intersect(const typename K::Line_2& l,
const typename K::Circle_2 & c,
const typename K::Circle_2& c,
const K&)
{
return squared_distance(c.center(), l) <= c.squared_radius();
@ -53,4 +53,4 @@ CGAL_DO_INTERSECT_FUNCTION(Circle_2, Line_2, 2)
} // namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_CIRCLE_2_LINE_2_H

View File

@ -25,20 +25,19 @@ namespace internal {
template <class K>
inline
bool
do_intersect(const typename K::Point_2 &pt,
const typename K::Circle_2 &circle,
typename K::Boolean
do_intersect(const typename K::Point_2& pt,
const typename K::Circle_2& circle,
const K&)
{
return circle.has_on_boundary(pt);
}
template <class K>
inline
bool
do_intersect(const typename K::Circle_2 &circle,
const typename K::Point_2 &pt,
typename K::Boolean
do_intersect(const typename K::Circle_2& circle,
const typename K::Point_2& pt,
const K&)
{
return circle.has_on_boundary(pt);
@ -48,8 +47,8 @@ do_intersect(const typename K::Circle_2 &circle,
template <class K>
typename CGAL::Intersection_traits
<K, typename K::Point_2, typename K::Circle_2>::result_type
intersection(const typename K::Point_2 &pt,
const typename K::Circle_2 &circle,
intersection(const typename K::Point_2& pt,
const typename K::Circle_2& circle,
const K& k)
{
if (do_intersect(pt,circle, k))
@ -60,8 +59,8 @@ intersection(const typename K::Point_2 &pt,
template <class K>
typename CGAL::Intersection_traits
<K, typename K::Circle_2, typename K::Point_2>::result_type
intersection(const typename K::Circle_2 &circle,
const typename K::Point_2 &pt,
intersection(const typename K::Circle_2& circle,
const typename K::Point_2& pt,
const K& k)
{
return internal::intersection(pt, circle, k);
@ -73,5 +72,6 @@ intersection(const typename K::Circle_2 &circle,
CGAL_INTERSECTION_FUNCTION(Point_2, Circle_2, 2)
CGAL_DO_INTERSECT_FUNCTION(Circle_2, Point_2, 2)
} //namespace CGAL
} // namespace CGAL
#endif // CGAL_INTERSECTIONS_2_POINT_2_CIRCLE_2_H

View File

@ -24,8 +24,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool
do_intersect(const typename K::Circle_2 & c,
typename K::Boolean
do_intersect(const typename K::Circle_2& c,
const typename K::Ray_2& r,
const K&)
{
@ -33,9 +33,9 @@ do_intersect(const typename K::Circle_2 & c,
}
template <class K>
bool
typename K::Boolean
do_intersect(const typename K::Ray_2& r,
const typename K::Circle_2 & c,
const typename K::Circle_2& c,
const K&)
{
return squared_distance(c.center(), r) <= c.squared_radius();
@ -47,4 +47,5 @@ do_intersect(const typename K::Ray_2& r,
CGAL_DO_INTERSECT_FUNCTION(Circle_2, Ray_2, 2)
} // namespace CGAL
#endif // CGAL_INTERSECTIONS_2_CIRCLE_2_RAY_2_H

View File

@ -24,8 +24,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool
do_intersect(const typename K::Circle_2 & c,
typename K::Boolean
do_intersect(const typename K::Circle_2& c,
const typename K::Segment_2& s,
const K&)
{
@ -33,9 +33,9 @@ do_intersect(const typename K::Circle_2 & c,
}
template <class K>
bool
typename K::Boolean
do_intersect(const typename K::Segment_2& s,
const typename K::Circle_2 & c,
const typename K::Circle_2& c,
const K&)
{
return squared_distance(c.center(), s) <= c.squared_radius();
@ -47,4 +47,5 @@ do_intersect(const typename K::Segment_2& s,
CGAL_DO_INTERSECT_FUNCTION(Circle_2, Segment_2, 2)
} // namespace CGAL
#endif // CGAL_INTERSECTIONS_2_CIRCLE_2_SEGMENT_2_H

View File

@ -25,7 +25,7 @@ namespace Intersections {
namespace internal {
template <class K>
bool
typename K::Boolean
do_intersect(const typename K::Circle_2 & c,
const typename K::Triangle_2& t,
const K&)
@ -48,9 +48,9 @@ do_intersect(const typename K::Circle_2 & c,
}
template <class K>
bool
typename K::Boolean
do_intersect(const typename K::Triangle_2& t,
const typename K::Circle_2 & c,
const typename K::Circle_2& c,
const K&)
{
return do_intersect(c,t);
@ -62,4 +62,5 @@ do_intersect(const typename K::Triangle_2& t,
CGAL_DO_INTERSECT_FUNCTION(Circle_2, Triangle_2, 2)
} // namespace CGAL
#endif // CGAL_INTERSECTIONS_2_CIRCLE_2_TRIANGLE_2_H

View File

@ -74,20 +74,20 @@ intersection(
}
template<typename K>
inline bool
do_intersect(const typename K::Iso_rectangle_2 &irect1,
const typename K::Iso_rectangle_2 &irect2,
const K&) {
typename K::Boolean
do_intersect(const typename K::Iso_rectangle_2& irect1,
const typename K::Iso_rectangle_2& irect2,
const K&)
{
return bool(intersection(irect1, irect2));
}
} // namespace internal
} // namespace Intersections
CGAL_INTERSECTION_FUNCTION_SELF(Iso_rectangle_2, 2)
CGAL_DO_INTERSECT_FUNCTION_SELF(Iso_rectangle_2, 2)
} //namespace CGAL
} // namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_ISO_RECTANGLE_2_H

View File

@ -58,25 +58,27 @@ protected:
};
template <class K>
inline bool do_intersect(const typename K::Line_2 &p1,
const typename K::Iso_rectangle_2 &p2,
inline
typename K::Boolean
do_intersect(const typename K::Line_2& l,
const typename K::Iso_rectangle_2& ir,
const K&)
{
typedef Line_2_Iso_rectangle_2_pair<K> pair_t;
pair_t pair(&p1, &p2);
pair_t pair(&l, &ir);
return pair.intersection_type() != pair_t::NO_INTERSECTION;
}
template <class K>
inline bool do_intersect(const typename K::Iso_rectangle_2 &p2,
const typename K::Line_2 &p1,
inline
typename K::Boolean
do_intersect(const typename K::Iso_rectangle_2& ir,
const typename K::Line_2& l,
const K& k)
{
return internal::do_intersect(p1, p2, k);
return internal::do_intersect(l, ir, k);
}
template <class K>
typename Line_2_Iso_rectangle_2_pair<K>::Intersection_results
Line_2_Iso_rectangle_2_pair<K>::intersection_type() const
@ -217,4 +219,4 @@ CGAL_DO_INTERSECT_FUNCTION(Line_2, Iso_rectangle_2, 2)
#include <CGAL/enable_warnings.h>
#endif
#endif // CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_LINE_2_H

View File

@ -30,9 +30,9 @@ namespace internal {
template <class K>
inline
bool
do_intersect(const typename K::Point_2 &pt,
const typename K::Iso_rectangle_2 &iso,
typename K::Boolean
do_intersect(const typename K::Point_2& pt,
const typename K::Iso_rectangle_2& iso,
const K&)
{
return !iso.has_on_unbounded_side(pt);
@ -40,9 +40,9 @@ do_intersect(const typename K::Point_2 &pt,
template <class K>
inline
bool
do_intersect(const typename K::Iso_rectangle_2 &iso,
const typename K::Point_2 &pt,
typename K::Boolean
do_intersect(const typename K::Iso_rectangle_2& iso,
const typename K::Point_2& pt,
const K&)
{
return !iso.has_on_unbounded_side(pt);
@ -77,6 +77,6 @@ intersection(const typename K::Iso_rectangle_2 &iso,
CGAL_INTERSECTION_FUNCTION(Point_2, Iso_rectangle_2, 2)
CGAL_DO_INTERSECT_FUNCTION(Point_2, Iso_rectangle_2, 2)
} //namespace CGAL
} // namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_POINT_2_ISO_RECTANGLE_2_H

View File

@ -55,21 +55,25 @@ protected:
};
template <class K>
inline bool do_intersect(const typename K::Ray_2 &p1,
const typename K::Iso_rectangle_2 &p2,
inline
typename K::Boolean
do_intersect(const typename K::Ray_2& r,
const typename K::Iso_rectangle_2& ir,
const K&)
{
typedef Ray_2_Iso_rectangle_2_pair<K> pair_t;
pair_t pair(&p1, &p2);
pair_t pair(&r, &ir);
return pair.intersection_type() != pair_t::NO_INTERSECTION;
}
template <class K>
inline bool do_intersect(const typename K::Iso_rectangle_2 &p2,
const typename K::Ray_2 &p1,
inline
typename K::Boolean
do_intersect(const typename K::Iso_rectangle_2& ir,
const typename K::Ray_2& r,
const K& k)
{
return do_intersect(p1, p2, k);
return do_intersect(r, ir, k);
}
template <class K>
@ -200,9 +204,8 @@ Ray_2_Iso_rectangle_2_pair<K>::intersection_point() const
CGAL_INTERSECTION_FUNCTION(Ray_2, Iso_rectangle_2, 2)
CGAL_DO_INTERSECT_FUNCTION(Ray_2, Iso_rectangle_2, 2)
} //namespace CGAL
} // namespace CGAL
#include <CGAL/enable_warnings.h>
#endif // CGAL_RAY_2_iSO_RECTANGLE_2_INTERSECTION_H
#endif // CGAL_RAY_2_ISO_RECTANGLE_2_INTERSECTION_H

View File

@ -54,21 +54,6 @@ protected:
_max;
};
template <class K>
inline bool do_intersect(
const typename K::Segment_2 &p1,
const typename K::Iso_rectangle_2 &p2,
const K&)
{
typedef Segment_2_Iso_rectangle_2_pair<K> pair_t;
pair_t pair(&p1, &p2);
return pair.intersection_type() != pair_t::NO_INTERSECTION;
}
template <class K>
typename CGAL::Intersection_traits
<K, typename K::Segment_2, typename K::Iso_rectangle_2>::result_type
@ -208,26 +193,35 @@ intersection_point() const
return translated_point(_ref_point, construct_scaled_vector(_dir,_min));
}
template <class K>
inline bool do_intersect(
const typename K::Iso_rectangle_2 &p1,
const typename K::Segment_2 &p2,
inline
typename K::Boolean
do_intersect(const typename K::Segment_2& s,
const typename K::Iso_rectangle_2& ir,
const K&)
{
typedef Segment_2_Iso_rectangle_2_pair<K> pair_t;
pair_t pair(&p2, &p1);
pair_t pair(&s, &ir);
return pair.intersection_type() != pair_t::NO_INTERSECTION;
}
template <class K>
inline
typename K::Boolean
do_intersect(const typename K::Iso_rectangle_2& ir,
const typename K::Segment_2& s,
const K& k)
{
return do_intersect(s, ir, k);
}
} // namespace internal
} // namespace Intersections
CGAL_INTERSECTION_FUNCTION(Segment_2, Iso_rectangle_2, 2)
CGAL_DO_INTERSECT_FUNCTION(Segment_2, Iso_rectangle_2, 2)
} //namespace CGAL
} // namespace CGAL
#include <CGAL/enable_warnings.h>

View File

@ -292,9 +292,9 @@ namespace internal {
}
template <class K>
bool do_intersect(
const typename K::Triangle_2 &tr,
const typename K::Iso_rectangle_2 &ir,
typename K::Boolean
do_intersect(const typename K::Triangle_2& tr,
const typename K::Iso_rectangle_2& ir,
const K& k)
{
//1) check if at least one vertex of tr is not outside ir
@ -318,20 +318,21 @@ namespace internal {
}
template <class K>
inline bool do_intersect(
const typename K::Iso_rectangle_2 &ir,
const typename K::Triangle_2 &tr,
inline
typename K::Boolean
do_intersect(const typename K::Iso_rectangle_2& ir,
const typename K::Triangle_2& tr,
const K& k)
{
return do_intersect(tr,ir,k);
return do_intersect(tr, ir, k);
}
} //namespace internal
} // namespace internal
} // namespace Intersections
CGAL_INTERSECTION_FUNCTION(Triangle_2, Iso_rectangle_2, 2)
CGAL_DO_INTERSECT_FUNCTION(Triangle_2, Iso_rectangle_2, 2)
}//end namespace
} // namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_TRIANGLE_2_H

View File

@ -52,19 +52,20 @@ protected:
mutable typename K::Point_2 _intersection_point;
};
template <class K>
inline bool do_intersect(
const typename K::Line_2 &p1,
const typename K::Line_2 &p2,
inline
typename K::Boolean
do_intersect(const typename K::Line_2& l1,
const typename K::Line_2& l2,
const K&)
{
typedef Line_2_Line_2_pair<K> pair_t;
pair_t pair(&p1, &p2);
pair_t pair(&l1, &l2);
return pair.intersection_type() != pair_t::NO_INTERSECTION;
}
template <class K>
typename CGAL::Intersection_traits
<K, typename K::Line_2, typename K::Line_2>::result_type
@ -200,7 +201,6 @@ Line_2_Line_2_pair<K>::intersection_line() const
CGAL_INTERSECTION_FUNCTION_SELF(Line_2, 2)
CGAL_DO_INTERSECT_FUNCTION_SELF(Line_2, 2)
} // namespace CGAL
} //namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_LINE_2_LINE_2_H

View File

@ -29,18 +29,20 @@ namespace Intersections {
namespace internal {
template <class K>
inline bool
do_intersect(const typename K::Point_2 &pt,
const typename K::Line_2 &line,
inline
typename K::Boolean
do_intersect(const typename K::Point_2& pt,
const typename K::Line_2& line,
const K&)
{
return line.has_on(pt);
}
template <class K>
inline bool
do_intersect(const typename K::Line_2 &line,
const typename K::Point_2 &pt,
inline
typename K::Boolean
do_intersect(const typename K::Line_2& line,
const typename K::Point_2& pt,
const K&)
{
return line.has_on(pt);
@ -76,6 +78,6 @@ intersection(const typename K::Line_2 &line,
CGAL_INTERSECTION_FUNCTION(Point_2, Line_2, 2)
CGAL_DO_INTERSECT_FUNCTION(Point_2, Line_2, 2)
} //namespace CGAL
} // namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_POINT_2_LINE_2_H

View File

@ -55,17 +55,26 @@ protected:
};
template <class K>
inline bool do_intersect(
const typename K::Ray_2 &p1,
const typename K::Line_2 &p2,
inline
typename K::Boolean
do_intersect(const typename K::Ray_2& r,
const typename K::Line_2& l,
const K&)
{
typedef Ray_2_Line_2_pair<K> pair_t;
pair_t pair(&p1, &p2);
pair_t pair(&r, &l);
return pair.intersection_type() != pair_t::NO_INTERSECTION;
}
template <class K>
inline
typename K::Boolean
do_intersect(const typename K::Line_2& l,
const typename K::Ray_2& r,
const K& k)
{
return do_intersect(r, l, k);
}
template <class K>
typename Intersection_traits
@ -99,20 +108,6 @@ intersection(const typename K::Line_2 &line,
return internal::intersection(ray, line, k);
}
template <class K>
inline bool do_intersect(
const typename K::Line_2 &p1,
const typename K::Ray_2 &p2,
const K&)
{
typedef Ray_2_Line_2_pair<K> pair_t;
pair_t pair(&p2, &p1);
return pair.intersection_type() != pair_t::NO_INTERSECTION;
}
template <class K>
typename Ray_2_Line_2_pair<K>::Intersection_results
Ray_2_Line_2_pair<K>::intersection_type() const

View File

@ -51,16 +51,27 @@ protected:
};
template <class K>
inline bool do_intersect(
const typename K::Segment_2 &p1,
const typename K::Line_2 &p2,
const K&)
inline
typename K::Boolean
do_intersect(const typename K::Segment_2& s,
const typename K::Line_2& l,
const K& )
{
typedef Segment_2_Line_2_pair<K> pair_t;
pair_t pair(&p1, &p2);
pair_t pair(&s, &l);
return pair.intersection_type() != pair_t::NO_INTERSECTION;
}
template <class K>
inline
typename K::Boolean
do_intersect(const typename K::Line_2& l,
const typename K::Segment_2& s,
const K& k)
{
return internal::do_intersect(s, l, k);
}
template <class K>
typename CGAL::Intersection_traits
<K, typename K::Segment_2, typename K::Line_2>::result_type
@ -92,17 +103,6 @@ intersection(const typename K::Line_2 &line,
return internal::intersection(seg, line, k);
}
template <class K>
inline bool do_intersect(
const typename K::Line_2 &line,
const typename K::Segment_2 &seg,
const K& k)
{
return internal::do_intersect(seg, line, k);
}
template <class K>
typename Segment_2_Line_2_pair<K>::Intersection_results
Segment_2_Line_2_pair<K>::intersection_type() const
@ -156,7 +156,6 @@ Segment_2_Line_2_pair<K>::intersection_segment() const
CGAL_INTERSECTION_FUNCTION(Segment_2, Line_2, 2)
CGAL_DO_INTERSECT_FUNCTION(Segment_2, Line_2, 2)
} // namespace CGAL
} //namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_SEGMENT_2_LINE_2_H

View File

@ -55,24 +55,24 @@ protected:
template <class K>
inline
bool
do_intersect(const typename K::Line_2 &p1,
const typename K::Triangle_2 &p2,
typename K::Boolean
do_intersect(const typename K::Line_2& l,
const typename K::Triangle_2& tr,
const K&)
{
typedef Line_2_Triangle_2_pair<K> pair_t;
pair_t pair(&p1, &p2);
pair_t pair(&l, &tr);
return pair.intersection_type() != pair_t::NO_INTERSECTION;
}
template <class K>
inline
bool
do_intersect(const typename K::Triangle_2 &p2,
const typename K::Line_2 &p1,
typename K::Boolean
do_intersect(const typename K::Triangle_2& tr,
const typename K::Line_2& l,
const K& k)
{
return internal::do_intersect(p1, p2, k);
return internal::do_intersect(l, tr, k);
}
template <class K>
@ -190,6 +190,6 @@ intersection(const typename K::Triangle_2 &tr,
CGAL_INTERSECTION_FUNCTION(Line_2, Triangle_2, 2)
CGAL_DO_INTERSECT_FUNCTION(Line_2, Triangle_2, 2)
} //namespace CGAL
} // namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_LINE_2_TRIANGLE_2_H

View File

@ -28,34 +28,33 @@ namespace Intersections {
namespace internal {
template <class K>
inline bool
do_intersect(const typename K::Point_2 &pt1,
const typename K::Point_2 &pt2,
const K&)
inline
typename K::Boolean
do_intersect(const typename K::Point_2& pt1,
const typename K::Point_2& pt2,
const K& k)
{
return pt1 == pt2;
return k.equal_2_object()(pt1, pt2);
}
template <class K>
typename CGAL::Intersection_traits
<K, typename K::Point_2, typename K::Point_2>::result_type
intersection(const typename K::Point_2 &pt1,
const typename K::Point_2 &pt2,
const K&)
typename CGAL::Intersection_traits<K, typename K::Point_2, typename K::Point_2>::result_type
intersection(const typename K::Point_2& pt1,
const typename K::Point_2& pt2,
const K& k)
{
if (pt1 == pt2) {
if (k.equal_2_object()(pt1, pt2))
return intersection_return<typename K::Intersect_2, typename K::Point_2, typename K::Point_2>(pt1);
}
return intersection_return<typename K::Intersect_2, typename K::Point_2, typename K::Point_2>();
}
}// namespace internal
} // namespace internal
} // namespace Intersections
CGAL_INTERSECTION_FUNCTION_SELF(Point_2, 2)
CGAL_DO_INTERSECT_FUNCTION_SELF(Point_2, 2)
} // namespace CGAL
} //namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_POINT_2_POINT_2_H

View File

@ -30,9 +30,9 @@ namespace internal {
template <class K>
inline
bool
do_intersect(const typename K::Point_2 &pt,
const typename K::Ray_2 &ray,
typename K::Boolean
do_intersect(const typename K::Point_2& pt,
const typename K::Ray_2& ray,
const K&)
{
return ray.has_on(pt);
@ -41,9 +41,9 @@ do_intersect(const typename K::Point_2 &pt,
template <class K>
inline
bool
do_intersect(const typename K::Ray_2 &ray,
const typename K::Point_2 &pt,
typename K::Boolean
do_intersect(const typename K::Ray_2& ray,
const typename K::Point_2& pt,
const K&)
{
return ray.has_on(pt);
@ -51,8 +51,7 @@ do_intersect(const typename K::Ray_2 &ray,
template <class K>
typename CGAL::Intersection_traits
<K, typename K::Point_2, typename K::Ray_2>::result_type
typename CGAL::Intersection_traits<K, typename K::Point_2, typename K::Ray_2>::result_type
intersection(const typename K::Point_2 &pt,
const typename K::Ray_2 &ray,
const K& k)
@ -64,8 +63,7 @@ intersection(const typename K::Point_2 &pt,
}
template <class K>
typename CGAL::Intersection_traits
<K, typename K::Ray_2, typename K::Point_2>::result_type
typename CGAL::Intersection_traits<K, typename K::Ray_2, typename K::Point_2>::result_type
intersection(const typename K::Ray_2 &ray,
const typename K::Point_2 &pt,
const K& k)
@ -79,7 +77,6 @@ intersection(const typename K::Ray_2 &ray,
CGAL_INTERSECTION_FUNCTION(Point_2, Ray_2, 2)
CGAL_DO_INTERSECT_FUNCTION(Point_2, Ray_2, 2)
} // namespace CGAL
} //namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_POINT_2_RAY_2_H

View File

@ -30,7 +30,7 @@ namespace internal {
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Point_2 &pt,
const typename K::Segment_2 &seg,
const K&)
@ -40,7 +40,7 @@ do_intersect(const typename K::Point_2 &pt,
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Segment_2 &seg,
const typename K::Point_2 &pt,
const K&)
@ -77,10 +77,9 @@ intersection( const typename K::Segment_2 &seg,
} // namespace internal
} // namespace Intersections
CGAL_INTERSECTION_FUNCTION(Point_2, Segment_2, 2)
CGAL_DO_INTERSECT_FUNCTION(Point_2, Segment_2, 2)
} //namespace CGAL
} // namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_POINT_2_SEGMENT_2_H

View File

@ -50,8 +50,10 @@ protected:
};
template <class K>
inline bool do_intersect(const typename K::Point_2 &p1,
const typename K::Triangle_2 &p2,
inline
typename K::Boolean
do_intersect(const typename K::Point_2& p1,
const typename K::Triangle_2& p2,
const K&)
{
typedef Point_2_Triangle_2_pair<K> pair_t;
@ -60,8 +62,10 @@ inline bool do_intersect(const typename K::Point_2 &p1,
}
template <class K>
inline bool do_intersect(const typename K::Triangle_2 &p2,
const typename K::Point_2 &p1,
inline
typename K::Boolean
do_intersect(const typename K::Triangle_2& p2,
const typename K::Point_2& p1,
const K& k)
{
return internal::do_intersect(p1, p2, k);
@ -133,6 +137,6 @@ intersection(const typename K::Triangle_2 &tr,
CGAL_INTERSECTION_FUNCTION(Point_2, Triangle_2, 2)
CGAL_DO_INTERSECT_FUNCTION(Point_2, Triangle_2, 2)
} //namespace CGAL
} // namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_POINT_2_TRIANGLE_2_H

View File

@ -54,13 +54,14 @@ protected:
};
template <class K>
inline bool do_intersect(
const typename K::Ray_2 &p1,
const typename K::Ray_2 &p2,
inline
typename K::Boolean
do_intersect(const typename K::Ray_2& r1,
const typename K::Ray_2& r2,
const K&)
{
typedef Ray_2_Ray_2_pair<K> pair_t;
pair_t pair(&p1, &p2);
pair_t pair(&r1, &r2);
return pair.intersection_type() != pair_t::NO_INTERSECTION;
}
@ -252,7 +253,6 @@ intersection(const typename K::Ray_2 &ray1,
CGAL_INTERSECTION_FUNCTION_SELF(Ray_2, 2)
CGAL_DO_INTERSECT_FUNCTION_SELF(Ray_2, 2)
} // namespace CGAL
} //namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_RAY_2_RAY_2_H

View File

@ -54,21 +54,25 @@ protected:
};
template <class K>
inline bool do_intersect(const typename K::Ray_2 &p1,
const typename K::Segment_2 &p2,
inline
typename K::Boolean
do_intersect(const typename K::Ray_2& r,
const typename K::Segment_2& s,
const K&)
{
typedef Ray_2_Segment_2_pair<K> pair_t;
pair_t pair(&p1, &p2);
pair_t pair(&r, &s);
return pair.intersection_type() != pair_t::NO_INTERSECTION;
}
template <class K>
inline bool do_intersect(const typename K::Segment_2 &p2,
const typename K::Ray_2 &p1,
inline
typename K::Boolean
do_intersect(const typename K::Segment_2& s,
const typename K::Ray_2& r,
const K& k)
{
return internal::do_intersect(p1, p2, k);
return internal::do_intersect(r, s, k);
}
template <class K>
@ -265,6 +269,6 @@ intersection(const typename K::Segment_2 &seg,
CGAL_INTERSECTION_FUNCTION(Ray_2, Segment_2, 2)
CGAL_DO_INTERSECT_FUNCTION(Ray_2, Segment_2, 2)
} //namespace CGAL
} // namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_RAY_2_SEGMENT_2_H

View File

@ -165,26 +165,26 @@ intersection(const typename K::Triangle_2&tr,
template <class K>
inline bool do_intersect(
const typename K::Ray_2 &p1,
const typename K::Triangle_2 &p2,
inline
typename K::Boolean
do_intersect(const typename K::Ray_2& r,
const typename K::Triangle_2& tr,
const K&)
{
typedef Ray_2_Triangle_2_pair<K> pair_t;
pair_t pair(&p1, &p2);
pair_t pair(&r, &tr);
return pair.intersection_type() != pair_t::NO_INTERSECTION;
}
template <class K>
inline bool do_intersect(
const typename K::Triangle_2 &p1,
const typename K::Ray_2 &p2,
const K&)
inline
typename K::Boolean
do_intersect(const typename K::Triangle_2& tr,
const typename K::Ray_2& r,
const K& k)
{
typedef Ray_2_Triangle_2_pair<K> pair_t;
pair_t pair(&p2, &p1);
return pair.intersection_type() != pair_t::NO_INTERSECTION;
return do_intersect(r, tr, k);
}
} // namespace internal
@ -193,7 +193,6 @@ inline bool do_intersect(
CGAL_INTERSECTION_FUNCTION(Ray_2, Triangle_2, 2)
CGAL_DO_INTERSECT_FUNCTION(Ray_2, Triangle_2, 2)
} // namespace CGAL
} //namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_RAY_2_TRIANGLE_2_H

View File

@ -25,7 +25,6 @@
#include <CGAL/predicates_on_points_2.h>
#include <CGAL/Line_2.h>
#include <CGAL/Intersections_2/Line_2_Line_2.h>
#include <CGAL/Uncertain.h>
#include <CGAL/Intersection_traits_2.h>
namespace CGAL {
@ -326,7 +325,7 @@ do_intersect_with_info(const typename K::Segment_2 &seg1,
template <class K>
bool
typename K::Boolean
do_intersect(const typename K::Segment_2 &seg1,
const typename K::Segment_2 &seg2,
const K& k)
@ -492,6 +491,6 @@ intersection(const typename K::Segment_2 &seg1,
CGAL_INTERSECTION_FUNCTION_SELF(Segment_2, 2)
CGAL_DO_INTERSECT_FUNCTION_SELF(Segment_2, 2)
} //namespace CGAL
} // namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_SEGMENT_2_SEGMENT_2_H

View File

@ -52,19 +52,26 @@ protected:
};
template <class K>
inline bool do_intersect(
const typename K::Segment_2 &p1,
const typename K::Triangle_2 &p2,
inline
typename K::Boolean
do_intersect(const typename K::Segment_2& s,
const typename K::Triangle_2& tr,
const K&)
{
typedef Segment_2_Triangle_2_pair<K> pair_t;
pair_t pair(&p1, &p2);
pair_t pair(&s, &tr);
return pair.intersection_type() != pair_t::NO_INTERSECTION;
}
template <class K>
inline
typename K::Boolean
do_intersect(const typename K::Triangle_2& tr,
const typename K::Segment_2& s,
const K& k)
{
return do_intersect(s, tr, k);
}
template <class K>
typename Segment_2_Triangle_2_pair<K>::Intersection_results
@ -174,24 +181,12 @@ intersection(const typename K::Triangle_2&tr,
return internal::intersection(seg, tr, k);
}
template <class K>
inline bool do_intersect(
const typename K::Triangle_2 &p1,
const typename K::Segment_2 &p2,
const K&)
{
typedef Segment_2_Triangle_2_pair<K> pair_t;
pair_t pair(&p2, &p1);
return pair.intersection_type() != pair_t::NO_INTERSECTION;
}
} // namespace internal
} // namespace Intersections
CGAL_INTERSECTION_FUNCTION(Segment_2, Triangle_2, 2)
CGAL_DO_INTERSECT_FUNCTION(Segment_2, Triangle_2, 2)
} //namespace CGAL
} // namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_SEGMENT_2_TRIANGLE_2_H

View File

@ -22,8 +22,10 @@
#include <CGAL/Intersections_2/internal/Triangle_2_Triangle_2_intersection_impl.h>
namespace CGAL {
CGAL_DO_INTERSECT_FUNCTION_SELF(Triangle_2, 2)
CGAL_INTERSECTION_FUNCTION_SELF(Triangle_2, 2)
} // namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_TRIANGLE_2_TRIANGLE_2_H

View File

@ -14,7 +14,6 @@
//
// Author(s) : Geert-Jan Giezeman
#ifndef CGAL_INTERSECTIONS_2_INTERNAL_STRAIGHT_2_H
#define CGAL_INTERSECTIONS_2_INTERNAL_STRAIGHT_2_H
@ -346,6 +345,6 @@ collinear_order(typename K::Point_2 const &pt1, typename K::Point_2 const & pt2)
} // namespace internal
} // namespace Intersections
} //namespace CGAL
} // namespace CGAL
#endif
#endif // CGAL_INTERSECTIONS_2_INTERNAL_STRAIGHT_2_H

View File

@ -23,15 +23,15 @@ namespace Intersections {
namespace internal {
template <class K>
bool intersection_test_vertex(const typename K::Point_2 * P1,
const typename K::Point_2 * Q1,
const typename K::Point_2 * R1,
const typename K::Point_2 * P2,
const typename K::Point_2 * Q2,
const typename K::Point_2 * R2,
const K & k ){
typename K::Boolean
intersection_test_vertex(const typename K::Point_2* P1,
const typename K::Point_2* Q1,
const typename K::Point_2* R1,
const typename K::Point_2* P2,
const typename K::Point_2* Q2,
const typename K::Point_2* R2,
const K& k)
{
CGAL_kernel_precondition( k.orientation_2_object() (*P1,*Q1,*R1)
== POSITIVE);
CGAL_kernel_precondition( k.orientation_2_object() (*P2,*Q2,*R2)
@ -65,16 +65,15 @@ bool intersection_test_vertex(const typename K::Point_2 * P1,
template <class K>
bool intersection_test_edge(const typename K::Point_2 * P1,
const typename K::Point_2 * Q1,
const typename K::Point_2 * R1,
const typename K::Point_2 * P2,
const typename K::Point_2 *
CGAL_kernel_precondition_code(Q2),
const typename K::Point_2 * R2,
const K & k ){
typename K::Boolean
intersection_test_edge(const typename K::Point_2* P1,
const typename K::Point_2* Q1,
const typename K::Point_2* R1,
const typename K::Point_2* P2,
const typename K::Point_2* CGAL_kernel_precondition_code(Q2),
const typename K::Point_2* R2,
const K& k)
{
CGAL_kernel_precondition( k.orientation_2_object() (*P1,*Q1,*R1)
== POSITIVE);
CGAL_kernel_precondition( k.orientation_2_object() (*P2,*Q2,*R2)
@ -99,12 +98,12 @@ bool intersection_test_edge(const typename K::Point_2 * P1,
}
template <class K>
bool do_intersect(const typename K::Triangle_2 &t1,
const typename K::Triangle_2 &t2,
const K & k ){
typename K::Boolean
do_intersect(const typename K::Triangle_2& t1,
const typename K::Triangle_2& t2,
const K& k)
{
CGAL_kernel_precondition( ! k.is_degenerate_2_object() (t1) );
CGAL_kernel_precondition( ! k.is_degenerate_2_object() (t2) );
@ -164,6 +163,6 @@ bool do_intersect(const typename K::Triangle_2 &t1,
} // namespace internal
} // namespace Intersections
} //namespace CGAL
} // namespace CGAL
#endif //CGAL_TRIANGLE_2_TRIANGLE_2_DO_INTERSECT_H
#endif // CGAL_TRIANGLE_2_TRIANGLE_2_DO_INTERSECT_H

View File

@ -64,7 +64,7 @@ namespace Intersections {
namespace internal {
template <class K>
bool
typename K::Boolean
inline
do_intersect(const CGAL::Bbox_3& c,
const CGAL::Bbox_3& bbox,

View File

@ -30,14 +30,16 @@
namespace CGAL {
template<typename K>
bool do_intersect(const CGAL::Bbox_3& box,
typename K::Boolean
do_intersect(const CGAL::Bbox_3& box,
const Iso_cuboid_3<K>& ic)
{
return K().do_intersect_3_object()(box, ic);
}
template<typename K>
bool do_intersect(const Iso_cuboid_3<K>& ic,
typename K::Boolean
do_intersect(const Iso_cuboid_3<K>& ic,
const CGAL::Bbox_3& box)
{
return K().do_intersect_3_object()(ic, box);

View File

@ -24,14 +24,16 @@
namespace CGAL {
template<typename K>
bool do_intersect(const CGAL::Bbox_3& box,
typename K::Boolean
do_intersect(const CGAL::Bbox_3& box,
const Line_3<K>& l)
{
return K().do_intersect_3_object()(box, l);
}
template<typename K>
bool do_intersect(const Line_3<K>& l,
typename K::Boolean
do_intersect(const Line_3<K>& l,
const CGAL::Bbox_3& box)
{
return K().do_intersect_3_object()(l, box);

View File

@ -30,14 +30,16 @@
namespace CGAL {
template<typename K>
bool do_intersect(const CGAL::Bbox_3& box,
typename K::Boolean
do_intersect(const CGAL::Bbox_3& box,
const Plane_3<K>& pl)
{
return K().do_intersect_3_object()(box, pl);
}
template<typename K>
bool do_intersect(const Plane_3<K>& pl,
typename K::Boolean
do_intersect(const Plane_3<K>& pl,
const CGAL::Bbox_3& box)
{
return K().do_intersect_3_object()(pl, box);

View File

@ -30,7 +30,8 @@
namespace CGAL {
template<typename K>
bool do_intersect(const CGAL::Bbox_3& box,
typename K::Boolean
do_intersect(const CGAL::Bbox_3& box,
const Point_3<K>& p)
{
Point_3<K> bl(box.xmin(), box.ymin(), box.zmin()),
@ -40,7 +41,8 @@ bool do_intersect(const CGAL::Bbox_3& box,
}
template<typename K>
bool do_intersect(const Point_3<K>& a,
typename K::Boolean
do_intersect(const Point_3<K>& a,
const CGAL::Bbox_3& b)
{
return do_intersect(b,a);

View File

@ -30,14 +30,16 @@
namespace CGAL {
template<typename K>
bool do_intersect(const CGAL::Bbox_3& box,
typename K::Boolean
do_intersect(const CGAL::Bbox_3& box,
const Ray_3<K>& r)
{
return K().do_intersect_3_object()(box, r);
}
template<typename K>
bool do_intersect(const Ray_3<K>& r,
typename K::Boolean
do_intersect(const Ray_3<K>& r,
const CGAL::Bbox_3& box)
{
return K().do_intersect_3_object()(r, box);

View File

@ -30,14 +30,16 @@
namespace CGAL {
template<typename K>
bool do_intersect(const CGAL::Bbox_3& box,
typename K::Boolean
do_intersect(const CGAL::Bbox_3& box,
const Segment_3<K>& s)
{
return K().do_intersect_3_object()(box, s);
}
template<typename K>
bool do_intersect(const Segment_3<K>& s,
typename K::Boolean
do_intersect(const Segment_3<K>& s,
const CGAL::Bbox_3& box)
{
return K().do_intersect_3_object()(s, box);

View File

@ -28,14 +28,16 @@
namespace CGAL {
template<typename K>
bool do_intersect(const CGAL::Bbox_3& box,
typename K::Boolean
do_intersect(const CGAL::Bbox_3& box,
const Sphere_3<K>& s)
{
return K().do_intersect_3_object()(box, s);
}
template<typename K>
bool do_intersect(const Sphere_3<K>& s,
typename K::Boolean
do_intersect(const Sphere_3<K>& s,
const CGAL::Bbox_3& box)
{
return K().do_intersect_3_object()(s, box);

View File

@ -28,14 +28,16 @@
namespace CGAL {
template<typename K>
bool do_intersect(const CGAL::Bbox_3& box,
typename K::Boolean
do_intersect(const CGAL::Bbox_3& box,
const Tetrahedron_3<K>& t)
{
return K().do_intersect_3_object()(box, t);
}
template<typename K>
bool do_intersect(const Tetrahedron_3<K>& t,
typename K::Boolean
do_intersect(const Tetrahedron_3<K>& t,
const CGAL::Bbox_3& box)
{
return K().do_intersect_3_object()(t, box);

View File

@ -29,14 +29,16 @@
namespace CGAL {
template<typename K>
bool do_intersect(const CGAL::Bbox_3& box,
typename K::Boolean
do_intersect(const CGAL::Bbox_3& box,
const Triangle_3<K>& tr)
{
return K().do_intersect_3_object()(box, tr);
}
template<typename K>
bool do_intersect(const Triangle_3<K>& tr,
typename K::Boolean
do_intersect(const Triangle_3<K>& tr,
const CGAL::Bbox_3& box)
{
return K().do_intersect_3_object()(tr, box);

View File

@ -34,4 +34,4 @@ CGAL_INTERSECTION_FUNCTION(Iso_cuboid_3, Triangle_3, 3)
} // namespace CGAL
#endif // CGAL_INTERSECTIONS_3_BBOX_3_TRIANGLE_3_H
#endif // CGAL_INTERSECTIONS_3_ISO_CUBOID_3_TRIANGLE_3_H

View File

@ -30,7 +30,8 @@
namespace CGAL {
template <class K>
inline bool
inline
typename K::Boolean
do_intersect(const Plane_3<K>& plane1,
const Plane_3<K>& plane2,
const Plane_3<K>& plane3)

View File

@ -23,7 +23,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const CGAL::Bbox_3& bb,
typename K::Boolean
do_intersect(const CGAL::Bbox_3& bb,
const typename K::Iso_cuboid_3& ic,
const K& /* k */)
{
@ -38,7 +39,8 @@ bool do_intersect(const CGAL::Bbox_3& bb,
}
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic,
typename K::Boolean
do_intersect(const typename K::Iso_cuboid_3& ic,
const CGAL::Bbox_3& bb,
const K& k)
{

View File

@ -25,9 +25,9 @@ namespace CGAL {
namespace Intersections {
namespace internal {
template <typename LFT, typename BFT>
template <typename K, typename LFT, typename BFT>
inline
bool
typename K::Boolean
bbox_line_do_intersect_aux(const LFT px, const LFT py, const LFT pz,
const LFT vx, const LFT vy, const LFT vz,
const BFT bxmin, const BFT bymin, const BFT bzmin,
@ -135,7 +135,8 @@ bbox_line_do_intersect_aux(const LFT px, const LFT py, const LFT pz,
}
template <class K>
bool do_intersect(const typename K::Line_3& line,
typename K::Boolean
do_intersect(const typename K::Line_3& line,
const CGAL::Bbox_3& bbox,
const K&)
{
@ -145,14 +146,15 @@ bool do_intersect(const typename K::Line_3& line,
const Point_3& point = line.point();
const Vector_3& v = line.to_vector();
return bbox_line_do_intersect_aux(point.x(), point.y(), point.z(),
return bbox_line_do_intersect_aux<K>(point.x(), point.y(), point.z(),
v.x(), v.y(), v.z(),
bbox.xmin(), bbox.ymin(), bbox.zmin(),
bbox.xmax(), bbox.ymax(), bbox.zmax());
}
template <class K>
bool do_intersect(const CGAL::Bbox_3& bbox,
typename K::Boolean
do_intersect(const CGAL::Bbox_3& bbox,
const typename K::Line_3& line,
const K& k)
{

View File

@ -22,7 +22,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Plane_3& plane,
typename K::Boolean
do_intersect(const typename K::Plane_3& plane,
const Bbox_3& bbox,
const K& k)
{
@ -30,7 +31,8 @@ bool do_intersect(const typename K::Plane_3& plane,
}
template <class K>
bool do_intersect(const Bbox_3& bbox,
typename K::Boolean
do_intersect(const Bbox_3& bbox,
const typename K::Plane_3& plane,
const K& k)
{

View File

@ -26,7 +26,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Ray_3& ray,
typename K::Boolean
do_intersect(const typename K::Ray_3& ray,
const CGAL::Bbox_3& bbox,
const K&)
{
@ -49,7 +50,8 @@ bool do_intersect(const typename K::Ray_3& ray,
}
template <class K>
bool do_intersect(const CGAL::Bbox_3& bbox,
typename K::Boolean
do_intersect(const CGAL::Bbox_3& bbox,
const typename K::Ray_3& ray,
const K& k)
{

View File

@ -224,10 +224,10 @@ do_intersect_bbox_segment_aux(const FT& px, const FT& py, const FT& pz,
CGAL_assertion(! is_negative(dmin));
CGAL_assertion(! is_negative(dmax));
if(bounded_0) {
CGAL_assertion_code(if(bounded_0) {)
CGAL_assertion(! is_negative(tmin));
CGAL_assertion(! is_negative(tmax));
}
CGAL_assertion_code(})
// -----------------------------------
// treat y coord
@ -365,11 +365,10 @@ do_intersect_bbox_segment_aux(const FT& px, const FT& py, const FT& pz,
CGAL_assertion(! is_negative(dzmin));
CGAL_assertion(! is_negative(dzmax));
if(bounded_0)
{
CGAL_assertion_code(if(bounded_0) {)
CGAL_assertion(! is_negative(tzmin));
CGAL_assertion(! is_negative(tzmax));
}
CGAL_assertion_code(})
typedef Do_intersect_bbox_segment_aux_is_greater<CFT, bounded_0, use_static_filters> Is_greater;
typedef typename Is_greater::result_type Is_greater_value;
@ -454,8 +453,7 @@ template <typename FT,
bool use_static_filters>
inline
typename Do_intersect_bbox_segment_aux_is_greater<FT, bounded_0, use_static_filters>::result_type
do_intersect_bbox_segment_aux(
const FT& px, const FT& py, const FT& pz,
do_intersect_bbox_segment_aux(const FT& px, const FT& py, const FT& pz,
const FT& qx, const FT& qy, const FT& qz,
const Bbox_3& bb)
@ -467,7 +465,8 @@ do_intersect_bbox_segment_aux(
}
template <class K>
bool do_intersect(const typename K::Segment_3& segment,
typename K::Boolean
do_intersect(const typename K::Segment_3& segment,
const CGAL::Bbox_3& bbox,
const K&)
{
@ -483,7 +482,8 @@ bool do_intersect(const typename K::Segment_3& segment,
}
template <class K>
bool do_intersect(const CGAL::Bbox_3& bbox,
typename K::Boolean
do_intersect(const CGAL::Bbox_3& bbox,
const typename K::Segment_3& segment,
const K& k)
{

View File

@ -23,7 +23,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Sphere_3& sphere,
typename K::Boolean
do_intersect(const typename K::Sphere_3& sphere,
const CGAL::Bbox_3& bbox,
const K& k)
{
@ -34,7 +35,8 @@ bool do_intersect(const typename K::Sphere_3& sphere,
}
template <class K>
bool do_intersect(const CGAL::Bbox_3& bbox,
typename K::Boolean
do_intersect(const CGAL::Bbox_3& bbox,
const typename K::Sphere_3& sphere,
const K& k)
{

View File

@ -24,7 +24,9 @@ namespace Intersections {
namespace internal {
template <class K>
inline typename K::Boolean do_intersect(const CGAL::Bbox_3& aabb,
inline
typename K::Boolean
do_intersect(const CGAL::Bbox_3& aabb,
const typename K::Tetrahedron_3& tet,
const K& k)
{
@ -57,7 +59,9 @@ inline typename K::Boolean do_intersect(const CGAL::Bbox_3& aabb,
}
template <class K>
inline typename K::Boolean do_intersect(const typename K::Tetrahedron_3& tet,
inline
typename K::Boolean
do_intersect(const typename K::Tetrahedron_3& tet,
const CGAL::Bbox_3& bb,
const K &k)
{

View File

@ -397,7 +397,8 @@ do_intersect_bbox_or_iso_cuboid_impl(const std::array< std::array<FT, 3>, 3>& tr
}
template <class K, class Box3>
bool do_intersect_bbox_or_iso_cuboid(const typename K::Triangle_3& a_triangle,
typename K::Boolean
do_intersect_bbox_or_iso_cuboid(const typename K::Triangle_3& a_triangle,
const Box3& a_bbox,
const K& k)
{
@ -423,12 +424,12 @@ bool do_intersect_bbox_or_iso_cuboid(const typename K::Triangle_3& a_triangle,
{ a_triangle[2][0], a_triangle[2][1], a_triangle[2][2] }
}};
// exception will be thrown in case the output is indeterminate
return do_intersect_bbox_or_iso_cuboid_impl<FT>(triangle, a_bbox, do_axis_intersect_aux_impl);
}
template <class K>
bool do_intersect(const typename K::Triangle_3& triangle,
typename K::Boolean
do_intersect(const typename K::Triangle_3& triangle,
const CGAL::Bbox_3& bbox,
const K& k)
{
@ -436,7 +437,8 @@ bool do_intersect(const typename K::Triangle_3& triangle,
}
template <class K>
bool do_intersect(const CGAL::Bbox_3& bbox,
typename K::Boolean
do_intersect(const CGAL::Bbox_3& bbox,
const typename K::Triangle_3& triangle,
const K& k)
{

View File

@ -18,7 +18,8 @@ namespace Intersections {
namespace internal {
template <class K>
inline bool
inline
typename K::Boolean
do_intersect(const typename K::Iso_cuboid_3& icub1,
const typename K::Iso_cuboid_3& icub2,
const K&)

View File

@ -23,7 +23,8 @@ namespace Intersections {
namespace internal {
template <class K>
inline bool
inline
typename K::Boolean
do_intersect(const typename K::Line_3& line,
const typename K::Iso_cuboid_3& ic,
const K&)
@ -34,14 +35,15 @@ do_intersect(const typename K::Line_3& line,
const Point_3& point = line.point();
const Vector_3& v = line.to_vector();
return bbox_line_do_intersect_aux(point.x(), point.y(), point.z(),
return bbox_line_do_intersect_aux<K>(point.x(), point.y(), point.z(),
v.x(), v.y(), v.z(),
(ic.min)().x(), (ic.min)().y(), (ic.min)().z(),
(ic.max)().x(), (ic.max)().y(), (ic.max)().z());
}
template <class K>
inline bool
inline
typename K::Boolean
do_intersect(const typename K::Iso_cuboid_3& ic,
const typename K::Line_3& l,
const K& k)

View File

@ -79,7 +79,7 @@ Uncertain<bool> get_min_max(const typename K::Vector_3& p,
}
template <class K, class Box3> // Iso_cuboid_3 or Bbox_3
bool do_intersect_plane_box(const typename K::Plane_3& plane,
typename K::Boolean do_intersect_plane_box(const typename K::Plane_3& plane,
const Box3& bbox,
const K&)
{
@ -87,7 +87,8 @@ bool do_intersect_plane_box(const typename K::Plane_3& plane,
Point_3 p_max, p_min;
Uncertain<bool> b = get_min_max<K>(plane.orthogonal_vector(), bbox, p_min, p_max);
if(is_certain(b)){
if(is_certain(b))
{
return ! (plane.oriented_side(p_max) == ON_NEGATIVE_SIDE ||
plane.oriented_side(p_min) == ON_POSITIVE_SIDE);
}
@ -114,7 +115,8 @@ bool do_intersect_plane_box(const typename K::Plane_3& plane,
}
template <class K>
bool do_intersect(const typename K::Plane_3& plane,
typename K::Boolean
do_intersect(const typename K::Plane_3& plane,
const typename K::Iso_cuboid_3& bbox,
const K& k)
{
@ -122,7 +124,8 @@ bool do_intersect(const typename K::Plane_3& plane,
}
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& bbox,
typename K::Boolean
do_intersect(const typename K::Iso_cuboid_3& bbox,
const typename K::Plane_3& plane,
const K& k)
{

View File

@ -19,7 +19,7 @@ namespace internal {
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Point_3& pt,
const typename K::Iso_cuboid_3& iso,
const K& k)
@ -29,7 +29,7 @@ do_intersect(const typename K::Point_3& pt,
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Iso_cuboid_3& iso,
const typename K::Point_3& pt,
const K& k)

View File

@ -27,7 +27,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Ray_3& ray,
typename K::Boolean
do_intersect(const typename K::Ray_3& ray,
const typename K::Iso_cuboid_3& ic,
const K&)
{
@ -51,9 +52,11 @@ bool do_intersect(const typename K::Ray_3& ray,
}
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic,
typename K::Boolean
do_intersect(const typename K::Iso_cuboid_3& ic,
const typename K::Ray_3& ray,
const K& k) {
const K& k)
{
return do_intersect(ray, ic, k);
}

View File

@ -24,7 +24,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Segment_3& seg,
typename K::Boolean
do_intersect(const typename K::Segment_3& seg,
const typename K::Iso_cuboid_3& ic,
const K&)
{
@ -48,7 +49,8 @@ bool do_intersect(const typename K::Segment_3& seg,
}
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic,
typename K::Boolean
do_intersect(const typename K::Iso_cuboid_3& ic,
const typename K::Segment_3& seg,
const K& k)
{

View File

@ -22,7 +22,8 @@ namespace Intersections {
namespace internal {
template <class K, class BFT> // Iso_cuboid_3 or Bbox_3
bool do_intersect_sphere_box_3(const typename K::Sphere_3& sphere,
typename K::Boolean
do_intersect_sphere_box_3(const typename K::Sphere_3& sphere,
const BFT bxmin, const BFT bymin, const BFT bzmin,
const BFT bxmax, const BFT bymax, const BFT bzmax,
const K&)
@ -94,7 +95,8 @@ bool do_intersect_sphere_box_3(const typename K::Sphere_3& sphere,
}
template <class K>
bool do_intersect(const typename K::Sphere_3& sphere,
typename K::Boolean
do_intersect(const typename K::Sphere_3& sphere,
const typename K::Iso_cuboid_3& ic,
const K& k)
{
@ -105,7 +107,8 @@ bool do_intersect(const typename K::Sphere_3& sphere,
}
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic,
typename K::Boolean
do_intersect(const typename K::Iso_cuboid_3& ic,
const typename K::Sphere_3& sphere,
const K& k)
{

View File

@ -21,7 +21,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Triangle_3& triangle,
typename K::Boolean
do_intersect(const typename K::Triangle_3& triangle,
const typename K::Iso_cuboid_3& bbox,
const K& k)
{
@ -29,7 +30,8 @@ bool do_intersect(const typename K::Triangle_3& triangle,
}
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& bbox,
typename K::Boolean
do_intersect(const typename K::Iso_cuboid_3& bbox,
const typename K::Triangle_3& triangle,
const K& k)
{
@ -38,9 +40,6 @@ bool do_intersect(const typename K::Iso_cuboid_3& bbox,
} // namespace internal
} // namespace Intersections
} // namespace CGAL
#endif // CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_TRIANGLE_3_DO_INTERSECT_H

View File

@ -18,7 +18,7 @@ namespace Intersections {
namespace internal {
template <class K>
bool
typename K::Boolean
do_intersect(const typename K::Line_3& l1,
const typename K::Line_3& l2,
const K& k)

View File

@ -21,7 +21,7 @@ namespace Intersections {
namespace internal {
template <class K>
bool
typename K::Boolean
do_intersect(const typename K::Plane_3& plane,
const typename K::Line_3& line,
const K&)
@ -48,7 +48,7 @@ do_intersect(const typename K::Plane_3& plane,
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Line_3& line,
const typename K::Plane_3& plane,
const K& k)

View File

@ -18,7 +18,7 @@ namespace Intersections {
namespace internal {
template <class K>
inline bool
inline typename K::Boolean
do_intersect(const typename K::Point_3& pt,
const typename K::Line_3& line,
const K& k)
@ -27,7 +27,7 @@ do_intersect(const typename K::Point_3& pt,
}
template <class K>
inline bool
inline typename K::Boolean
do_intersect(const typename K::Line_3& line,
const typename K::Point_3& pt,
const K& k)

View File

@ -23,7 +23,7 @@ namespace internal {
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Line_3& l,
const typename K::Ray_3& r,
const K& k)
@ -47,7 +47,7 @@ do_intersect(const typename K::Line_3& l,
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Ray_3& r,
const typename K::Line_3& l,
const K& k)

View File

@ -24,7 +24,7 @@ namespace internal {
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Line_3& l,
const typename K::Segment_3& s,
const K& k)
@ -52,7 +52,7 @@ do_intersect(const typename K::Line_3& l,
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Segment_3& s,
const typename K::Line_3& l,
const K& k)

View File

@ -21,7 +21,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Triangle_3& t,
typename K::Boolean
do_intersect(const typename K::Triangle_3& t,
const typename K::Line_3& l,
const K& k)
{
@ -73,7 +74,8 @@ bool do_intersect(const typename K::Triangle_3& t,
template <class K>
inline
bool do_intersect(const typename K::Line_3& l,
typename K::Boolean
do_intersect(const typename K::Line_3& l,
const typename K::Triangle_3& t,
const K& k)
{

View File

@ -23,7 +23,7 @@ namespace Intersections {
namespace internal {
template <class K>
inline bool
inline typename K::Boolean
do_intersect(const typename K::Plane_3& plane1,
const typename K::Plane_3& plane2,
const typename K::Plane_3& plane3,

View File

@ -20,7 +20,7 @@ namespace Intersections {
namespace internal {
template <class K>
inline bool
inline typename K::Boolean
do_intersect(const typename K::Plane_3& plane1,
const typename K::Plane_3& plane2,
const K&)

View File

@ -18,7 +18,7 @@ namespace Intersections {
namespace internal {
template <class K>
inline bool
inline typename K::Boolean
do_intersect(const typename K::Point_3& pt,
const typename K::Plane_3& plane,
const K& k)
@ -27,7 +27,7 @@ do_intersect(const typename K::Point_3& pt,
}
template <class K>
inline bool
inline typename K::Boolean
do_intersect(const typename K::Plane_3& plane,
const typename K::Point_3& pt,
const K& k)

View File

@ -25,7 +25,7 @@ namespace Intersections {
namespace internal {
template <class K>
bool
typename K::Boolean
do_intersect(const typename K::Plane_3& plane,
const typename K::Ray_3& ray,
const K& k)
@ -40,7 +40,7 @@ do_intersect(const typename K::Plane_3& plane,
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Ray_3& ray,
const typename K::Plane_3& plane,
const K& k)

View File

@ -20,7 +20,7 @@ namespace Intersections {
namespace internal {
template <class K>
bool
typename K::Boolean
do_intersect(const typename K::Plane_3& plane,
const typename K::Segment_3& seg,
const K&)
@ -41,7 +41,7 @@ do_intersect(const typename K::Plane_3& plane,
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Segment_3& seg,
const typename K::Plane_3& plane,
const K& k)

View File

@ -21,7 +21,7 @@ namespace internal {
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Plane_3& p,
const typename K::Sphere_3& s,
const K&)
@ -37,7 +37,7 @@ do_intersect(const typename K::Plane_3& p,
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Sphere_3& s,
const typename K::Plane_3& p,
const K&)

View File

@ -21,7 +21,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Triangle_3& t,
typename K::Boolean
do_intersect(const typename K::Triangle_3& t,
const typename K::Plane_3& h,
const K& k)
{
@ -49,7 +50,8 @@ bool do_intersect(const typename K::Triangle_3& t,
template <class K>
inline
bool do_intersect(const typename K::Plane_3& h,
typename K::Boolean
do_intersect(const typename K::Plane_3& h,
const typename K::Triangle_3& t,
const K& k)
{

View File

@ -19,7 +19,7 @@ namespace internal {
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Point_3& pt,
const typename K::Ray_3& ray,
const K& k)
@ -29,7 +29,7 @@ do_intersect(const typename K::Point_3& pt,
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Ray_3& ray,
const typename K::Point_3& pt,
const K& k)
@ -39,7 +39,7 @@ do_intersect(const typename K::Ray_3& ray,
template <class K>
bool
typename K::Boolean
Ray_3_has_on_collinear_Point_3(const typename K::Ray_3& r,
const typename K::Point_3& p,
const K& k)

View File

@ -19,7 +19,7 @@ namespace internal {
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Point_3& pt,
const typename K::Segment_3& seg,
const K& k)
@ -29,7 +29,7 @@ do_intersect(const typename K::Point_3& pt,
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Segment_3& seg,
const typename K::Point_3& pt,
const K& k)

View File

@ -19,7 +19,7 @@ namespace internal {
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Point_3& pt,
const typename K::Sphere_3& sphere,
const K& k)
@ -29,7 +29,7 @@ do_intersect(const typename K::Point_3& pt,
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Sphere_3& sphere,
const typename K::Point_3& pt,
const K& k)

View File

@ -19,7 +19,7 @@ namespace internal {
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Point_3& pt,
const typename K::Tetrahedron_3& tetrahedron,
const K& k)
@ -29,7 +29,7 @@ do_intersect(const typename K::Point_3& pt,
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Tetrahedron_3& tetrahedron,
const typename K::Point_3& pt,
const K& k)

View File

@ -21,7 +21,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Triangle_3& t,
typename K::Boolean
do_intersect(const typename K::Triangle_3& t,
const typename K::Point_3& p,
const K& k)
{
@ -68,7 +69,8 @@ bool do_intersect(const typename K::Triangle_3& t,
}
template <class K>
bool do_intersect(const typename K::Point_3& p,
typename K::Boolean
do_intersect(const typename K::Point_3& p,
const typename K::Triangle_3& t,
const K& k)
{

View File

@ -24,7 +24,7 @@ namespace internal {
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Ray_3& r1,
const typename K::Ray_3& r2,
const K& k)

View File

@ -24,7 +24,7 @@ namespace internal {
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Segment_3& s,
const typename K::Ray_3& r,
const K& k)
@ -56,7 +56,7 @@ do_intersect(const typename K::Segment_3& s,
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Ray_3& r,
const typename K::Segment_3& s,
const K& k)

View File

@ -328,7 +328,8 @@ do_intersect(const typename K::Triangle_3& t,
}
template <class K>
bool do_intersect(const typename K::Triangle_3& t,
typename K::Boolean
do_intersect(const typename K::Triangle_3& t,
const typename K::Ray_3& r,
const K& k)
{
@ -337,7 +338,8 @@ bool do_intersect(const typename K::Triangle_3& t,
template <class K>
inline
bool do_intersect(const typename K::Ray_3& r,
typename K::Boolean
do_intersect(const typename K::Ray_3& r,
const typename K::Triangle_3& t,
const K& k)
{

View File

@ -23,7 +23,7 @@ namespace internal {
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Segment_3& s1,
const typename K::Segment_3& s2,
const K& k)

View File

@ -25,7 +25,8 @@ bool do_intersect_coplanar(const typename K::Point_3& A,
const typename K::Point_3& B,
const typename K::Point_3& C,
const typename K::Point_3& p,
const typename K::Point_3& q, const K& k)
const typename K::Point_3& q,
const K& k)
{
typedef typename K::Point_3 Point_3;
@ -173,7 +174,8 @@ bool do_intersect_coplanar(const typename K::Triangle_3& t,
}
template <class K>
bool do_intersect(const typename K::Triangle_3& t,
typename K::Boolean
do_intersect(const typename K::Triangle_3& t,
const typename K::Segment_3& s,
const K& k)
{
@ -269,7 +271,8 @@ bool do_intersect(const typename K::Triangle_3& t,
template <class K>
inline
bool do_intersect(const typename K::Segment_3& s,
typename K::Boolean
do_intersect(const typename K::Segment_3& s,
const typename K::Triangle_3& t,
const K& k)
{

View File

@ -21,7 +21,7 @@ namespace internal {
template <class K>
inline
bool
typename K::Boolean
do_intersect(const typename K::Sphere_3& s1,
const typename K::Sphere_3& s2,
const K& k)

View File

@ -22,7 +22,8 @@ namespace Intersections {
namespace internal {
template <class K>
bool _intersection_test_vertex(const typename K::Point_3* p,
typename K::Boolean
_intersection_test_vertex(const typename K::Point_3* p,
const typename K::Point_3* q,
const typename K::Point_3* r,
const typename K::Point_3* a,
@ -64,7 +65,8 @@ bool _intersection_test_vertex(const typename K::Point_3* p,
}
template <class K>
bool _intersection_test_edge(const typename K::Point_3* p,
typename K::Boolean
_intersection_test_edge(const typename K::Point_3* p,
const typename K::Point_3* q,
const typename K::Point_3* r,
const typename K::Point_3* a,
@ -97,7 +99,8 @@ bool _intersection_test_edge(const typename K::Point_3* p,
}
template <class K>
bool do_intersect_coplanar(const typename K::Triangle_3& t1,
typename K::Boolean
do_intersect_coplanar(const typename K::Triangle_3& t1,
const typename K::Triangle_3& t2,
const K& k)
{

View File

@ -11,8 +11,6 @@
// Author(s) : Stephane Tayeb
//
#include <string>
#include <CGAL/config.h>
#if defined(BOOST_MSVC)
@ -22,17 +20,19 @@
// leda_rational, or Gmpq, or Quotient<MP_float>
typedef CGAL::Exact_rational Rational;
#include <CGAL/Cartesian.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Timer.h>
#include <CGAL/Kernel_traits.h>
#include <iomanip>
#include <CGAL/intersection_3.h>
#include <boost/math/special_functions/next.hpp> // for nextafter
#include <iomanip>
#include <string>
double random_in(const double a,
const double b)

View File

@ -20,6 +20,7 @@
#ifndef CGAL_KERNEL_FUNCTION_OBJECTS_H
#define CGAL_KERNEL_FUNCTION_OBJECTS_H
#include <CGAL/tags.h>
#include <CGAL/Origin.h>
#include <CGAL/Bbox_2.h>
#include <CGAL/Bbox_3.h>
@ -30,7 +31,6 @@
#include <CGAL/Kernel/Return_base_tag.h>
#include <CGAL/Kernel/global_functions_3.h>
#include <cmath> // for Compute_dihedral_angle
namespace CGAL {
@ -736,7 +736,8 @@ namespace CommonKernelFunctors {
typedef Comparison_result result_type;
result_type operator()(const Weighted_point_3 & p,
Needs_FT<result_type>
operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const Weighted_point_3 & s,
@ -750,7 +751,8 @@ namespace CommonKernelFunctors {
w);
}
result_type operator()(const Weighted_point_3 & p,
Needs_FT<result_type>
operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q,
const Weighted_point_3 & r,
const FT& w) const
@ -762,7 +764,8 @@ namespace CommonKernelFunctors {
w);
}
result_type operator()(const Weighted_point_3 & p,
Needs_FT<result_type>
operator()(const Weighted_point_3 & p,
const Weighted_point_3 & q,
const FT& w) const
{
@ -817,17 +820,18 @@ namespace CommonKernelFunctors {
typedef typename K::Comparison_result result_type;
template <class T1, class T2>
result_type
Needs_FT<result_type>
operator()(const T1& p, const T2& q, const FT& d2) const
{
return CGAL::compare(squared_distance(p, q), d2);
return CGAL::compare(internal::squared_distance(p, q, K()), d2);
}
template <class T1, class T2, class T3, class T4>
result_type
Needs_FT<result_type>
operator()(const T1& p, const T2& q, const T3& r, const T4& s) const
{
return CGAL::compare(squared_distance(p, q), squared_distance(r, s));
return CGAL::compare(internal::squared_distance(p, q, K()),
internal::squared_distance(r, s, K()));
}
};
@ -839,17 +843,18 @@ namespace CommonKernelFunctors {
typedef typename K::Comparison_result result_type;
template <class T1, class T2>
result_type
Needs_FT<result_type>
operator()(const T1& p, const T2& q, const FT& d2) const
{
return CGAL::compare(squared_distance(p, q), d2);
return CGAL::compare(internal::squared_distance(p, q, K()), d2);
}
template <class T1, class T2, class T3, class T4>
result_type
Needs_FT<result_type>
operator()(const T1& p, const T2& q, const T3& r, const T4& s) const
{
return CGAL::compare(squared_distance(p, q), squared_distance(r, s));
return CGAL::compare(internal::squared_distance(p, q, K()),
internal::squared_distance(r, s, K()));
}
};
@ -3018,10 +3023,11 @@ namespace CommonKernelFunctors {
public:
typedef typename K::Boolean result_type;
// Needs_FT because Line/Line (and variations) as well as Circle_2/X compute intersections
template <class T1, class T2>
result_type
Needs_FT<result_type>
operator()(const T1& t1, const T2& t2) const
{ return Intersections::internal::do_intersect(t1, t2, K()); }
{ return { Intersections::internal::do_intersect(t1, t2, K())}; }
};
template <typename K>
@ -3035,10 +3041,12 @@ namespace CommonKernelFunctors {
operator()(const T1& t1, const T2& t2) const
{ return Intersections::internal::do_intersect(t1, t2, K()); }
result_type
operator()(const typename K::Plane_3& pl1, const typename K::Plane_3& pl2, const typename K::Plane_3& pl3) const
{ return Intersections::internal::do_intersect(pl1, pl2, pl3, K() ); }
result_type operator()(const typename K::Plane_3& pl1,
const typename K::Plane_3& pl2,
const typename K::Plane_3& pl3) const
{
return Intersections::internal::do_intersect(pl1, pl2, pl3, K());
}
};
template <typename K>
@ -3328,7 +3336,9 @@ namespace CommonKernelFunctors {
return c.rep().has_on_bounded_side(p);
}
result_type operator()(const Sphere_3& s1, const Sphere_3& s2,
// returns true iff the line segment ab is inside the union of the bounded sides of s1 and s2.
Needs_FT<result_type>
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;
@ -3341,27 +3351,23 @@ namespace CommonKernelFunctors {
const bool a_in_s1 = has_on_bounded_side(s1, a);
const bool a_in_s2 = has_on_bounded_side(s2, a);
if(!(a_in_s1 || a_in_s2)) return false;
if(!(a_in_s1 || a_in_s2)) return {false};
const bool b_in_s1 = has_on_bounded_side(s1, b);
const bool b_in_s2 = has_on_bounded_side(s2, b);
if(!(b_in_s1 || b_in_s2)) return false;
if(!(b_in_s1 || b_in_s2)) return {false};
if(a_in_s1 && b_in_s1) return true;
if(a_in_s2 && b_in_s2) return true;
if(a_in_s1 && b_in_s1) return {true};
if(a_in_s2 && b_in_s2) return {true};
if(!K().do_intersect_3_object()(s1, s2)) return false;
if(!K().do_intersect_3_object()(s1, s2)) return {false};
const Circle_3 circ(s1, s2);
const Plane_3& plane = circ.supporting_plane();
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");
CGAL_kernel_assertion_msg(bool(optional) == true, "the segment does not intersect the supporting plane");
const Point_3* p = boost::get<Point_3>(&*optional);
CGAL_kernel_assertion_msg(p != 0,
"the segment intersection with the plane is "
"not a point");
CGAL_kernel_assertion_msg(p != 0, "the segment intersection with the plane is not a point");
return squared_distance(circ.center(), *p) < circ.squared_radius();
}

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