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
|
// Copyright (c) 2005-2008 Fernando Luis Cacciola Carballal. All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
//
// $URL: https://github.com/CGAL/cgal/blob/v6.1.1/Straight_skeleton_2/include/CGAL/Polygon_offset_builder_traits_2.h $
// $Id: include/CGAL/Polygon_offset_builder_traits_2.h 08b27d3db14 $
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Fernando Cacciola <fernando_cacciola@ciudad.com.ar>
#ifndef CGAL_POLYGON_OFFSET_BUILDER_TRAITS_2_H
#define CGAL_POLYGON_OFFSET_BUILDER_TRAITS_2_H 1
#include <CGAL/license/Straight_skeleton_2.h>
#include <CGAL/Straight_skeleton_2/Straight_skeleton_aux.h>
#include <CGAL/Straight_skeleton_2/Straight_skeleton_builder_traits_2_aux.h>
#include <CGAL/Straight_skeleton_builder_traits_2.h>
#include <CGAL/predicates/Polygon_offset_pred_ftC2.h>
#include <CGAL/constructions/Polygon_offset_cons_ftC2.h>
#include <optional>
namespace CGAL {
namespace CGAL_SS_i {
template<class K>
struct Compare_offset_against_event_time_2 : Functor_base_2<K>
{
typedef Functor_base_2<K> Base ;
typedef typename Base::FT FT ;
typedef typename Base::Trisegment_2_ptr Trisegment_2_ptr ;
typedef Uncertain<Comparison_result> result_type ;
Uncertain<Comparison_result> operator() ( FT const& aT, Trisegment_2_ptr const& aE ) const
{
return compare_offset_against_isec_timeC2(aT,aE) ;
}
};
template<class K>
struct Construct_offset_point_2 : Functor_base_2<K>
{
typedef Functor_base_2<K> Base ;
typedef typename Base::FT FT ;
typedef typename Base::Point_2 Point_2 ;
typedef typename Base::Segment_2_with_ID Segment_2_with_ID ;
typedef typename Base::Trisegment_2_ptr Trisegment_2_ptr ;
typedef std::optional<Point_2> result_type ;
result_type operator() ( FT const& aT
, Segment_2_with_ID const& aE0
, FT const& aWeight0
, Segment_2_with_ID const& aE1
, FT const& aWeight1
, Trisegment_2_ptr const& aNode
) const
{
No_caches<K> no_caches;
result_type p = construct_offset_pointC2(aT,aE0,aWeight0,aE1,aWeight1,aNode, no_caches);
return p ;
}
};
} // namespace CGAL_SS_i
template<class K>
struct Polygon_offset_builder_traits_2_functors
{
typedef CGAL_SS_i::Compare_offset_against_event_time_2<K> Compare_offset_against_event_time_2 ;
typedef CGAL_SS_i::Compare_ss_event_times_2 <K> Compare_ss_event_times_2 ;
typedef CGAL_SS_i::Construct_offset_point_2 <K> Construct_offset_point_2 ;
typedef CGAL_SS_i::Construct_ss_event_time_and_point_2<K> Construct_ss_event_time_and_point_2 ;
} ;
template<class K>
struct Polygon_offset_builder_traits_2_base
{
typedef K Kernel ;
typedef typename K::FT FT ;
typedef typename K::Point_2 Point_2 ;
typedef CGAL_SS_i::Segment_2_with_ID<K> Segment_2 ;
typedef CGAL_SS_i::Segment_2_with_ID<K> Segment_2_with_ID ; // for BOOST_MPL_HAS_XXX_TRAIT_DEF
typedef CGAL::Trisegment_2<K, Segment_2_with_ID> Trisegment_2 ;
typedef typename Trisegment_2::Self_ptr Trisegment_2_ptr ;
} ;
template<class Is_filtered_kernel, class K>
class Polygon_offset_builder_traits_2_impl ;
template<class K>
class Polygon_offset_builder_traits_2_impl<Tag_false,K>
: public Polygon_offset_builder_traits_2_base<K>
{
typedef Polygon_offset_builder_traits_2_functors<K> Unfiltering ;
public:
typedef Unfiltered_predicate_adaptor<typename Unfiltering::Compare_offset_against_event_time_2>
Compare_offset_against_event_time_2 ;
typedef Unfiltered_predicate_adaptor<typename Unfiltering::Compare_ss_event_times_2>
Compare_ss_event_times_2 ;
typedef typename Unfiltering::Construct_offset_point_2 Construct_offset_point_2 ;
typedef typename Unfiltering::Construct_ss_event_time_and_point_2 Construct_ss_event_time_and_point_2 ;
} ;
template<class K>
class Polygon_offset_builder_traits_2_impl<Tag_true,K>
: public Polygon_offset_builder_traits_2_base<K>
{
typedef typename K::Exact_kernel EK ;
typedef typename K::Approximate_kernel FK ;
typedef Polygon_offset_builder_traits_2_functors<EK> Exact ;
typedef Polygon_offset_builder_traits_2_functors<FK> Filtering ;
typedef Polygon_offset_builder_traits_2_functors<K> Unfiltering ;
typedef Cartesian_converter<K,EK> BaseC2E;
typedef Cartesian_converter<K,FK> BaseC2F;
typedef Cartesian_converter<EK,K> BaseE2C;
typedef Cartesian_converter<FK,K> BaseF2C;
typedef Cartesian_converter<K,K> BaseC2C;
typedef CGAL_SS_i::SS_converter<BaseC2E> C2E ;
typedef CGAL_SS_i::SS_converter<BaseC2F> C2F ;
typedef CGAL_SS_i::SS_converter<BaseE2C> E2C ;
typedef CGAL_SS_i::SS_converter<BaseF2C> F2C ;
typedef CGAL_SS_i::SS_converter<BaseC2C> C2C ;
public:
typedef Filtered_predicate<typename Exact ::Compare_offset_against_event_time_2
,typename Filtering::Compare_offset_against_event_time_2
, C2E
, C2F
>
Compare_offset_against_event_time_2 ;
typedef Filtered_predicate< typename Exact ::Compare_ss_event_times_2
, typename Filtering::Compare_ss_event_times_2
, C2E
, C2F
>
Compare_ss_event_times_2 ;
typedef CGAL_SS_i::Exceptionless_filtered_construction< typename Unfiltering::Construct_offset_point_2
, typename Exact ::Construct_offset_point_2
, typename Filtering::Construct_offset_point_2
, C2E
, C2F
, E2C
, F2C
>
Construct_offset_point_2 ;
typedef CGAL_SS_i::Exceptionless_filtered_construction< typename Unfiltering::Construct_ss_event_time_and_point_2
, typename Exact ::Construct_ss_event_time_and_point_2
, typename Filtering::Construct_ss_event_time_and_point_2
, C2E
, C2F
, E2C
, F2C
>
Construct_ss_event_time_and_point_2 ;
} ;
template<class K>
class Polygon_offset_builder_traits_2
: public Polygon_offset_builder_traits_2_impl<typename CGAL_SS_i::Is_filtering_kernel<K>::type,K>
{
typedef Polygon_offset_builder_traits_2_impl<typename CGAL_SS_i::Is_filtering_kernel<K>::type,K> Base ;
public:
typedef typename Base::Compare_offset_against_event_time_2 Compare_offset_against_event_time_2 ;
typedef typename Base::Compare_ss_event_times_2 Compare_ss_event_times_2 ;
typedef typename Base::Construct_offset_point_2 Construct_offset_point_2 ;
typedef typename Base::Construct_ss_event_time_and_point_2 Construct_ss_event_time_and_point_2 ;
Compare_offset_against_event_time_2 compare_offset_against_event_time_2_object() const
{ return Compare_offset_against_event_time_2() ; }
Compare_ss_event_times_2 compare_ss_event_times_2_object() const
{ return Compare_ss_event_times_2() ; }
Construct_offset_point_2 construct_offset_point_2_object() const
{ return Construct_offset_point_2() ; }
Construct_ss_event_time_and_point_2 construct_ss_event_time_and_point_2_object() const
{ return Construct_ss_event_time_and_point_2() ; }
} ;
} // namespace CGAL
#endif // CGAL_POLYGON_OFFSET_BUILDER_TRAITS_2_H
|