/usr/include/CGAL/box_intersection_d.h is in libcgal-dev 4.2-5ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | // Copyright (c) 2004 Max-Planck-Institute Saarbruecken (Germany).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
//
// Author(s) : Lutz Kettner <kettner@mpi-sb.mpg.de>
// Andreas Meyer <ameyer@mpi-sb.mpg.de>
#ifndef CGAL_BOX_INTERSECTION_D_H
#define CGAL_BOX_INTERSECTION_D_H
#include <CGAL/Box_intersection_d/segment_tree.h>
#include <CGAL/Box_intersection_d/Box_d.h>
#include <CGAL/Box_intersection_d/Box_with_handle_d.h>
#include <CGAL/Box_intersection_d/Box_traits_d.h>
#include <CGAL/Box_intersection_d/box_limits.h>
#include <vector>
namespace CGAL {
// Generic call with custom predicate traits parameter.
template< class RandomAccessIter1, class RandomAccessIter2,
class Callback, class BoxPredicateTraits >
void box_intersection_custom_predicates_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
Callback callback,
BoxPredicateTraits traits,
std::ptrdiff_t cutoff = 10,
Box_intersection_d::Setting setting = Box_intersection_d::BIPARTITE)
{
typedef BoxPredicateTraits Traits;
typedef typename Traits::NT NT;
CGAL_assertion( Traits::dimension() > 0 );
const int dim = Traits::dimension() - 1;
const NT inf = Box_intersection_d::box_limits<NT>::inf();
const NT sup = Box_intersection_d::box_limits<NT>::sup();
Box_intersection_d::segment_tree(begin1, end1, begin2, end2,
inf, sup, callback, traits, cutoff, dim, true);
if(setting == Box_intersection_d::BIPARTITE)
Box_intersection_d::segment_tree(begin2, end2, begin1, end1,
inf, sup, callback, traits, cutoff, dim, false);
}
// Generic call with box traits parameter.
// - make all default parameters explicit overloads (workaround)
template< class RandomAccessIter1, class RandomAccessIter2,
class Callback, class BoxTraits >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
Callback callback,
BoxTraits,
std::ptrdiff_t cutoff,
Box_intersection_d::Topology topology,
Box_intersection_d::Setting setting)
{
if (topology == Box_intersection_d::CLOSED) {
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,true> Traits;
box_intersection_custom_predicates_d(begin1, end1, begin2, end2,
callback, Traits(), cutoff, setting);
} else {
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,false> Traits;
box_intersection_custom_predicates_d(begin1, end1, begin2, end2,
callback, Traits(), cutoff, setting);
}
}
template< class RandomAccessIter1, class RandomAccessIter2,
class Callback, class BoxTraits >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
Callback callback, BoxTraits box_traits, std::ptrdiff_t cutoff,
Box_intersection_d::Topology topology)
{
box_intersection_d( begin1, end1, begin2, end2, callback, box_traits,
cutoff, topology, Box_intersection_d::BIPARTITE);
}
template< class RandomAccessIter1, class RandomAccessIter2,
class Callback, class BoxTraits >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
Callback callback, BoxTraits box_traits, std::ptrdiff_t cutoff)
{
box_intersection_d( begin1, end1, begin2, end2, callback, box_traits,
cutoff, Box_intersection_d::CLOSED,
Box_intersection_d::BIPARTITE);
}
template< class RandomAccessIter1, class RandomAccessIter2,
class Callback, class BoxTraits >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
Callback callback, BoxTraits box_traits)
{
box_intersection_d( begin1, end1, begin2, end2, callback, box_traits,
10, Box_intersection_d::CLOSED,
Box_intersection_d::BIPARTITE);
}
// Specialized call with default box traits.
// - make all default parameters explicit overloads (workaround)
template< class RandomAccessIter1, class RandomAccessIter2, class Callback >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
Callback callback, std::ptrdiff_t cutoff,
Box_intersection_d::Topology topology,
Box_intersection_d::Setting setting)
{
typedef typename std::iterator_traits<RandomAccessIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_d( begin1, end1, begin2, end2, callback, Box_traits(),
cutoff, topology, setting);
}
template< class RandomAccessIter1, class RandomAccessIter2, class Callback >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
Callback callback, std::ptrdiff_t cutoff,
Box_intersection_d::Topology topology)
{
typedef typename std::iterator_traits<RandomAccessIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_d( begin1, end1, begin2, end2, callback, Box_traits(),
cutoff, topology, Box_intersection_d::BIPARTITE);
}
template< class RandomAccessIter1, class RandomAccessIter2, class Callback >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
Callback callback, std::ptrdiff_t cutoff)
{
typedef typename std::iterator_traits<RandomAccessIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_d( begin1, end1, begin2, end2, callback, Box_traits(),
cutoff, Box_intersection_d::CLOSED,
Box_intersection_d::BIPARTITE);
}
template< class RandomAccessIter1, class RandomAccessIter2, class Callback >
void box_intersection_d(
RandomAccessIter1 begin1, RandomAccessIter1 end1,
RandomAccessIter2 begin2, RandomAccessIter2 end2,
Callback callback)
{
typedef typename std::iterator_traits<RandomAccessIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_d( begin1, end1, begin2, end2, callback, Box_traits(),
10, Box_intersection_d::CLOSED,
Box_intersection_d::BIPARTITE);
}
// Generic call with box traits parameter, specialized for self-intersection.
// - make all default parameters explicit overloads (workaround)
template< class RandomAccessIter, class Callback, class BoxTraits >
void box_self_intersection_d(
RandomAccessIter begin, RandomAccessIter end,
Callback callback,
BoxTraits box_traits)
{
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t;
std::vector< val_t> i( begin, end);
box_intersection_d( begin, end, i.begin(), i.end(),
callback, box_traits, 10,
Box_intersection_d::CLOSED,
Box_intersection_d::COMPLETE);
}
template< class RandomAccessIter, class Callback, class BoxTraits >
void box_self_intersection_d(
RandomAccessIter begin, RandomAccessIter end,
Callback callback,
BoxTraits box_traits,
std::ptrdiff_t cutoff)
{
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t;
std::vector< val_t> i( begin, end);
box_intersection_d( begin, end, i.begin(), i.end(),
callback, box_traits, cutoff,
Box_intersection_d::CLOSED,
Box_intersection_d::COMPLETE);
}
template< class RandomAccessIter, class Callback, class BoxTraits >
void box_self_intersection_d(
RandomAccessIter begin, RandomAccessIter end,
Callback callback,
BoxTraits box_traits,
std::ptrdiff_t cutoff,
Box_intersection_d::Topology topology)
{
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t;
std::vector< val_t> i( begin, end);
box_intersection_d( begin, end, i.begin(), i.end(),
callback, box_traits, cutoff, topology, Box_intersection_d::COMPLETE);
}
// Specialized call with default box traits, specialized for self-intersection.
// - make all default parameters explicit overloads (workaround)
template< class RandomAccessIter, class Callback >
void box_self_intersection_d(
RandomAccessIter begin, RandomAccessIter end,
Callback callback)
{
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_self_intersection_d(begin, end, callback,
Box_traits(), 10, Box_intersection_d::CLOSED);
}
template< class RandomAccessIter, class Callback >
void box_self_intersection_d(
RandomAccessIter begin, RandomAccessIter end,
Callback callback,
std::ptrdiff_t)
{
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_self_intersection_d(begin, end, callback,
Box_traits(), 10, Box_intersection_d::CLOSED);
}
template< class RandomAccessIter, class Callback >
void box_self_intersection_d(
RandomAccessIter begin, RandomAccessIter end,
Callback callback,
std::ptrdiff_t cutoff,
Box_intersection_d::Topology topology)
{
typedef typename std::iterator_traits<RandomAccessIter>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_self_intersection_d(begin, end, callback,
Box_traits(), cutoff, topology );
}
// Generic call for trivial all-pairs algorithm with box traits parameter.
// - make all default parameters explicit overloads (workaround)
template< class ForwardIter1, class ForwardIter2,
class Callback, class BoxTraits >
void box_intersection_all_pairs_d(
ForwardIter1 begin1, ForwardIter1 end1,
ForwardIter2 begin2, ForwardIter2 end2,
Callback callback, BoxTraits)
{
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,true> Traits;
Box_intersection_d::all_pairs( begin1, end1, begin2, end2,
callback, Traits());
}
template< class ForwardIter1, class ForwardIter2,
class Callback, class BoxTraits >
void box_intersection_all_pairs_d(
ForwardIter1 begin1, ForwardIter1 end1,
ForwardIter2 begin2, ForwardIter2 end2,
Callback callback, BoxTraits,
Box_intersection_d::Topology topology,
Box_intersection_d::Setting setting)
{
bool complete_case = (setting != Box_intersection_d::BIPARTITE);
if (topology == Box_intersection_d::CLOSED) {
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,true> Traits;
Box_intersection_d::all_pairs( begin1, end1, begin2, end2,
callback, Traits(), complete_case);
} else {
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,false> Traits;
Box_intersection_d::all_pairs( begin1, end1, begin2, end2,
callback, Traits(), complete_case);
}
}
template< class ForwardIter1, class ForwardIter2,
class Callback, class BoxTraits >
void box_intersection_all_pairs_d(
ForwardIter1 begin1, ForwardIter1 end1,
ForwardIter2 begin2, ForwardIter2 end2,
Callback callback, BoxTraits traits,
Box_intersection_d::Topology topology)
{
box_intersection_all_pairs_d( begin1, end1, begin2, end2, callback, traits,
topology, Box_intersection_d::BIPARTITE);
}
// Specialized call for trivial all-pairs algorithm with default box traits.
// - make all default parameters explicit overloads (workaround)
template< class ForwardIter1, class ForwardIter2, class Callback >
void box_intersection_all_pairs_d(
ForwardIter1 begin1, ForwardIter1 end1,
ForwardIter2 begin2, ForwardIter2 end2,
Callback callback)
{
typedef typename std::iterator_traits<ForwardIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_all_pairs_d( begin1, end1, begin2, end2,
callback, Box_traits(),
Box_intersection_d::CLOSED );
}
template< class ForwardIter1, class ForwardIter2, class Callback >
void box_intersection_all_pairs_d(
ForwardIter1 begin1, ForwardIter1 end1,
ForwardIter2 begin2, ForwardIter2 end2,
Callback callback,
Box_intersection_d::Topology topology)
{
typedef typename std::iterator_traits<ForwardIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_all_pairs_d( begin1, end1, begin2, end2,
callback, Box_traits(), topology);
}
template< class ForwardIter1, class ForwardIter2, class Callback >
void box_intersection_all_pairs_d(
ForwardIter1 begin1, ForwardIter1 end1,
ForwardIter2 begin2, ForwardIter2 end2,
Callback callback,
Box_intersection_d::Topology topology,
Box_intersection_d::Setting setting)
{
typedef typename std::iterator_traits<ForwardIter1>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_intersection_all_pairs_d( begin1, end1, begin2, end2,
callback, Box_traits(), topology, setting);
}
// Generic call for trivial all-pairs algorithm with box traits parameter
// specialized for self-intersection test.
// - make all default parameters explicit overloads (workaround)
template< class ForwardIter, class Callback, class BoxTraits >
void box_self_intersection_all_pairs_d(
ForwardIter begin1, ForwardIter end1, Callback callback, BoxTraits /* traits */)
{
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,true> Traits;
Box_intersection_d::all_pairs( begin1, end1, callback, Traits());
}
template< class ForwardIter, class Callback, class BoxTraits >
void box_self_intersection_all_pairs_d(
ForwardIter begin1, ForwardIter end1, Callback callback, BoxTraits,
Box_intersection_d::Topology topology)
{
if (topology == Box_intersection_d::CLOSED) {
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,true> Traits;
Box_intersection_d::all_pairs( begin1, end1, callback, Traits());
} else {
typedef Box_intersection_d::Predicate_traits_d<BoxTraits,false> Traits;
Box_intersection_d::all_pairs( begin1, end1, callback, Traits());
}
}
// Specialized call for trivial all-pairs algorithm with default box traits.
// specialized for self-intersection test.
// - make all default parameters explicit overloads (workaround)
template< class ForwardIter, class Callback >
void box_self_intersection_all_pairs_d(
ForwardIter begin1, ForwardIter end1, Callback callback)
{
typedef typename std::iterator_traits<ForwardIter>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_self_intersection_all_pairs_d( begin1, end1, callback, Box_traits(),
Box_intersection_d::CLOSED );
}
template< class ForwardIter, class Callback >
void box_self_intersection_all_pairs_d(
ForwardIter begin1, ForwardIter end1, Callback callback,
Box_intersection_d::Topology topology)
{
typedef typename std::iterator_traits<ForwardIter>::value_type val_t;
typedef Box_intersection_d::Box_traits_d< val_t> Box_traits;
box_self_intersection_all_pairs_d( begin1, end1, callback, Box_traits(),
topology);
}
} //namespace CGAL
#endif
|