1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202
|
// Copyright (c) 2013 GeometryFactory (France). All rights reserved.
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL: https://github.com/CGAL/cgal/blob/v6.1/Circular_kernel_2/include/CGAL/Circular_kernel_2/Intersection_traits.h $
// $Id: include/CGAL/Circular_kernel_2/Intersection_traits.h b26b07a1242 $
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
// $URL: https://github.com/CGAL/cgal/blob/v6.1/Circular_kernel_2/include/CGAL/Circular_kernel_2/Intersection_traits.h $
// $Id: include/CGAL/Circular_kernel_2/Intersection_traits.h b26b07a1242 $
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Philipp Möller and Sebastien Loriot
#ifndef CGAL_CIRCULAR_KERNEL_2_INTERSECTION_TRAITS_H
#define CGAL_CIRCULAR_KERNEL_2_INTERSECTION_TRAITS_H
#include <CGAL/license/Circular_kernel_2.h>
#include <CGAL/Intersection_traits.h>
#include <variant>
namespace CGAL {
template <typename CK, typename T1, typename T2>
struct CK2_Intersection_traits
{};
// Intersection_traits for the circular kernel
// The additional CGAL_ADDITIONAL_VARIANT_FOR_ICL ( = int) in the variant
// has the only purpose to work around a bug of the Intel compiler,
// which without it produces the error
// /usr/include/boost/type_traits/has_nothrow_copy.hpp(36): internal error: bad pointer
// template struct has_nothrow_copy_constructor : public integral_constant{};
// See also https://github.com/CGAL/cgal/issues/1581
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Circle_2, typename CK::Circle_2>
{
typedef typename
std::variant< typename CK::Circle_2,
typename std::pair< typename CK::Circular_arc_point_2,
unsigned int >
CGAL_ADDITIONAL_VARIANT_FOR_ICL
>
type;
};
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Circular_arc_2, typename CK::Circular_arc_2>
{
typedef typename
std::variant< typename CK::Circular_arc_2,
typename std::pair< typename CK::Circular_arc_point_2,
unsigned int >
CGAL_ADDITIONAL_VARIANT_FOR_ICL
>
type;
};
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Line_arc_2, typename CK::Line_arc_2>
{
typedef typename
std::variant< typename CK::Line_arc_2,
typename std::pair< typename CK::Circular_arc_point_2,
unsigned int >
CGAL_ADDITIONAL_VARIANT_FOR_ICL
>
type;
};
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Line_arc_2, typename CK::Circle_2>
{
typedef typename
std::variant< typename std::pair< typename CK::Circular_arc_point_2,
unsigned int >
CGAL_ADDITIONAL_VARIANT_FOR_ICL
>
type;
};
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Circle_2, typename CK::Line_arc_2>
: public CK2_Intersection_traits<CK, typename CK::Line_arc_2, typename CK::Circle_2>
{};
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Line_arc_2, typename CK::Circular_arc_2>
{
typedef typename
std::variant< typename std::pair< typename CK::Circular_arc_point_2,
unsigned int >
CGAL_ADDITIONAL_VARIANT_FOR_ICL
>
type;
};
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Circular_arc_2, typename CK::Line_arc_2>
: public CK2_Intersection_traits<CK, typename CK::Line_arc_2, typename CK::Circular_arc_2>
{};
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Line_arc_2, typename CK::Line_2>
{
typedef typename
std::variant< typename CK::Line_arc_2,
typename std::pair< typename CK::Circular_arc_point_2,
unsigned int >
CGAL_ADDITIONAL_VARIANT_FOR_ICL
>
type;
};
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Line_2, typename CK::Line_arc_2>
: public CK2_Intersection_traits<CK, typename CK::Line_arc_2, typename CK::Line_2>
{};
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Line_2, typename CK::Circular_arc_2>
{
typedef typename
std::variant< typename std::pair< typename CK::Circular_arc_point_2,
unsigned int >
CGAL_ADDITIONAL_VARIANT_FOR_ICL
>
type;
};
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Circular_arc_2, typename CK::Line_2>
: public CK2_Intersection_traits<CK, typename CK::Line_2, typename CK::Circular_arc_2>
{};
// Circular_arc_2 Circle_2 simply aliases
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Circular_arc_2, typename CK::Circle_2>
: public CK2_Intersection_traits<CK, typename CK::Circular_arc_2, typename CK::Circular_arc_2>
{};
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Circle_2, typename CK::Circular_arc_2>
: public CK2_Intersection_traits<CK, typename CK::Circular_arc_2, typename CK::Circular_arc_2>
{};
// !!! undocumented !!! //
// Line_2 Circle_2
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Line_2, typename CK::Circle_2>
{
typedef typename
std::variant< typename std::pair< typename CK::Circular_arc_point_2,
unsigned int >
CGAL_ADDITIONAL_VARIANT_FOR_ICL
>
type;
};
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Circle_2, typename CK::Line_2> :
public CK2_Intersection_traits<CK, typename CK::Line_2, typename CK::Circle_2>
{};
template<typename CK>
struct CK2_Intersection_traits<CK, typename CK::Line_2, typename CK::Line_2>
{
typedef typename Intersection_traits<CK, typename CK::Line_2, typename CK::Line_2>::result_type type;
};
} //end of namespace CGAL
namespace CGAL{
namespace internal{
// this function is used to call either make_object or a
// CK2_Intersection_traits::result_type constructor to create return
// values. The Object version takes some dummy template arguments
// that are needed for the return of the Intersection_traits. In
// theory a one parameter variant could be returned, but this
// _could_ come with conversion overhead and so we rather go for
// the real type.
// Overloads for empty returns are also provided.
template<typename RT, typename T>
inline RT
ck2_intersection_return(T&& t) { return RT(std::forward<T>(t)); }
template<typename RT>
inline RT
ck2_intersection_return() { return RT(); }
} } //end of namespace CGAL::internal
#endif // CGAL_CIRCULAR_KERNEL_2_INTERSECTION_TRAITS_H
|