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
|
// Copyright (c) 2011 CNRS and LIRIS' Establishments (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL: https://github.com/CGAL/cgal/blob/v6.1.1/Linear_cell_complex/include/CGAL/Linear_cell_complex_traits.h $
// $Id: include/CGAL/Linear_cell_complex_traits.h 08b27d3db14 $
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
//
#ifndef CGAL_LINEAR_CELL_COMPLEX_TRAITS_H
#define CGAL_LINEAR_CELL_COMPLEX_TRAITS_H 1
#include <CGAL/Linear_cell_complex_fwd.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Cartesian_d.h>
#include <CGAL/predicates_d.h>
#include <CGAL/Origin.h>
namespace CGAL {
template <unsigned int d>
struct LCC_default_kernel
{ typedef Cartesian_d<double> type; };
template <>
struct LCC_default_kernel<2>
{ typedef Exact_predicates_inexact_constructions_kernel type; };
template <>
struct LCC_default_kernel<3>
{ typedef Exact_predicates_inexact_constructions_kernel type; };
/** Trait class for Linear_cell_complex class.
* dD version (for the moment there is only one dD kernel in CGAL).
*/
template <unsigned int d_, class Kernel>
struct Linear_cell_complex_traits : public Kernel
{
static const unsigned int ambient_dimension = d_;
typedef typename Kernel::FT FT;
typedef typename Kernel::Point_d Point;
typedef typename Kernel::Vector_d Vector;
// Constructions
struct Construct_translated_point
{
Point operator() (const Point&p, const Vector& v)
{ return p+v; }
Point operator() (const CGAL::Origin&, const Vector& v)
{ return operator() (Point(ambient_dimension, CGAL::Origin()), v); }
};
struct Construct_vector
{
Vector operator() (const Point& p1, const Point& p2)
{ return p2-p1; }
Vector operator() (const CGAL::Origin&, const Point& p)
{ return operator() (Point(ambient_dimension, CGAL::Origin()), p); }
};
struct Construct_sum_of_vectors
{
Vector operator() (const Vector&v1, const Vector& v2)
{ return v1+v2; }
};
struct Construct_scaled_vector
{
Vector operator() (const Vector& v, typename Kernel::FT scale)
{ return scale*v; }
};
struct Construct_midpoint
{
Point operator() (const Point&p1, const Point& p2)
{ return typename Kernel::Midpoint_d()(p1, p2); }
};
};
/** Trait class for Linear_cell_complex class.
* 2D version specialization.
*/
template <class Kernel>
struct Linear_cell_complex_traits<2,Kernel> : public Kernel
{
static const unsigned int ambient_dimension = 2;
typedef typename Kernel::FT FT;
typedef typename Kernel::Point_2 Point;
typedef typename Kernel::Vector_2 Vector;
// Constructions
typedef typename Kernel::Construct_translated_point_2
Construct_translated_point;
typedef typename Kernel::Construct_vector_2 Construct_vector;
typedef typename Kernel::Construct_sum_of_vectors_2
Construct_sum_of_vectors;
typedef typename Kernel::Construct_scaled_vector_2
Construct_scaled_vector;
typedef typename Kernel::Construct_midpoint_2
Construct_midpoint;
};
/** Trait class for Linear_cell_complex class.
* 3D version specialization.
*/
template <class Kernel>
struct Linear_cell_complex_traits<3,Kernel> : public Kernel
{
static const unsigned int ambient_dimension = 3;
typedef typename Kernel::FT FT;
typedef typename Kernel::Point_3 Point;
typedef typename Kernel::Vector_3 Vector;
// Constructions
typedef typename Kernel::Construct_translated_point_3
Construct_translated_point;
typedef typename Kernel::Construct_vector_3 Construct_vector;
typedef typename Kernel::Construct_sum_of_vectors_3
Construct_sum_of_vectors;
typedef typename Kernel::Construct_scaled_vector_3
Construct_scaled_vector;
typedef typename Kernel::Construct_midpoint_3
Construct_midpoint;
};
} // namespace CGAL
#endif // CGAL_LINEAR_CELL_COMPLEX_TRAITS_H //
// EOF //
|