mirror of https://github.com/CGAL/cgal
remove code for CGAL_INTERSECTION_VERSION 1
This commit is contained in:
parent
0ce7fc09b5
commit
1d908c1c0b
|
|
@ -365,20 +365,6 @@ public:
|
||||||
public:
|
public:
|
||||||
Intersection(const AABB_traits<GeomTraits,AABBPrimitive,BboxMap>& traits)
|
Intersection(const AABB_traits<GeomTraits,AABBPrimitive,BboxMap>& traits)
|
||||||
:m_traits(traits) {}
|
:m_traits(traits) {}
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
template<typename Query>
|
|
||||||
boost::optional<typename AT::Object_and_primitive_id>
|
|
||||||
operator()(const Query& query, const typename AT::Primitive& primitive) const
|
|
||||||
{
|
|
||||||
typedef boost::optional<Object_and_primitive_id> Intersection;
|
|
||||||
|
|
||||||
CGAL::Object object = GeomTraits().intersect_3_object()(internal::Primitive_helper<AT>::get_datum(primitive,m_traits),query);
|
|
||||||
if ( object.empty() )
|
|
||||||
return Intersection();
|
|
||||||
else
|
|
||||||
return Intersection(Object_and_primitive_id(object,primitive.id()));
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
template<typename Query>
|
template<typename Query>
|
||||||
boost::optional< typename Intersection_and_primitive_id<Query>::Type >
|
boost::optional< typename Intersection_and_primitive_id<Query>::Type >
|
||||||
operator()(const Query& query, const typename AT::Primitive& primitive) const {
|
operator()(const Query& query, const typename AT::Primitive& primitive) const {
|
||||||
|
|
@ -388,7 +374,6 @@ public:
|
||||||
return boost::none;
|
return boost::none;
|
||||||
return boost::make_optional( std::make_pair(*inter_res, primitive.id()) );
|
return boost::make_optional( std::make_pair(*inter_res, primitive.id()) );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Intersection intersection_object() const {return Intersection(*this);}
|
Intersection intersection_object() const {return Intersection(*this);}
|
||||||
|
|
|
||||||
|
|
@ -284,11 +284,7 @@ public:
|
||||||
/// for which `do_intersect` predicates
|
/// for which `do_intersect` predicates
|
||||||
/// and intersections are defined in the traits class AABBTraits.
|
/// and intersections are defined in the traits class AABBTraits.
|
||||||
template <typename Query>
|
template <typename Query>
|
||||||
#if CGAL_INTERSECTION_VERSION < 2 && !defined(DOXYGEN_RUNNING)
|
|
||||||
boost::optional<Object_and_primitive_id>
|
|
||||||
#else
|
|
||||||
boost::optional< typename Intersection_and_primitive_id<Query>::Type >
|
boost::optional< typename Intersection_and_primitive_id<Query>::Type >
|
||||||
#endif
|
|
||||||
any_intersection(const Query& query) const;
|
any_intersection(const Query& query) const;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -846,11 +842,7 @@ public:
|
||||||
|
|
||||||
template <typename Tr>
|
template <typename Tr>
|
||||||
template <typename Query>
|
template <typename Query>
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
boost::optional<typename AABB_tree<Tr>::Object_and_primitive_id>
|
|
||||||
#else
|
|
||||||
boost::optional< typename AABB_tree<Tr>::template Intersection_and_primitive_id<Query>::Type >
|
boost::optional< typename AABB_tree<Tr>::template Intersection_and_primitive_id<Query>::Type >
|
||||||
#endif
|
|
||||||
AABB_tree<Tr>::any_intersection(const Query& query) const
|
AABB_tree<Tr>::any_intersection(const Query& query) const
|
||||||
{
|
{
|
||||||
using namespace CGAL::internal::AABB_tree;
|
using namespace CGAL::internal::AABB_tree;
|
||||||
|
|
|
||||||
|
|
@ -78,11 +78,7 @@ class First_intersection_traits
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef
|
typedef
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
boost::optional<Object_and_primitive_id>
|
|
||||||
#else
|
|
||||||
boost::optional< typename AABBTraits::template Intersection_and_primitive_id<Query>::Type >
|
boost::optional< typename AABBTraits::template Intersection_and_primitive_id<Query>::Type >
|
||||||
#endif
|
|
||||||
Result;
|
Result;
|
||||||
public:
|
public:
|
||||||
First_intersection_traits(const AABBTraits& traits)
|
First_intersection_traits(const AABBTraits& traits)
|
||||||
|
|
@ -137,11 +133,7 @@ public:
|
||||||
|
|
||||||
void intersection(const Query& query, const Primitive& primitive)
|
void intersection(const Query& query, const Primitive& primitive)
|
||||||
{
|
{
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
boost::optional<Object_and_primitive_id>
|
|
||||||
#else
|
|
||||||
boost::optional< typename AABBTraits::template Intersection_and_primitive_id<Query>::Type >
|
boost::optional< typename AABBTraits::template Intersection_and_primitive_id<Query>::Type >
|
||||||
#endif
|
|
||||||
intersection = m_traits.intersection_object()(query, primitive);
|
intersection = m_traits.intersection_object()(query, primitive);
|
||||||
|
|
||||||
if(intersection)
|
if(intersection)
|
||||||
|
|
|
||||||
|
|
@ -104,17 +104,9 @@ void test_all_intersection_query_types(Tree& tree)
|
||||||
tree.all_intersected_primitives(segment,std::back_inserter(primitives));
|
tree.all_intersected_primitives(segment,std::back_inserter(primitives));
|
||||||
|
|
||||||
// any_intersection
|
// any_intersection
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
typedef typename Tree::Object_and_primitive_id Object_and_primitive_id;
|
|
||||||
boost::optional<Object_and_primitive_id> optional_object_and_primitive;
|
|
||||||
optional_object_and_primitive = tree.any_intersection(ray);
|
|
||||||
optional_object_and_primitive = tree.any_intersection(line);
|
|
||||||
optional_object_and_primitive = tree.any_intersection(segment);
|
|
||||||
#else
|
|
||||||
boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Ray>::Type > r = tree.any_intersection(ray);
|
boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Ray>::Type > r = tree.any_intersection(ray);
|
||||||
boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Line>::Type > l = tree.any_intersection(line);
|
boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Line>::Type > l = tree.any_intersection(line);
|
||||||
boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Segment>::Type > s = tree.any_intersection(segment);
|
boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Segment>::Type > s = tree.any_intersection(segment);
|
||||||
#endif
|
|
||||||
|
|
||||||
// any_intersected_primitive
|
// any_intersected_primitive
|
||||||
boost::optional<typename Primitive::Id> optional_primitive;
|
boost::optional<typename Primitive::Id> optional_primitive;
|
||||||
|
|
@ -123,19 +115,12 @@ void test_all_intersection_query_types(Tree& tree)
|
||||||
optional_primitive = tree.any_intersected_primitive(segment);
|
optional_primitive = tree.any_intersected_primitive(segment);
|
||||||
|
|
||||||
// all_intersections
|
// all_intersections
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
std::list<Object_and_primitive_id> intersections;
|
|
||||||
tree.all_intersections(ray,std::back_inserter(intersections));
|
|
||||||
tree.all_intersections(line,std::back_inserter(intersections));
|
|
||||||
tree.all_intersections(segment,std::back_inserter(intersections));
|
|
||||||
#else
|
|
||||||
std::list< boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Ray>::Type > > intersections_r;
|
std::list< boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Ray>::Type > > intersections_r;
|
||||||
std::list< boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Line>::Type > > intersections_l;
|
std::list< boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Line>::Type > > intersections_l;
|
||||||
std::list< boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Segment>::Type > > intersections_s;
|
std::list< boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Segment>::Type > > intersections_s;
|
||||||
tree.all_intersections(ray,std::back_inserter(intersections_r));
|
tree.all_intersections(ray,std::back_inserter(intersections_r));
|
||||||
tree.all_intersections(line,std::back_inserter(intersections_l));
|
tree.all_intersections(line,std::back_inserter(intersections_l));
|
||||||
tree.all_intersections(segment,std::back_inserter(intersections_s));
|
tree.all_intersections(segment,std::back_inserter(intersections_s));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -404,13 +389,8 @@ public:
|
||||||
Polyhedron_primitive_iterator it = Pr_generator().begin(p);
|
Polyhedron_primitive_iterator it = Pr_generator().begin(p);
|
||||||
for ( ; it != Pr_generator().end(p) ; ++it )
|
for ( ; it != Pr_generator().end(p) ; ++it )
|
||||||
{
|
{
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
Intersection_result
|
|
||||||
intersection = Traits().intersection_object()(query, Pr(it,p));
|
|
||||||
#else
|
|
||||||
boost::optional< typename Traits::template Intersection_and_primitive_id<Query>::Type >
|
boost::optional< typename Traits::template Intersection_and_primitive_id<Query>::Type >
|
||||||
intersection = m_traits.intersection_object()(query, Pr(it,p));
|
intersection = m_traits.intersection_object()(query, Pr(it,p));
|
||||||
#endif
|
|
||||||
if ( intersection )
|
if ( intersection )
|
||||||
*out++ = *intersection;
|
*out++ = *intersection;
|
||||||
}
|
}
|
||||||
|
|
@ -717,11 +697,7 @@ private:
|
||||||
const Naive_implementation& naive) const
|
const Naive_implementation& naive) const
|
||||||
{
|
{
|
||||||
typedef
|
typedef
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
Object_and_primitive_id
|
|
||||||
#else
|
|
||||||
typename Tree::AABB_traits::template Intersection_and_primitive_id<Query>::Type
|
typename Tree::AABB_traits::template Intersection_and_primitive_id<Query>::Type
|
||||||
#endif
|
|
||||||
Obj_type;
|
Obj_type;
|
||||||
|
|
||||||
typedef
|
typedef
|
||||||
|
|
@ -759,11 +735,7 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Any intersection test (do not count time here)
|
// Any intersection test (do not count time here)
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
boost::optional<Object_and_primitive_id>
|
|
||||||
#else
|
|
||||||
boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Query>::Type >
|
boost::optional< typename Tree::AABB_traits::template Intersection_and_primitive_id<Query>::Type >
|
||||||
#endif
|
|
||||||
intersection = tree.any_intersection(query);
|
intersection = tree.any_intersection(query);
|
||||||
|
|
||||||
// Check: verify we do get the result by naive method
|
// Check: verify we do get the result by naive method
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
#define CGAL_INTERSECTION_VERSION 2
|
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
@ -40,11 +38,7 @@ struct FilterP {
|
||||||
template<typename ForwardIterator, typename Tree>
|
template<typename ForwardIterator, typename Tree>
|
||||||
std::size_t intersect(ForwardIterator b, ForwardIterator e, const Tree& tree, long& counter) {
|
std::size_t intersect(ForwardIterator b, ForwardIterator e, const Tree& tree, long& counter) {
|
||||||
typedef
|
typedef
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
typename Tree::Object_and_primitive_id
|
|
||||||
#else
|
|
||||||
typename Tree::AABB_traits::template Intersection_and_primitive_id<typename ForwardIterator::value_type>::Type
|
typename Tree::AABB_traits::template Intersection_and_primitive_id<typename ForwardIterator::value_type>::Type
|
||||||
#endif
|
|
||||||
Obj_type;
|
Obj_type;
|
||||||
|
|
||||||
std::vector<Obj_type> v;
|
std::vector<Obj_type> v;
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,6 @@
|
||||||
//
|
//
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
#define CGAL_INTERSECTION_VERSION 1
|
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,6 @@
|
||||||
//
|
//
|
||||||
//******************************************************************************
|
//******************************************************************************
|
||||||
|
|
||||||
#define CGAL_INTERSECTION_VERSION 2
|
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,8 @@
|
||||||
#ifndef CGAL_CIRCULAR_KERNEL_2_INTERSECTION_TRAITS_H
|
#ifndef CGAL_CIRCULAR_KERNEL_2_INTERSECTION_TRAITS_H
|
||||||
#define CGAL_CIRCULAR_KERNEL_2_INTERSECTION_TRAITS_H
|
#define CGAL_CIRCULAR_KERNEL_2_INTERSECTION_TRAITS_H
|
||||||
|
|
||||||
//this include is needed to know the value of CGAL_INTERSECTION_VERSION
|
|
||||||
#include <CGAL/Intersection_traits.h>
|
#include <CGAL/Intersection_traits.h>
|
||||||
|
|
||||||
#if !(CGAL_INTERSECTION_VERSION < 2)
|
|
||||||
|
|
||||||
#include <boost/variant.hpp>
|
#include <boost/variant.hpp>
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
@ -187,16 +184,6 @@ struct CK2_Intersection_traits<CK, typename CK::Line_2, typename CK::Line_2>
|
||||||
|
|
||||||
} //end of namespace CGAL
|
} //end of namespace CGAL
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#include <CGAL/Object.h>
|
|
||||||
|
|
||||||
template <typename CK, typename T1, typename T2>
|
|
||||||
struct CK2_Intersection_traits
|
|
||||||
{ typedef CGAL::Object type; };
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace CGAL{
|
namespace CGAL{
|
||||||
namespace internal{
|
namespace internal{
|
||||||
|
|
||||||
|
|
@ -208,21 +195,12 @@ namespace internal{
|
||||||
// _could_ come with conversion overhead and so we rather go for
|
// _could_ come with conversion overhead and so we rather go for
|
||||||
// the real type.
|
// the real type.
|
||||||
// Overloads for empty returns are also provided.
|
// Overloads for empty returns are also provided.
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
template<typename, typename T>
|
|
||||||
inline
|
|
||||||
CGAL::Object ck2_intersection_return(T&& t) { return CGAL::make_object(std::forward<T>(t)); }
|
|
||||||
template<typename>
|
|
||||||
inline
|
|
||||||
CGAL::Object ck2_intersection_return() { return CGAL::Object(); }
|
|
||||||
#else
|
|
||||||
template<typename RT, typename T>
|
template<typename RT, typename T>
|
||||||
inline RT
|
inline RT
|
||||||
ck2_intersection_return(T&& t) { return RT(std::forward<T>(t)); }
|
ck2_intersection_return(T&& t) { return RT(std::forward<T>(t)); }
|
||||||
template<typename RT>
|
template<typename RT>
|
||||||
inline RT
|
inline RT
|
||||||
ck2_intersection_return() { return RT(); }
|
ck2_intersection_return() { return RT(); }
|
||||||
#endif // CGAL_INTERSECTION_VERSION < 2
|
|
||||||
|
|
||||||
} } //end of namespace CGAL::internal
|
} } //end of namespace CGAL::internal
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -536,18 +536,8 @@ namespace CircularFunctors {
|
||||||
|
|
||||||
for (typename solutions_container::iterator it = solutions.begin();
|
for (typename solutions_container::iterator it = solutions.begin();
|
||||||
it != solutions.end(); ++it) {
|
it != solutions.end(); ++it) {
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
if(const std::pair<typename CK::Circular_arc_point_2, unsigned>* p =
|
|
||||||
object_cast< std::pair< typename CK::Circular_arc_point_2, unsigned> >(& (*it))) {
|
|
||||||
Has_on_visitor<CK, typename CK::Line_arc_2> vis(&l);
|
|
||||||
if(vis(*p)) {
|
|
||||||
*res++ = *it;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if(boost::apply_visitor(Has_on_visitor<CK, typename CK::Line_arc_2>(&l), *it))
|
if(boost::apply_visitor(Has_on_visitor<CK, typename CK::Line_arc_2>(&l), *it))
|
||||||
*res++ = *it;
|
*res++ = *it;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|
@ -700,26 +690,11 @@ namespace CircularFunctors {
|
||||||
for (typename solutions_container::iterator it = solutions.begin();
|
for (typename solutions_container::iterator it = solutions.begin();
|
||||||
it != solutions.end(); ++it)
|
it != solutions.end(); ++it)
|
||||||
{
|
{
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
if(const std::pair<typename CK::Circular_arc_point_2, unsigned>* p =
|
|
||||||
object_cast< std::pair< typename CK::Circular_arc_point_2, unsigned> >(& (*it)))
|
|
||||||
{
|
|
||||||
#ifdef CGAL_CK_TEST_BBOX_BEFORE_HAS_ON
|
|
||||||
Bbox_2 rb = p->first.bbox();
|
|
||||||
if(!do_overlap(l.bbox(), rb) || !do_overlap(c.bbox(),rb)) continue;
|
|
||||||
#endif
|
|
||||||
Has_on_visitor<CK, typename CK::Line_arc_2> vis1(&l);
|
|
||||||
Has_on_visitor<CK, typename CK::Circular_arc_2> vis2(&c);
|
|
||||||
if(vis1(*p) && vis2(*p))
|
|
||||||
*res++ = *it;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if(boost::apply_visitor(Has_on_visitor<CK, typename CK::Line_arc_2>(&l), *it) &&
|
if(boost::apply_visitor(Has_on_visitor<CK, typename CK::Line_arc_2>(&l), *it) &&
|
||||||
boost::apply_visitor(Has_on_visitor<CK, typename CK::Circular_arc_2>(&c), *it) )
|
boost::apply_visitor(Has_on_visitor<CK, typename CK::Circular_arc_2>(&c), *it) )
|
||||||
{
|
{
|
||||||
*res++ = *it;
|
*res++ = *it;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -824,16 +799,8 @@ namespace CircularFunctors {
|
||||||
|
|
||||||
for (typename solutions_container::const_iterator it = solutions.begin();
|
for (typename solutions_container::const_iterator it = solutions.begin();
|
||||||
it != solutions.end(); ++it) {
|
it != solutions.end(); ++it) {
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
typedef typename CK::Circular_arc_point_2 Circular_arc_point_2;
|
|
||||||
const std::pair<Circular_arc_point_2, unsigned>* p =
|
|
||||||
object_cast<std::pair<Circular_arc_point_2, unsigned> >(& (*it));
|
|
||||||
Has_on_visitor<CK, Circular_arc_2> vis(&c);
|
|
||||||
if(vis(*p)) *res++ = *it;
|
|
||||||
#else
|
|
||||||
if(boost::apply_visitor(Has_on_visitor<CK, Circular_arc_2>(&c), *it))
|
if(boost::apply_visitor(Has_on_visitor<CK, Circular_arc_2>(&c), *it))
|
||||||
*res++ = *it;
|
*res++ = *it;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,8 @@
|
||||||
#ifndef CGAL_CIRCULAR_KERNEL_3_INTERSECTION_TRAITS_H
|
#ifndef CGAL_CIRCULAR_KERNEL_3_INTERSECTION_TRAITS_H
|
||||||
#define CGAL_CIRCULAR_KERNEL_3_INTERSECTION_TRAITS_H
|
#define CGAL_CIRCULAR_KERNEL_3_INTERSECTION_TRAITS_H
|
||||||
|
|
||||||
//this include is needed to know the value of CGAL_INTERSECTION_VERSION
|
|
||||||
#include <CGAL/Intersection_traits.h>
|
#include <CGAL/Intersection_traits.h>
|
||||||
|
|
||||||
#if !(CGAL_INTERSECTION_VERSION < 2)
|
|
||||||
|
|
||||||
#include <boost/variant.hpp>
|
#include <boost/variant.hpp>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
|
@ -179,16 +176,6 @@ struct SK3_Intersection_traits<SK, typename SK::Sphere_3, typename SK::Plane_3,
|
||||||
|
|
||||||
} //end of namespace CGAL
|
} //end of namespace CGAL
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#include <CGAL/Object.h>
|
|
||||||
|
|
||||||
template <typename CK, typename T1, typename T2, typename T3=void*>
|
|
||||||
struct SK3_Intersection_traits
|
|
||||||
{ typedef CGAL::Object type; };
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace CGAL{
|
namespace CGAL{
|
||||||
namespace internal{
|
namespace internal{
|
||||||
|
|
||||||
|
|
@ -200,21 +187,12 @@ namespace internal{
|
||||||
// _could_ come with conversion overhead and so we rather go for
|
// _could_ come with conversion overhead and so we rather go for
|
||||||
// the real type.
|
// the real type.
|
||||||
// Overloads for empty returns are also provided.
|
// Overloads for empty returns are also provided.
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
template<typename, typename T>
|
|
||||||
inline
|
|
||||||
CGAL::Object sk3_intersection_return(T&& t) { return CGAL::make_object(std::forward<T>(t)); }
|
|
||||||
template<typename>
|
|
||||||
inline
|
|
||||||
CGAL::Object sk3_intersection_return() { return CGAL::Object(); }
|
|
||||||
#else
|
|
||||||
template<typename RT, typename T>
|
template<typename RT, typename T>
|
||||||
inline RT
|
inline RT
|
||||||
sk3_intersection_return(T&& t) { return RT(std::forward<T>(t)); }
|
sk3_intersection_return(T&& t) { return RT(std::forward<T>(t)); }
|
||||||
template<typename RT>
|
template<typename RT>
|
||||||
inline RT
|
inline RT
|
||||||
sk3_intersection_return() { return RT(); }
|
sk3_intersection_return() { return RT(); }
|
||||||
#endif // CGAL_INTERSECTION_VERSION < 2
|
|
||||||
|
|
||||||
} } //end of namespace CGAL::internal
|
} } //end of namespace CGAL::internal
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1198,14 +1198,10 @@ template < class SK > \
|
||||||
//only ternary from the linear kernel
|
//only ternary from the linear kernel
|
||||||
template<typename F>
|
template<typename F>
|
||||||
struct result<F(Plane_3, Plane_3, Plane_3)> {
|
struct result<F(Plane_3, Plane_3, Plane_3)> {
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
typedef CGAL::Object type;
|
|
||||||
#else
|
|
||||||
typedef boost::optional<
|
typedef boost::optional<
|
||||||
boost::variant< Point_3,
|
boost::variant< Point_3,
|
||||||
Line_3,
|
Line_3,
|
||||||
Plane_3 > > type;
|
Plane_3 > > type;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//using SK::Linear_kernel::Intersect_3::operator();
|
//using SK::Linear_kernel::Intersect_3::operator();
|
||||||
|
|
|
||||||
|
|
@ -292,43 +292,25 @@ namespace CGAL {
|
||||||
CGAL_kernel_precondition(!s2.is_degenerate());
|
CGAL_kernel_precondition(!s2.is_degenerate());
|
||||||
CGAL_kernel_precondition(!s3.is_degenerate());
|
CGAL_kernel_precondition(!s3.is_degenerate());
|
||||||
if(non_oriented_equal<SK>(s1,s2) && non_oriented_equal<SK>(s2,s3)) {
|
if(non_oriented_equal<SK>(s1,s2) && non_oriented_equal<SK>(s2,s3)) {
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
*res++ = make_object(s1);
|
|
||||||
#else
|
|
||||||
*res++ = result_type(s1);
|
*res++ = result_type(s1);
|
||||||
#endif
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if(non_oriented_equal<SK>(s1,s2)) {
|
if(non_oriented_equal<SK>(s1,s2)) {
|
||||||
if(typename Intersection_traits<SK, Sphere_3, Sphere_3>::result_type v =
|
if(typename Intersection_traits<SK, Sphere_3, Sphere_3>::result_type v =
|
||||||
SK().intersect_3_object()(s1, s3)) {
|
SK().intersect_3_object()(s1, s3)) {
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
if( const Point_3* p = object_cast<Point_3>(&v) )
|
|
||||||
*res++ = make_object(std::make_pair(Circular_arc_point_3(*p), 2u));
|
|
||||||
else
|
|
||||||
*res++ = v;
|
|
||||||
#else
|
|
||||||
internal::Point_conversion_visitor<SK, result_type, OutputIterator> visitor(res);
|
internal::Point_conversion_visitor<SK, result_type, OutputIterator> visitor(res);
|
||||||
return boost::apply_visitor(visitor,
|
return boost::apply_visitor(visitor,
|
||||||
*v);
|
*v);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if(non_oriented_equal<SK>(s1,s3) || non_oriented_equal<SK>(s2,s3)) {
|
if(non_oriented_equal<SK>(s1,s3) || non_oriented_equal<SK>(s2,s3)) {
|
||||||
if(typename Intersection_traits<SK, Sphere_3, Sphere_3>::result_type v =
|
if(typename Intersection_traits<SK, Sphere_3, Sphere_3>::result_type v =
|
||||||
SK().intersect_3_object()(s1, s2)) {
|
SK().intersect_3_object()(s1, s2)) {
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
if( const Point_3* p = object_cast<Point_3>(&v) )
|
|
||||||
*res++ = make_object(std::make_pair(Circular_arc_point_3(*p), 2u));
|
|
||||||
else
|
|
||||||
*res++ = v;
|
|
||||||
#else
|
|
||||||
internal::Point_conversion_visitor<SK, result_type, OutputIterator> visitor(res);
|
internal::Point_conversion_visitor<SK, result_type, OutputIterator> visitor(res);
|
||||||
return boost::apply_visitor(
|
return boost::apply_visitor(
|
||||||
visitor,
|
visitor,
|
||||||
*v);
|
*v);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -338,21 +320,13 @@ namespace CGAL {
|
||||||
if(!v) return res;
|
if(!v) return res;
|
||||||
if(const Point_3* p = CGAL::Intersections::internal::intersect_get<Point_3>(v)) {
|
if(const Point_3* p = CGAL::Intersections::internal::intersect_get<Point_3>(v)) {
|
||||||
if(SK().has_on_3_object()(s3, *p)) {
|
if(SK().has_on_3_object()(s3, *p)) {
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
*res++ = make_object(std::make_pair(Circular_arc_point_3(*p),2u));
|
|
||||||
#else
|
|
||||||
*res++ = result_type(std::make_pair(Circular_arc_point_3(*p),2u));
|
*res++ = result_type(std::make_pair(Circular_arc_point_3(*p),2u));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
if(const Circle_3* c = CGAL::Intersections::internal::intersect_get<Circle_3>(v)) {
|
if(const Circle_3* c = CGAL::Intersections::internal::intersect_get<Circle_3>(v)) {
|
||||||
if(SK().has_on_3_object()(s3, *c)) {
|
if(SK().has_on_3_object()(s3, *c)) {
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
*res++ = make_object(*c);
|
|
||||||
#else
|
|
||||||
*res++ = result_type(*c);
|
*res++ = result_type(*c);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -384,26 +358,16 @@ namespace CGAL {
|
||||||
typedef typename SK::Plane_3 Plane_3;
|
typedef typename SK::Plane_3 Plane_3;
|
||||||
typedef typename SK::Sphere_3 Sphere_3;
|
typedef typename SK::Sphere_3 Sphere_3;
|
||||||
typedef typename SK::Algebraic_kernel Algebraic_kernel;
|
typedef typename SK::Algebraic_kernel Algebraic_kernel;
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
|
|
||||||
#endif
|
|
||||||
CGAL_kernel_precondition(!p.is_degenerate());
|
CGAL_kernel_precondition(!p.is_degenerate());
|
||||||
CGAL_kernel_precondition(!s1.is_degenerate());
|
CGAL_kernel_precondition(!s1.is_degenerate());
|
||||||
CGAL_kernel_precondition(!s2.is_degenerate());
|
CGAL_kernel_precondition(!s2.is_degenerate());
|
||||||
if(non_oriented_equal<SK>(s1,s2)) {
|
if(non_oriented_equal<SK>(s1,s2)) {
|
||||||
if(typename Intersection_traits<SK, Plane_3, Sphere_3>::result_type v =
|
if(typename Intersection_traits<SK, Plane_3, Sphere_3>::result_type v =
|
||||||
SK().intersect_3_object()(p, s1)) {
|
SK().intersect_3_object()(p, s1)) {
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
if( const typename SK::Point_3* p = CGAL::object_cast<typename SK::Point_3>(&v) )
|
|
||||||
*res++ = make_object(std::make_pair(Circular_arc_point_3(*p), 2u));
|
|
||||||
else
|
|
||||||
*res++ = v;
|
|
||||||
#else
|
|
||||||
internal::Point_conversion_visitor<SK, result_type, OutputIterator> visitor(res);
|
internal::Point_conversion_visitor<SK, result_type, OutputIterator> visitor(res);
|
||||||
return boost::apply_visitor(
|
return boost::apply_visitor(
|
||||||
visitor,
|
visitor,
|
||||||
*v);
|
*v);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -411,17 +375,10 @@ namespace CGAL {
|
||||||
if(non_oriented_equal<SK>(p,radical_p)) {
|
if(non_oriented_equal<SK>(p,radical_p)) {
|
||||||
if(typename Intersection_traits<SK, Plane_3, Sphere_3>::result_type v =
|
if(typename Intersection_traits<SK, Plane_3, Sphere_3>::result_type v =
|
||||||
SK().intersect_3_object()(p, s1)) {
|
SK().intersect_3_object()(p, s1)) {
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
if( const typename SK::Point_3* p = CGAL::object_cast<typename SK::Point_3>(&v) )
|
|
||||||
*res++ = make_object(std::make_pair(Circular_arc_point_3(*p), 2u));
|
|
||||||
else
|
|
||||||
*res++ = v;
|
|
||||||
#else
|
|
||||||
internal::Point_conversion_visitor<SK, result_type, OutputIterator> visitor(res);
|
internal::Point_conversion_visitor<SK, result_type, OutputIterator> visitor(res);
|
||||||
return boost::apply_visitor(
|
return boost::apply_visitor(
|
||||||
visitor,
|
visitor,
|
||||||
*v);
|
*v);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -456,18 +413,10 @@ namespace CGAL {
|
||||||
if(non_oriented_equal<SK>(p1,p2)) {
|
if(non_oriented_equal<SK>(p1,p2)) {
|
||||||
if(typename Intersection_traits<SK, Plane_3, Sphere_3>::result_type v =
|
if(typename Intersection_traits<SK, Plane_3, Sphere_3>::result_type v =
|
||||||
SK().intersect_3_object()(p1, s)) {
|
SK().intersect_3_object()(p1, s)) {
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
typedef typename SK::Circular_arc_point_3 Circular_arc_point_3;
|
|
||||||
if( const typename SK::Point_3* p = CGAL::object_cast<typename SK::Point_3>(&v) )
|
|
||||||
*res++ = make_object(std::make_pair(Circular_arc_point_3(*p), 2u));
|
|
||||||
else
|
|
||||||
*res++ = v;
|
|
||||||
#else
|
|
||||||
internal::Point_conversion_visitor<SK, result_type, OutputIterator> visitor(res);
|
internal::Point_conversion_visitor<SK, result_type, OutputIterator> visitor(res);
|
||||||
return boost::apply_visitor(
|
return boost::apply_visitor(
|
||||||
visitor,
|
visitor,
|
||||||
*v);
|
*v);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -220,13 +220,8 @@ private:
|
||||||
struct Lazy_wrapper_traits<typename Approximate_kernel::NAME, Dummy> \
|
struct Lazy_wrapper_traits<typename Approximate_kernel::NAME, Dummy> \
|
||||||
: boost::mpl::int_<WRAPPER> {};
|
: boost::mpl::int_<WRAPPER> {};
|
||||||
|
|
||||||
#if CGAL_INTERSECTION_VERSION > 1
|
|
||||||
CGAL_WRAPPER_TRAIT(Intersect_2, VARIANT)
|
CGAL_WRAPPER_TRAIT(Intersect_2, VARIANT)
|
||||||
CGAL_WRAPPER_TRAIT(Intersect_3, VARIANT)
|
CGAL_WRAPPER_TRAIT(Intersect_3, VARIANT)
|
||||||
#else
|
|
||||||
CGAL_WRAPPER_TRAIT(Intersect_2, OBJECT)
|
|
||||||
CGAL_WRAPPER_TRAIT(Intersect_3, OBJECT)
|
|
||||||
#endif
|
|
||||||
CGAL_WRAPPER_TRAIT(Compute_squared_radius_2, NT)
|
CGAL_WRAPPER_TRAIT(Compute_squared_radius_2, NT)
|
||||||
CGAL_WRAPPER_TRAIT(Compute_x_3, NT)
|
CGAL_WRAPPER_TRAIT(Compute_x_3, NT)
|
||||||
CGAL_WRAPPER_TRAIT(Compute_y_3, NT)
|
CGAL_WRAPPER_TRAIT(Compute_y_3, NT)
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,6 @@ int main()
|
||||||
}
|
}
|
||||||
obj = CGAL::intersection(s1,s2);
|
obj = CGAL::intersection(s1,s2);
|
||||||
|
|
||||||
#if CGAL_INTERSECTION_VERSION > 1
|
|
||||||
// check the variant return type
|
// check the variant return type
|
||||||
CGAL::cpp11::result_of<K::Intersect_2(Triangle_2, Triangle_2) >::type o_variant = CGAL::intersection(t1,t2);
|
CGAL::cpp11::result_of<K::Intersect_2(Triangle_2, Triangle_2) >::type o_variant = CGAL::intersection(t1,t2);
|
||||||
if(!o_variant) {
|
if(!o_variant) {
|
||||||
|
|
@ -54,7 +53,6 @@ int main()
|
||||||
std::cerr << CGAL::exact((*V)[i]) << std::endl;
|
std::cerr << CGAL::exact((*V)[i]) << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
@ -76,7 +74,6 @@ int main()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CGAL_INTERSECTION_VERSION > 1
|
|
||||||
// check the variant return type
|
// check the variant return type
|
||||||
CGAL::cpp11::result_of<K::Intersect_3(Triangle_3, Triangle_3)>::type o_variant = CGAL::intersection(t1,t2);
|
CGAL::cpp11::result_of<K::Intersect_3(Triangle_3, Triangle_3)>::type o_variant = CGAL::intersection(t1,t2);
|
||||||
if(!o_variant) {
|
if(!o_variant) {
|
||||||
|
|
@ -96,7 +93,6 @@ int main()
|
||||||
std::cerr << CGAL::exact((*V)[i]) << std::endl;
|
std::cerr << CGAL::exact((*V)[i]) << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
//making the interval construction failing
|
//making the interval construction failing
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,25 +31,6 @@
|
||||||
#include <boost/type_traits/is_same.hpp>
|
#include <boost/type_traits/is_same.hpp>
|
||||||
#include <boost/variant.hpp>
|
#include <boost/variant.hpp>
|
||||||
|
|
||||||
// The macro CGAL_INTERSECTION_VERSION controls which version of the
|
|
||||||
// intersection is used.
|
|
||||||
// Currently two values are supported:
|
|
||||||
// - 1, which means intersections with CGAL::Object
|
|
||||||
// - 2, which means intersections with Intersection_traits and the
|
|
||||||
// corresponding APIs in other modules
|
|
||||||
// The default value is 2.
|
|
||||||
|
|
||||||
#if !defined(CGAL_INTERSECTION_VERSION)
|
|
||||||
#define CGAL_INTERSECTION_VERSION 2
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
|
|
||||||
#define CGAL_INTERSECTION_TRAITS_2(A, B, R1, R2)
|
|
||||||
#define CGAL_INTERSECTION_TRAITS_3(A, B, R1, R2, R3)
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define CGAL_INTERSECTION_TRAITS_2(A, B, R1, R2) \
|
#define CGAL_INTERSECTION_TRAITS_2(A, B, R1, R2) \
|
||||||
template<typename K> \
|
template<typename K> \
|
||||||
struct Intersection_traits<K, typename K::A, typename K::B> { \
|
struct Intersection_traits<K, typename K::A, typename K::B> { \
|
||||||
|
|
@ -66,10 +47,6 @@
|
||||||
typedef typename boost::optional< variant_type > result_type; \
|
typedef typename boost::optional< variant_type > result_type; \
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define CGAL_INTERSECTION_FUNCTION(A, B, DIM) \
|
#define CGAL_INTERSECTION_FUNCTION(A, B, DIM) \
|
||||||
template<typename K> \
|
template<typename K> \
|
||||||
inline \
|
inline \
|
||||||
|
|
@ -118,9 +95,6 @@ template<typename, typename, typename>
|
||||||
struct Intersection_traits {
|
struct Intersection_traits {
|
||||||
// This defaults to Object, if we use VERSION < 2 and do nothing
|
// This defaults to Object, if we use VERSION < 2 and do nothing
|
||||||
// otherwise.
|
// otherwise.
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
typedef CGAL::Object result_type;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -157,21 +131,12 @@ namespace internal {
|
||||||
// _could_ come with conversion overhead and so we rather go for
|
// _could_ come with conversion overhead and so we rather go for
|
||||||
// the real type.
|
// the real type.
|
||||||
// Overloads for empty returns are also provided.
|
// Overloads for empty returns are also provided.
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
template<typename, typename, typename, typename T>
|
|
||||||
inline
|
|
||||||
CGAL::Object intersection_return(T&& t) { return CGAL::make_object(std::forward<T>(t)); }
|
|
||||||
template<typename, typename, typename>
|
|
||||||
inline
|
|
||||||
CGAL::Object intersection_return() { return CGAL::Object(); }
|
|
||||||
#else
|
|
||||||
template<typename F, typename A, typename B, typename T>
|
template<typename F, typename A, typename B, typename T>
|
||||||
inline typename cpp11::result_of<F(A, B)>::type
|
inline typename cpp11::result_of<F(A, B)>::type
|
||||||
intersection_return(T&& t) { return typename cpp11::result_of<F(A, B)>::type(std::forward<T>(t)); }
|
intersection_return(T&& t) { return typename cpp11::result_of<F(A, B)>::type(std::forward<T>(t)); }
|
||||||
template<typename F, typename A, typename B>
|
template<typename F, typename A, typename B>
|
||||||
inline typename cpp11::result_of<F(A, B)>::type
|
inline typename cpp11::result_of<F(A, B)>::type
|
||||||
intersection_return() { return typename cpp11::result_of<F(A, B)>::type(); }
|
intersection_return() { return typename cpp11::result_of<F(A, B)>::type(); }
|
||||||
#endif // CGAL_INTERSECTION_VERSION < 2
|
|
||||||
|
|
||||||
// Something similar to wrap around boost::get and object_cast to
|
// Something similar to wrap around boost::get and object_cast to
|
||||||
// prevent ifdefing too much. Another way could be to introduce an
|
// prevent ifdefing too much. Another way could be to introduce an
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,6 @@
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#if !(CGAL_INTERSECTION_VERSION < 2)
|
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
CGAL_INTERSECTION_TRAITS_2(Line_2, Line_2, Point_2, Line_2)
|
CGAL_INTERSECTION_TRAITS_2(Line_2, Line_2, Point_2, Line_2)
|
||||||
|
|
@ -118,7 +116,5 @@ struct Intersection_traits<K, typename K::Triangle_2, typename K::Iso_rectangle_
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* CGAL_INTERSECTION_TRAITS_2_H */
|
#endif /* CGAL_INTERSECTION_TRAITS_2_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,6 @@
|
||||||
#include <CGAL/Intersection_traits.h>
|
#include <CGAL/Intersection_traits.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#if !(CGAL_INTERSECTION_VERSION < 2)
|
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
CGAL_INTERSECTION_TRAITS_2(Line_3, Line_3, Point_3, Line_3)
|
CGAL_INTERSECTION_TRAITS_2(Line_3, Line_3, Point_3, Line_3)
|
||||||
|
|
@ -284,7 +282,5 @@ struct Intersection_traits<K, typename K::Sphere_3, typename K::Point_3> {
|
||||||
};
|
};
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif // !(CGAL_INTERSECTION_VERSION < 2)
|
|
||||||
|
|
||||||
#endif /* CGAL_INTERSECTION_TRAITS_3_H */
|
#endif /* CGAL_INTERSECTION_TRAITS_3_H */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -206,25 +206,7 @@ intersection(
|
||||||
// one of the intersection is empty
|
// one of the intersection is empty
|
||||||
return intersection_return<typename K::Intersect_3, typename K::Triangle_3, typename K::Triangle_3>();
|
return intersection_return<typename K::Intersect_3, typename K::Triangle_3, typename K::Triangle_3>();
|
||||||
}
|
}
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
// apply the binary visitor manually
|
|
||||||
Triangle_Line_visitor<K> vis;
|
|
||||||
if(const typename K::Point_3* p1 = intersect_get<typename K::Point_3>(inter1)) {
|
|
||||||
if(const typename K::Point_3* p2 = intersect_get<typename K::Point_3>(inter2)) {
|
|
||||||
return vis(*p1, *p2);
|
|
||||||
} else if(const typename K::Segment_3* s2 = intersect_get<typename K::Segment_3>(inter2)) {
|
|
||||||
return vis(*p1, *s2);
|
|
||||||
}
|
|
||||||
} else if(const typename K::Segment_3* s1 = intersect_get<typename K::Segment_3>(inter1)) {
|
|
||||||
if(const typename K::Point_3* p2 = intersect_get<typename K::Point_3>(inter2)) {
|
|
||||||
return vis(*s1, *p2);
|
|
||||||
} else if(const typename K::Segment_3* s2 = intersect_get<typename K::Segment_3>(inter2)) {
|
|
||||||
return vis(*s1, *s2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
return boost::apply_visitor(Triangle_Line_visitor<K>(), *inter1, *inter2);
|
return boost::apply_visitor(Triangle_Line_visitor<K>(), *inter1, *inter2);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return intersection_return<typename K::Intersect_3, typename K::Triangle_3, typename K::Triangle_3>();
|
return intersection_return<typename K::Intersect_3, typename K::Triangle_3, typename K::Triangle_3>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,27 +40,19 @@ namespace Intersections {
|
||||||
// But it must be a template function since the original kernel must be
|
// But it must be a template function since the original kernel must be
|
||||||
// taken into account. (Michael.Hemmer@sophia.inria.fr)
|
// taken into account. (Michael.Hemmer@sophia.inria.fr)
|
||||||
template <class K>
|
template <class K>
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
CGAL::Object
|
|
||||||
#else
|
|
||||||
typename boost::optional< boost::variant<
|
typename boost::optional< boost::variant<
|
||||||
typename K::Segment_3,
|
typename K::Segment_3,
|
||||||
typename K::Point_3 > >
|
typename K::Point_3 > >
|
||||||
#endif
|
|
||||||
intersection_bl(const Bbox_3 &box,
|
intersection_bl(const Bbox_3 &box,
|
||||||
double lpx, double lpy, double lpz,
|
double lpx, double lpy, double lpz,
|
||||||
double ldx, double ldy, double ldz,
|
double ldx, double ldy, double ldz,
|
||||||
bool min_infinite, bool max_infinite)
|
bool min_infinite, bool max_infinite)
|
||||||
{
|
{
|
||||||
typedef
|
typedef
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
CGAL::Object
|
|
||||||
#else
|
|
||||||
typename
|
typename
|
||||||
boost::optional<
|
boost::optional<
|
||||||
boost::variant< typename K::Segment_3,
|
boost::variant< typename K::Segment_3,
|
||||||
typename K::Point_3 > >
|
typename K::Point_3 > >
|
||||||
#endif
|
|
||||||
result_type;
|
result_type;
|
||||||
|
|
||||||
double seg_min = 0.0, seg_max = 1.0;
|
double seg_min = 0.0, seg_max = 1.0;
|
||||||
|
|
@ -175,19 +167,10 @@ intersection_bl(const Bbox_3 &box,
|
||||||
Vector_3 dir = Vector_3( FT(ldx), FT(ldy), FT(ldz));
|
Vector_3 dir = Vector_3( FT(ldx), FT(ldy), FT(ldz));
|
||||||
|
|
||||||
if (seg_max == seg_min) {
|
if (seg_max == seg_min) {
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
return make_object(ref_point + dir * FT(seg_max));
|
|
||||||
#else
|
|
||||||
return result_type(ref_point + dir * FT(seg_max));
|
return result_type(ref_point + dir * FT(seg_max));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
return make_object(
|
|
||||||
Segment_3(ref_point + dir*FT(seg_min), ref_point + dir*FT(seg_max)));
|
|
||||||
#else
|
|
||||||
return result_type(
|
return result_type(
|
||||||
Segment_3(ref_point + dir*FT(seg_min), ref_point + dir*FT(seg_max)));
|
Segment_3(ref_point + dir*FT(seg_min), ref_point + dir*FT(seg_max)));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
|
|
|
||||||
|
|
@ -64,11 +64,7 @@ namespace CGAL {
|
||||||
// the special plane_3 function
|
// the special plane_3 function
|
||||||
template <class K>
|
template <class K>
|
||||||
inline
|
inline
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
CGAL::Object
|
|
||||||
#else
|
|
||||||
typename cpp11::result_of<typename K::Intersect_3(typename K::Plane_3, typename K::Plane_3, typename K::Plane_3)>::type
|
typename cpp11::result_of<typename K::Intersect_3(typename K::Plane_3, typename K::Plane_3, typename K::Plane_3)>::type
|
||||||
#endif
|
|
||||||
intersection(const Plane_3<K> &plane1, const Plane_3<K> &plane2,
|
intersection(const Plane_3<K> &plane1, const Plane_3<K> &plane2,
|
||||||
const Plane_3<K> &plane3)
|
const Plane_3<K> &plane3)
|
||||||
{
|
{
|
||||||
|
|
@ -194,27 +190,20 @@ intersection(const typename K::Plane_3 &plane1,
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class K>
|
template <class K>
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
CGAL::Object
|
|
||||||
#else
|
|
||||||
boost::optional< boost::variant<typename K::Point_3,
|
boost::optional< boost::variant<typename K::Point_3,
|
||||||
typename K::Line_3,
|
typename K::Line_3,
|
||||||
typename K::Plane_3> >
|
typename K::Plane_3> >
|
||||||
#endif
|
|
||||||
intersection(const typename K::Plane_3 &plane1,
|
intersection(const typename K::Plane_3 &plane1,
|
||||||
const typename K::Plane_3 &plane2,
|
const typename K::Plane_3 &plane2,
|
||||||
const typename K::Plane_3 &plane3,
|
const typename K::Plane_3 &plane3,
|
||||||
const K& k)
|
const K& k)
|
||||||
{
|
{
|
||||||
#if CGAL_INTERSECTION_VERSION > 1
|
|
||||||
typedef
|
typedef
|
||||||
typename boost::optional<
|
typename boost::optional<
|
||||||
boost::variant<typename K::Point_3,
|
boost::variant<typename K::Point_3,
|
||||||
typename K::Line_3,
|
typename K::Line_3,
|
||||||
typename K::Plane_3> >
|
typename K::Plane_3> >
|
||||||
result_type;
|
result_type;
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef typename K::Point_3 Point_3;
|
typedef typename K::Point_3 Point_3;
|
||||||
typedef typename K::Line_3 Line_3;
|
typedef typename K::Line_3 Line_3;
|
||||||
|
|
@ -232,17 +221,9 @@ intersection(const typename K::Plane_3 &plane1,
|
||||||
v = internal::intersection(plane3, *l, k);
|
v = internal::intersection(plane3, *l, k);
|
||||||
if(v) {
|
if(v) {
|
||||||
if(const Point_3* p = intersect_get<Point_3>(v))
|
if(const Point_3* p = intersect_get<Point_3>(v))
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
return make_object(*p);
|
|
||||||
#else
|
|
||||||
return result_type(*p);
|
return result_type(*p);
|
||||||
#endif
|
|
||||||
else if(const Line_3* l = intersect_get<Line_3>(v))
|
else if(const Line_3* l = intersect_get<Line_3>(v))
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
return make_object(*l);
|
|
||||||
#else
|
|
||||||
return result_type(*l);
|
return result_type(*l);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
} else if(const Plane_3 *pl = intersect_get<Plane_3>(o12)) {
|
} else if(const Plane_3 *pl = intersect_get<Plane_3>(o12)) {
|
||||||
// either line or plane
|
// either line or plane
|
||||||
|
|
@ -250,26 +231,14 @@ intersection(const typename K::Plane_3 &plane1,
|
||||||
v = internal::intersection(plane3, *pl, k);
|
v = internal::intersection(plane3, *pl, k);
|
||||||
if(v) {
|
if(v) {
|
||||||
if(const Plane_3* p = intersect_get<Plane_3>(v))
|
if(const Plane_3* p = intersect_get<Plane_3>(v))
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
return make_object(*p);
|
|
||||||
#else
|
|
||||||
return result_type(*p);
|
return result_type(*p);
|
||||||
#endif
|
|
||||||
else if(const Line_3* l = intersect_get<Line_3>(v))
|
else if(const Line_3* l = intersect_get<Line_3>(v))
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
return make_object(*l);
|
|
||||||
#else
|
|
||||||
return result_type(*l);
|
return result_type(*l);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
return Object();
|
|
||||||
#else
|
|
||||||
return result_type();
|
return result_type();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -444,16 +413,7 @@ intersection(const typename K::Segment_3 &s1,
|
||||||
v = internal::intersection(s1.supporting_line(),s2.supporting_line(), K());
|
v = internal::intersection(s1.supporting_line(),s2.supporting_line(), K());
|
||||||
|
|
||||||
if(v) {
|
if(v) {
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
// abuse the visitor to do the visitation manually
|
|
||||||
L_p_visitor<K> visitor(s1, s2);
|
|
||||||
if(const typename K::Point_3* p = object_cast<typename K::Point_3>(&v))
|
|
||||||
return visitor(*p);
|
|
||||||
if(const typename K::Line_3* l = object_cast<typename K::Line_3>(&v))
|
|
||||||
return visitor(*l);
|
|
||||||
#else
|
|
||||||
return apply_visitor(L_p_visitor<K>(s1, s2) , *v);
|
return apply_visitor(L_p_visitor<K>(s1, s2) , *v);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return intersection_return<typename K::Intersect_3, typename K::Segment_3, typename K::Segment_3>();
|
return intersection_return<typename K::Intersect_3, typename K::Segment_3, typename K::Segment_3>();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,5 @@
|
||||||
/// \file intersections.h
|
/// \file intersections.h
|
||||||
|
|
||||||
/*!
|
|
||||||
\def CGAL_INTERSECTION_VERSION
|
|
||||||
|
|
||||||
\ingroup intersection_grp
|
|
||||||
|
|
||||||
The macro `CGAL_INTERSECTION_VERSION` can be used to configure
|
|
||||||
which version of the \ref intersection_grp function should be used and
|
|
||||||
enables the corresponding APIs in other \cgal packages. It should be
|
|
||||||
defined before any \cgal header is included.
|
|
||||||
|
|
||||||
- `CGAL_INTERSECTION_VERSION == 1` \ref intersection_grp uses `Object`
|
|
||||||
- `CGAL_INTERSECTION_VERSION == 2` \ref intersection_grp uses `boost::optional< boost::variant< T... > >`
|
|
||||||
|
|
||||||
*/
|
|
||||||
#define CGAL_INTERSECTION_VERSION
|
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
@ -93,20 +77,6 @@ bool do_intersect(Type1<Kernel> obj1, Type2<Kernel> obj2);
|
||||||
\details Depending on which \cgal kernel is used, different overloads of this global
|
\details Depending on which \cgal kernel is used, different overloads of this global
|
||||||
function are available.
|
function are available.
|
||||||
|
|
||||||
\cgalHeading{Notes on Backward Compatibility}
|
|
||||||
|
|
||||||
The \ref intersection_grp function used to return an `Object`, but starting with
|
|
||||||
\cgal 4.2 the
|
|
||||||
return type is determined by a metafunction defined by the kernel. To
|
|
||||||
preserve backward compatibility `Object` can be
|
|
||||||
constructed from the new return types implicitly, but switching to the
|
|
||||||
new style is recommended. To enable the old style without any overhead,
|
|
||||||
the macro \link CGAL_INTERSECTION_VERSION `CGAL_INTERSECTION_VERSION` \endlink must be defined to
|
|
||||||
`1` before any \cgal header is included.
|
|
||||||
|
|
||||||
\sa \ref upgrading_object
|
|
||||||
\sa \ref do_intersect_grp
|
|
||||||
\sa CGAL_INTERSECTION_VERSION
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
||||||
|
|
@ -717,55 +717,3 @@ and No. 28155 (GALIA).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
} /* namespace CGAL */
|
} /* namespace CGAL */
|
||||||
|
|
||||||
/*!
|
|
||||||
\page upgrading_object Upgrading from CGAL::Object to boost::variant
|
|
||||||
|
|
||||||
Code can be upgraded by using either `boost::get` or the
|
|
||||||
`boost::static_visitor<T>`.
|
|
||||||
|
|
||||||
\code
|
|
||||||
#include <CGAL/intersections.h>
|
|
||||||
|
|
||||||
template<typename R>
|
|
||||||
struct Intersection_visitor : public boost::static_visitor<> {
|
|
||||||
void operator()(const Point_2& p) const
|
|
||||||
{ // Point_2
|
|
||||||
}
|
|
||||||
void operator()(const Segment_2& s) const
|
|
||||||
{ // Segment_2
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class R>
|
|
||||||
void foo(Segment_2<R> seg, Line_2<R> lin)
|
|
||||||
{
|
|
||||||
CGAL::Object obj = intersection(seg, lin);
|
|
||||||
if(const Point_2* foo = object_cast<Point_2>(&obj)) {
|
|
||||||
// Point_2
|
|
||||||
} else if(const Segment_2* foo = object_cast<Segment_2>(&obj)) {
|
|
||||||
// Segment_2
|
|
||||||
} else {
|
|
||||||
// empty
|
|
||||||
}
|
|
||||||
|
|
||||||
// becomes
|
|
||||||
auto result = intersection(seg, lin);
|
|
||||||
if(result) {
|
|
||||||
if(const Point_2* foo = boost::get<Point_2>(&*result)) {
|
|
||||||
// Point_2
|
|
||||||
} else if(const Segment_2* foo = boost::get<Segment_2>(&*result)) {
|
|
||||||
// Segment_2
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// empty
|
|
||||||
}
|
|
||||||
|
|
||||||
// or with boost::static_visitor<T>
|
|
||||||
if(result) { boost::apply_visitor(Intersection_visitor(), *result); }
|
|
||||||
else { // empty
|
|
||||||
}
|
|
||||||
}
|
|
||||||
\endcode
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
|
||||||
|
|
@ -3487,11 +3487,6 @@ namespace CommonKernelFunctors {
|
||||||
typedef typename Intersection_traits<K, A, B>::result_type type;
|
typedef typename Intersection_traits<K, A, B>::result_type type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Solely to make the lazy kernel work
|
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
typedef CGAL::Object result_type;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// 25 possibilities, so I keep the template.
|
// 25 possibilities, so I keep the template.
|
||||||
template <class T1, class T2>
|
template <class T1, class T2>
|
||||||
typename Intersection_traits<K, T1, T2>::result_type
|
typename Intersection_traits<K, T1, T2>::result_type
|
||||||
|
|
@ -3520,22 +3515,13 @@ namespace CommonKernelFunctors {
|
||||||
typename K::Plane_3 > > type;
|
typename K::Plane_3 > > type;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Solely to make the lazy kernel work
|
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
typedef CGAL::Object result_type;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// n possibilities, so I keep the template.
|
// n possibilities, so I keep the template.
|
||||||
template <class T1, class T2>
|
template <class T1, class T2>
|
||||||
typename cpp11::result_of< Intersect_3(T1, T2) >::type
|
typename cpp11::result_of< Intersect_3(T1, T2) >::type
|
||||||
operator()(const T1& t1, const T2& t2) const
|
operator()(const T1& t1, const T2& t2) const
|
||||||
{ return Intersections::internal::intersection(t1, t2, K() ); }
|
{ return Intersections::internal::intersection(t1, t2, K() ); }
|
||||||
|
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
CGAL::Object
|
|
||||||
#else
|
|
||||||
typename boost::optional< boost::variant< typename K::Point_3, typename K::Line_3, typename K::Plane_3 > >
|
typename boost::optional< boost::variant< typename K::Point_3, typename K::Line_3, typename K::Plane_3 > >
|
||||||
#endif
|
|
||||||
operator()(const Plane_3& pl1, const Plane_3& pl2, const Plane_3& pl3)const
|
operator()(const Plane_3& pl1, const Plane_3& pl2, const Plane_3& pl3)const
|
||||||
{ return Intersections::internal::intersection(pl1, pl2, pl3, K() ); }
|
{ return Intersections::internal::intersection(pl1, pl2, pl3, K() ); }
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,3 @@
|
||||||
#ifdef CGAL_INTERSECTION_VERSION
|
|
||||||
#undef CGAL_INTERSECTION_VERSION
|
|
||||||
#endif
|
|
||||||
#define CGAL_INTERSECTION_VERSION 2
|
|
||||||
|
|
||||||
#include <CGAL/_test_all_linear_intersections.h>
|
#include <CGAL/_test_all_linear_intersections.h>
|
||||||
|
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
#define CGAL_INTERSECTION_VERSION 1
|
|
||||||
|
|
||||||
#include <CGAL/_test_all_linear_intersections.h>
|
|
||||||
|
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
|
||||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
|
||||||
|
|
||||||
|
|
||||||
typedef CGAL::Exact_predicates_exact_constructions_kernel K1;
|
|
||||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K2;
|
|
||||||
typedef CGAL::Simple_cartesian<double> K3;
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
test_linear_intersections<K1,K2>();
|
|
||||||
test_linear_intersections<K2,K1>();
|
|
||||||
test_linear_intersections<K1,K3>();
|
|
||||||
test_linear_intersections<K3,K1>();
|
|
||||||
test_linear_intersections<K3,K2>();
|
|
||||||
test_linear_intersections<K2,K3>();
|
|
||||||
}
|
|
||||||
|
|
@ -157,8 +157,7 @@ void foo(Segment_d<R> seg, Line_d<R> lin)
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
\sa `do_intersect`
|
\sa `do_intersect`
|
||||||
\sa `Kernel_d::Intersect_d`
|
\sa `Kernel_d::Intersect_d`
|
||||||
\sa CGAL_INTERSECTION_VERSION
|
|
||||||
\sa <a HREF="https://www.boost.org/doc/libs/release/libs/optional/index.html">`boost::optional`</a>
|
\sa <a HREF="https://www.boost.org/doc/libs/release/libs/optional/index.html">`boost::optional`</a>
|
||||||
\sa <a HREF="https://www.boost.org/doc/html/variant.html">`boost::variant`</a>
|
\sa <a HREF="https://www.boost.org/doc/html/variant.html">`boost::variant`</a>
|
||||||
\sa `cpp11::result_of`
|
\sa `cpp11::result_of`
|
||||||
|
|
|
||||||
|
|
@ -151,15 +151,6 @@ private:
|
||||||
typedef typename R::Hyperplane_d Hyperplane_d;
|
typedef typename R::Hyperplane_d Hyperplane_d;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Solely to make the lazy kernel work
|
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
typedef CGAL::Object result_type;
|
|
||||||
|
|
||||||
template <class T1, class T2>
|
|
||||||
result_type
|
|
||||||
operator()(const T1& t1, const T2& t2) const
|
|
||||||
{ return internal::intersection(t1, t2, R()); }
|
|
||||||
#else
|
|
||||||
template <typename>
|
template <typename>
|
||||||
struct result;
|
struct result;
|
||||||
|
|
||||||
|
|
@ -223,7 +214,6 @@ public:
|
||||||
typename result<Intersect(T1,T2)>::type
|
typename result<Intersect(T1,T2)>::type
|
||||||
operator()(const T1& t1, const T2& t2) const
|
operator()(const T1& t1, const T2& t2) const
|
||||||
{ return Intersections::internal::intersection(t1, t2, R()); }
|
{ return Intersections::internal::intersection(t1, t2, R()); }
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R>
|
template<class R>
|
||||||
|
|
|
||||||
|
|
@ -603,13 +603,8 @@ public:
|
||||||
clipped = CGAL::intersection(query, r_domain_.bbox_);
|
clipped = CGAL::intersection(query, r_domain_.bbox_);
|
||||||
|
|
||||||
if(clipped)
|
if(clipped)
|
||||||
#if CGAL_INTERSECTION_VERSION > 1
|
|
||||||
if(const Segment_3* s = boost::get<Segment_3>(&*clipped))
|
if(const Segment_3* s = boost::get<Segment_3>(&*clipped))
|
||||||
return this->operator()(*s);
|
return this->operator()(*s);
|
||||||
#else
|
|
||||||
if(const Segment_3* s = object_cast<Segment_3>(&clipped))
|
|
||||||
return this->operator()(*s);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return Surface_patch();
|
return Surface_patch();
|
||||||
}
|
}
|
||||||
|
|
@ -738,13 +733,8 @@ public:
|
||||||
clipped = CGAL::intersection(query, r_domain_.bbox_);
|
clipped = CGAL::intersection(query, r_domain_.bbox_);
|
||||||
|
|
||||||
if(clipped)
|
if(clipped)
|
||||||
#if CGAL_INTERSECTION_VERSION > 1
|
|
||||||
if(const Segment_3* s = boost::get<Segment_3>(&*clipped))
|
if(const Segment_3* s = boost::get<Segment_3>(&*clipped))
|
||||||
return this->operator()(*s);
|
return this->operator()(*s);
|
||||||
#else
|
|
||||||
if(const Segment_3* s = object_cast<Segment_3>(&clipped))
|
|
||||||
return this->operator()(*s);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return Intersection();
|
return Intersection();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -320,11 +320,7 @@ ts_intersection(const typename K::Triangle_3 &t,
|
||||||
&& orientation(p,q,c,a) != POSITIVE )
|
&& orientation(p,q,c,a) != POSITIVE )
|
||||||
{
|
{
|
||||||
// The intersection is a point
|
// The intersection is a point
|
||||||
#if CGAL_INTERSECTION_VERSION > 1
|
|
||||||
return result_type( lp_intersection(p, q, a, b, c, k) );
|
return result_type( lp_intersection(p, q, a, b, c, k) );
|
||||||
#else
|
|
||||||
return make_object( lp_intersection(p, q, a, b, c, k) );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return result_type();
|
return result_type();
|
||||||
|
|
@ -336,11 +332,7 @@ ts_intersection(const typename K::Triangle_3 &t,
|
||||||
&& orientation(p,q,b,c) != POSITIVE
|
&& orientation(p,q,b,c) != POSITIVE
|
||||||
&& orientation(p,q,c,a) != POSITIVE)
|
&& orientation(p,q,c,a) != POSITIVE)
|
||||||
{
|
{
|
||||||
#if CGAL_INTERSECTION_VERSION > 1
|
|
||||||
return result_type(q);
|
return result_type(q);
|
||||||
#else
|
|
||||||
return make_object(q);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else return result_type();
|
else return result_type();
|
||||||
}
|
}
|
||||||
|
|
@ -353,11 +345,7 @@ ts_intersection(const typename K::Triangle_3 &t,
|
||||||
&& orientation(q,p,c,a) != POSITIVE )
|
&& orientation(q,p,c,a) != POSITIVE )
|
||||||
{
|
{
|
||||||
// The intersection is a point
|
// The intersection is a point
|
||||||
#if CGAL_INTERSECTION_VERSION > 1
|
|
||||||
return result_type( lp_intersection(p, q, a, b, c, k) );
|
return result_type( lp_intersection(p, q, a, b, c, k) );
|
||||||
#else
|
|
||||||
return make_object( lp_intersection(p, q, a, b, c, k) );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return result_type();
|
return result_type();
|
||||||
|
|
@ -374,11 +362,7 @@ ts_intersection(const typename K::Triangle_3 &t,
|
||||||
&& orientation(q,p,b,c) != POSITIVE
|
&& orientation(q,p,b,c) != POSITIVE
|
||||||
&& orientation(q,p,c,a) != POSITIVE)
|
&& orientation(q,p,c,a) != POSITIVE)
|
||||||
{
|
{
|
||||||
#if CGAL_INTERSECTION_VERSION > 1
|
|
||||||
return result_type(q);
|
return result_type(q);
|
||||||
#else
|
|
||||||
return make_object(q);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else return result_type();
|
else return result_type();
|
||||||
}
|
}
|
||||||
|
|
@ -390,11 +374,7 @@ ts_intersection(const typename K::Triangle_3 &t,
|
||||||
&& orientation(q,p,b,c) != POSITIVE
|
&& orientation(q,p,b,c) != POSITIVE
|
||||||
&& orientation(q,p,c,a) != POSITIVE)
|
&& orientation(q,p,c,a) != POSITIVE)
|
||||||
{
|
{
|
||||||
#if CGAL_INTERSECTION_VERSION > 1
|
|
||||||
return result_type(p);
|
return result_type(p);
|
||||||
#else
|
|
||||||
return make_object(p);
|
|
||||||
#endif
|
|
||||||
} else
|
} else
|
||||||
return result_type();
|
return result_type();
|
||||||
case NEGATIVE:
|
case NEGATIVE:
|
||||||
|
|
@ -403,11 +383,7 @@ ts_intersection(const typename K::Triangle_3 &t,
|
||||||
&& orientation(p,q,b,c) != POSITIVE
|
&& orientation(p,q,b,c) != POSITIVE
|
||||||
&& orientation(p,q,c,a) != POSITIVE)
|
&& orientation(p,q,c,a) != POSITIVE)
|
||||||
{
|
{
|
||||||
#if CGAL_INTERSECTION_VERSION > 1
|
|
||||||
return result_type(p);
|
return result_type(p);
|
||||||
#else
|
|
||||||
return make_object(p);
|
|
||||||
#endif
|
|
||||||
} else
|
} else
|
||||||
return result_type();
|
return result_type();
|
||||||
case COPLANAR:
|
case COPLANAR:
|
||||||
|
|
@ -487,11 +463,7 @@ tr_intersection(const typename K::Triangle_3 &t,
|
||||||
if ( orientation(p,q,a,b) != abcp
|
if ( orientation(p,q,a,b) != abcp
|
||||||
&& orientation(p,q,b,c) != abcp
|
&& orientation(p,q,b,c) != abcp
|
||||||
&& orientation(p,q,c,a) != abcp )
|
&& orientation(p,q,c,a) != abcp )
|
||||||
#if CGAL_INTERSECTION_VERSION > 1
|
|
||||||
return result_type(lp_intersection(p, q, a, b, c, k));
|
return result_type(lp_intersection(p, q, a, b, c, k));
|
||||||
#else
|
|
||||||
return make_object(lp_intersection(p, q, a, b, c, k));
|
|
||||||
#endif
|
|
||||||
else
|
else
|
||||||
return result_type();
|
return result_type();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -582,26 +582,16 @@ public:
|
||||||
AABB_primitive_id primitive_id = intersection->second;
|
AABB_primitive_id primitive_id = intersection->second;
|
||||||
|
|
||||||
// intersection may be either a point or a segment
|
// intersection may be either a point or a segment
|
||||||
#if CGAL_INTERSECTION_VERSION > 1
|
|
||||||
if ( const Bare_point* p_intersect_pt =
|
if ( const Bare_point* p_intersect_pt =
|
||||||
boost::get<Bare_point>( &(intersection->first) ) )
|
boost::get<Bare_point>( &(intersection->first) ) )
|
||||||
#else
|
|
||||||
if ( const Bare_point* p_intersect_pt =
|
|
||||||
object_cast<Bare_point>( &(intersection->first) ) )
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
return Intersection(*p_intersect_pt,
|
return Intersection(*p_intersect_pt,
|
||||||
r_domain_.index_from_surface_patch_index(
|
r_domain_.index_from_surface_patch_index(
|
||||||
r_domain_.make_surface_index(primitive_id)),
|
r_domain_.make_surface_index(primitive_id)),
|
||||||
2);
|
2);
|
||||||
}
|
}
|
||||||
#if CGAL_INTERSECTION_VERSION > 1
|
|
||||||
else if ( const Segment_3* p_intersect_seg =
|
else if ( const Segment_3* p_intersect_seg =
|
||||||
boost::get<Segment_3>(&(intersection->first)))
|
boost::get<Segment_3>(&(intersection->first)))
|
||||||
#else
|
|
||||||
else if ( const Segment_3* p_intersect_seg =
|
|
||||||
object_cast<Segment_3>(&(intersection->first)))
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
CGAL_MESH_3_PROFILER("Mesh_3 profiler: Intersection is a segment");
|
CGAL_MESH_3_PROFILER("Mesh_3 profiler: Intersection is a segment");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,11 +78,7 @@ class First_intersection_traits
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef
|
typedef
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
boost::optional<Object_and_primitive_id>
|
|
||||||
#else
|
|
||||||
boost::optional< typename AABBTraits::template Intersection_and_primitive_id<Query>::Type >
|
boost::optional< typename AABBTraits::template Intersection_and_primitive_id<Query>::Type >
|
||||||
#endif
|
|
||||||
Result;
|
Result;
|
||||||
public:
|
public:
|
||||||
First_intersection_traits(const AABBTraits& traits)
|
First_intersection_traits(const AABBTraits& traits)
|
||||||
|
|
@ -137,11 +133,7 @@ public:
|
||||||
|
|
||||||
void intersection(const Query& query, const Primitive& primitive)
|
void intersection(const Query& query, const Primitive& primitive)
|
||||||
{
|
{
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
boost::optional<Object_and_primitive_id>
|
|
||||||
#else
|
|
||||||
boost::optional< typename AABBTraits::template Intersection_and_primitive_id<Query>::Type >
|
boost::optional< typename AABBTraits::template Intersection_and_primitive_id<Query>::Type >
|
||||||
#endif
|
|
||||||
intersection = m_traits.intersection_object()(query, primitive);
|
intersection = m_traits.intersection_object()(query, primitive);
|
||||||
|
|
||||||
if(intersection)
|
if(intersection)
|
||||||
|
|
|
||||||
|
|
@ -285,11 +285,7 @@ public:
|
||||||
/// for which `do_intersect` predicates
|
/// for which `do_intersect` predicates
|
||||||
/// and intersections are defined in the traits class AABBTraits.
|
/// and intersections are defined in the traits class AABBTraits.
|
||||||
template <typename Query>
|
template <typename Query>
|
||||||
#if CGAL_INTERSECTION_VERSION < 2 && !defined(DOXYGEN_RUNNING)
|
|
||||||
boost::optional<Object_and_primitive_id>
|
|
||||||
#else
|
|
||||||
boost::optional< typename Intersection_and_primitive_id<Query>::Type >
|
boost::optional< typename Intersection_and_primitive_id<Query>::Type >
|
||||||
#endif
|
|
||||||
any_intersection(const Query& query) const;
|
any_intersection(const Query& query) const;
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
@ -777,11 +773,7 @@ public:
|
||||||
|
|
||||||
template <typename Tr>
|
template <typename Tr>
|
||||||
template <typename Query>
|
template <typename Query>
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
boost::optional<typename AABB_tree_with_join<Tr>::Object_and_primitive_id>
|
|
||||||
#else
|
|
||||||
boost::optional< typename AABB_tree_with_join<Tr>::template Intersection_and_primitive_id<Query>::Type >
|
boost::optional< typename AABB_tree_with_join<Tr>::template Intersection_and_primitive_id<Query>::Type >
|
||||||
#endif
|
|
||||||
AABB_tree_with_join<Tr>::any_intersection(const Query& query) const
|
AABB_tree_with_join<Tr>::any_intersection(const Query& query) const
|
||||||
{
|
{
|
||||||
using namespace CGAL::internal::AABB_tree_with_join;
|
using namespace CGAL::internal::AABB_tree_with_join;
|
||||||
|
|
|
||||||
|
|
@ -83,10 +83,6 @@ namespace CGAL {
|
||||||
friend class Intersect_3;
|
friend class Intersect_3;
|
||||||
|
|
||||||
class Intersect_3 {
|
class Intersect_3 {
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
typedef boost::optional<typename Tree::Object_and_primitive_id>
|
|
||||||
AABB_intersection;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const Self& self;
|
const Self& self;
|
||||||
|
|
||||||
|
|
@ -97,11 +93,7 @@ namespace CGAL {
|
||||||
|
|
||||||
Object operator()(const Surface_3& surface, const Segment_3& segment) const
|
Object operator()(const Surface_3& surface, const Segment_3& segment) const
|
||||||
{
|
{
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
AABB_intersection
|
|
||||||
#else
|
|
||||||
boost::optional< typename AABB_traits::template Intersection_and_primitive_id<Segment_3>::Type >
|
boost::optional< typename AABB_traits::template Intersection_and_primitive_id<Segment_3>::Type >
|
||||||
#endif
|
|
||||||
intersection = surface.tree()->any_intersection(segment);
|
intersection = surface.tree()->any_intersection(segment);
|
||||||
|
|
||||||
if ( intersection )
|
if ( intersection )
|
||||||
|
|
@ -112,11 +104,7 @@ namespace CGAL {
|
||||||
|
|
||||||
Object operator()(const Surface_3& surface, const Line_3& line) const
|
Object operator()(const Surface_3& surface, const Line_3& line) const
|
||||||
{
|
{
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
AABB_intersection
|
|
||||||
#else
|
|
||||||
boost::optional< typename AABB_traits::template Intersection_and_primitive_id<Line_3>::Type >
|
boost::optional< typename AABB_traits::template Intersection_and_primitive_id<Line_3>::Type >
|
||||||
#endif
|
|
||||||
intersection = surface.tree()->any_intersection(line);
|
intersection = surface.tree()->any_intersection(line);
|
||||||
|
|
||||||
if ( intersection )
|
if ( intersection )
|
||||||
|
|
@ -126,11 +114,7 @@ namespace CGAL {
|
||||||
}
|
}
|
||||||
Object operator()(const Surface_3& surface, const Ray_3& ray) const
|
Object operator()(const Surface_3& surface, const Ray_3& ray) const
|
||||||
{
|
{
|
||||||
#if CGAL_INTERSECTION_VERSION < 2
|
|
||||||
AABB_intersection
|
|
||||||
#else
|
|
||||||
boost::optional< typename AABB_traits::template Intersection_and_primitive_id<Ray_3>::Type >
|
boost::optional< typename AABB_traits::template Intersection_and_primitive_id<Ray_3>::Type >
|
||||||
#endif
|
|
||||||
intersection = surface.tree()->any_intersection(ray);
|
intersection = surface.tree()->any_intersection(ray);
|
||||||
|
|
||||||
if ( intersection )
|
if ( intersection )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue