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
|
// Copyright (c) 2011 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.1/Intersections_2/include/CGAL/Intersection_traits_2.h $
// $Id: include/CGAL/Intersection_traits_2.h 08b27d3db14 $
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Philipp Möller
#ifndef CGAL_INTERSECTION_TRAITS_2_H
#define CGAL_INTERSECTION_TRAITS_2_H
#include <CGAL/Intersection_traits.h>
#include <CGAL/Bbox_2.h>
#include <variant>
#include <optional>
#include <vector>
namespace CGAL {
CGAL_INTERSECTION_TRAITS_2(Line_2, Line_2, Point_2, Line_2)
CGAL_INTERSECTION_TRAITS_2(Segment_2, Line_2, Point_2, Segment_2)
CGAL_INTERSECTION_TRAITS_2(Line_2, Segment_2, Point_2, Segment_2)
CGAL_INTERSECTION_TRAITS_2(Segment_2, Segment_2, Point_2, Segment_2)
CGAL_INTERSECTION_TRAITS_2(Ray_2, Line_2, Point_2, Ray_2)
CGAL_INTERSECTION_TRAITS_2(Line_2, Ray_2, Point_2, Ray_2)
CGAL_INTERSECTION_TRAITS_2(Ray_2, Segment_2, Point_2, Segment_2)
CGAL_INTERSECTION_TRAITS_2(Segment_2, Ray_2, Point_2, Segment_2)
CGAL_INTERSECTION_TRAITS_3(Ray_2, Ray_2, Point_2, Segment_2, Ray_2)
CGAL_INTERSECTION_TRAITS_2(Triangle_2, Line_2, Point_2, Segment_2)
CGAL_INTERSECTION_TRAITS_2(Line_2, Triangle_2, Point_2, Segment_2)
CGAL_INTERSECTION_TRAITS_2(Triangle_2, Segment_2, Point_2, Segment_2)
CGAL_INTERSECTION_TRAITS_2(Segment_2, Triangle_2, Point_2, Segment_2)
CGAL_INTERSECTION_TRAITS_2(Triangle_2, Ray_2, Point_2, Segment_2)
CGAL_INTERSECTION_TRAITS_2(Ray_2, Triangle_2, Point_2, Segment_2)
template<typename K>
struct Intersection_traits<K, typename K::Triangle_2, typename K::Triangle_2> {
typedef typename
std::variant< typename K::Point_2, typename K::Segment_2,
typename K::Triangle_2, typename std::vector< typename K::Point_2 > > variant_type;
typedef typename std::optional< variant_type > result_type;
};
CGAL_INTERSECTION_TRAITS_2(Iso_rectangle_2, Line_2, Point_2, Segment_2)
CGAL_INTERSECTION_TRAITS_2(Line_2, Iso_rectangle_2, Point_2, Segment_2)
CGAL_INTERSECTION_TRAITS_2(Iso_rectangle_2, Segment_2, Point_2, Segment_2)
CGAL_INTERSECTION_TRAITS_2(Segment_2, Iso_rectangle_2, Point_2, Segment_2)
CGAL_INTERSECTION_TRAITS_2(Iso_rectangle_2, Ray_2, Point_2, Segment_2)
CGAL_INTERSECTION_TRAITS_2(Ray_2, Iso_rectangle_2, Point_2, Segment_2)
// undocumented
// Variants of one for backwards compatibility
template<typename K>
struct Intersection_traits<K, typename K::Iso_rectangle_2, typename K::Iso_rectangle_2> {
typedef typename std::variant<typename K::Iso_rectangle_2> variant_type;
typedef std::optional<variant_type> result_type;
};
// Point_2 is special
template<typename K, typename B>
struct Intersection_traits<K, typename K::Point_2, B> {
typedef typename std::variant<typename K::Point_2> variant_type;
typedef std::optional<variant_type> result_type;
};
template<typename K, typename A>
struct Intersection_traits<K, A, typename K::Point_2> {
typedef typename std::variant<typename K::Point_2> variant_type;
typedef std::optional<variant_type> result_type;
};
template<typename K>
struct Intersection_traits<K, typename K::Point_2, typename K::Point_2> {
typedef typename std::variant<typename K::Point_2> variant_type;
typedef std::optional<variant_type> result_type;
};
template<typename K>
struct Intersection_traits<K, typename K::Iso_rectangle_2, typename K::Triangle_2>
{
typedef typename std::variant<typename K::Segment_2, typename K::Triangle_2,
typename K::Point_2,
typename std::vector< typename K::Point_2 > > variant_type;
typedef typename std::optional < variant_type > result_type;
};
template<typename K>
struct Intersection_traits<K, typename K::Triangle_2, typename K::Iso_rectangle_2>
: public Intersection_traits<K, typename K::Iso_rectangle_2, typename K::Triangle_2> {};
template<typename K, class B>
struct Intersection_traits<K, CGAL::Bbox_2, B> {
typedef typename Intersection_traits<K,typename K::Iso_rectangle_2, B>::result_type result_type;
};
template<typename K, class A>
struct Intersection_traits<K, A, CGAL::Bbox_2> {
typedef typename Intersection_traits<K,typename K::Iso_rectangle_2, A>::result_type result_type;
};
template<typename K>
struct Intersection_traits<K, CGAL::Bbox_2, typename K::Point_2> {
typedef typename std::variant<typename K::Point_2> variant_type;
typedef std::optional<variant_type> result_type;
};
template<typename K>
struct Intersection_traits<K, typename K::Point_2, CGAL::Bbox_2> {
typedef typename std::variant<typename K::Point_2> variant_type;
typedef std::optional<variant_type> result_type;
};
} // namespace CGAL
#endif /* CGAL_INTERSECTION_TRAITS_2_H */
|