mirror of https://github.com/CGAL/cgal
Add Dimension<T, K> whose nested "value" is the dimension of the ambiant
space. A special constant CGAL::Dynamic_dimension (equal to INT_MAX) indicates the case where the dimension is only known at run time.
This commit is contained in:
parent
73738c8a19
commit
02e543a294
|
|
@ -101,6 +101,11 @@ struct Cartesian_base
|
|||
typedef typename Same_uncertainty_nt<CGAL::Angle, FT>::type
|
||||
Angle;
|
||||
|
||||
template <typename T>
|
||||
struct Dimension {
|
||||
static const int value = T::static_dimension;
|
||||
};
|
||||
|
||||
typedef PointC2<Kernel> Point_2;
|
||||
typedef VectorC2<Kernel> Vector_2;
|
||||
typedef DirectionC2<Kernel> Direction_2;
|
||||
|
|
|
|||
|
|
@ -32,11 +32,6 @@ CGAL_BEGIN_NAMESPACE
|
|||
template < class R_ >
|
||||
class Optimisation_ellipse_2;
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template < class R_>
|
||||
class Conic_2 : public R_::Kernel_base::Conic_2 {
|
||||
|
||||
|
|
@ -44,6 +39,8 @@ class Conic_2 : public R_::Kernel_base::Conic_2 {
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 2;
|
||||
|
||||
// types
|
||||
typedef R_ R;
|
||||
typedef typename R_::RT RT;
|
||||
|
|
|
|||
|
|
@ -67,6 +67,11 @@ struct Filtered_kernel_base
|
|||
typedef Filtered_kernel_base<CK2> Type;
|
||||
};
|
||||
|
||||
template < typename T >
|
||||
struct Dimension {
|
||||
static const int value = T::static_dimension; // maybe not the right way...
|
||||
};
|
||||
|
||||
// We change the predicates.
|
||||
#define CGAL_Kernel_pred(P, Pf) \
|
||||
typedef Filtered_predicate<typename Exact_kernel::P, typename Approximate_kernel::P, C2E, C2F> P; \
|
||||
|
|
|
|||
|
|
@ -59,6 +59,11 @@ public:
|
|||
template < typename Kernel2 >
|
||||
struct Base { typedef Lazy_kernel_generic_base<Exact_kernel, Approximate_kernel, E2A, Kernel2> Type; };
|
||||
|
||||
template < typename T >
|
||||
struct Dimension {
|
||||
static const int value = T::static_dimension;
|
||||
};
|
||||
|
||||
// What to do with the tag ?
|
||||
// Probably this should not exist, should it ?
|
||||
// struct filter_tag{};
|
||||
|
|
|
|||
|
|
@ -108,6 +108,11 @@ struct Homogeneous_base
|
|||
typedef typename Same_uncertainty_nt<CGAL::Angle, FT>::type
|
||||
Angle;
|
||||
|
||||
template <typename T>
|
||||
struct Dimension {
|
||||
static const int value = T::static_dimension;
|
||||
};
|
||||
|
||||
typedef PointH2<Kernel> Point_2;
|
||||
typedef VectorH2<Kernel> Vector_2;
|
||||
typedef DirectionH2<Kernel> Direction_2;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
\begin{ccRefClass} {Dimension<T, K = Kernel_traits<T>::Kernel>}
|
||||
|
||||
\ccDefinition
|
||||
The class \ccRefName\ allows to retrieve the dimension of the ambiant space of
|
||||
a type. The dimension can also be the special constant
|
||||
\ccc{Dynamic_dimension}, which value is \ccc{INT_MAX}, to indicate the case
|
||||
where the dimension is only known at run time.
|
||||
|
||||
\ccInclude{CGAL/Dimension.h}
|
||||
|
||||
\ccConstants
|
||||
|
||||
\ccVariable{static const int value;}{ The dimension. It is implemented as \ccc{K::Dimension<T>::value}. }
|
||||
|
||||
\ccCreation
|
||||
\ccCreationVariable{d}
|
||||
|
||||
\ccExample
|
||||
|
||||
The following retrieves the dimension of a point type.
|
||||
|
||||
\begin{cprog}
|
||||
typedef Point_2<K> Point;
|
||||
int dimension = Dimension<Point, K>::value;
|
||||
assert(dimension == 2);
|
||||
\end{cprog}
|
||||
|
||||
\ccSeeAlso
|
||||
\ccRefConceptPage{Dimension_tag}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
|
@ -26,9 +26,7 @@ The following declaration creates two points at the origin, either in 2D or in 3
|
|||
std::cout << get_origin(Dimension_tag<2>())) << std::endl;
|
||||
\end{cprog}
|
||||
|
||||
% \ccSeeAlso
|
||||
% \ccRefConceptPage{Kernel::Point_2}
|
||||
% \ccRefIdfierPage{CGAL::Tag_true} \\
|
||||
% \ccRefIdfierPage{CGAL::Tag_false}
|
||||
\ccSeeAlso
|
||||
\ccRefConceptPage{Dimension}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
|
|
|||
|
|
@ -464,7 +464,6 @@ in the kernel.
|
|||
\section{Dimension handling tools}
|
||||
\gdef\ccRefPageBreak{\ccFalse}
|
||||
|
||||
\input{Kernel_23_ref/Dimension.tex}
|
||||
\gdef\ccRefPageBreak{\ccTrue}
|
||||
\input{Kernel_23_ref/Dimension_tag.tex}
|
||||
%\gdef\ccRefPageBreak{\ccTrue}
|
||||
%\input{Kernel_23_ref/Exact_predicates_exact_constructions_kernel_with_sqrt.tex}
|
||||
%\input{Kernel_23_ref/Exact_predicates_inexact_constructions_kernel.tex}
|
||||
|
|
|
|||
|
|
@ -41,6 +41,8 @@ class Aff_transformation_2 : public R_::Kernel_base::Aff_transformation_2
|
|||
public:
|
||||
typedef R_ R;
|
||||
|
||||
static const int static_dimension = 2;
|
||||
|
||||
Aff_transformation_2() {}
|
||||
|
||||
Aff_transformation_2(const RAff_transformation_2& t)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,9 @@ class Aff_transformation_3 : public R_::Kernel_base::Aff_transformation_3
|
|||
typedef typename R_::Vector_3 Vector_3;
|
||||
typedef typename R_::Kernel_base::Aff_transformation_3 RAff_transformation_3;
|
||||
public:
|
||||
|
||||
static const int static_dimension = 3;
|
||||
|
||||
typedef R_ R;
|
||||
|
||||
Aff_transformation_3() {}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,9 @@ class Bbox_2
|
|||
BBox_rep_2 rep;
|
||||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 2;
|
||||
|
||||
Bbox_2() {}
|
||||
|
||||
Bbox_2(double x_min, double y_min,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ class Bbox_3
|
|||
Sixtuple<double> rep;
|
||||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 3;
|
||||
|
||||
Bbox_3() {}
|
||||
|
||||
Bbox_3(double x_min, double y_min, double z_min,
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ class Circle_2 : public R_::Kernel_base::Circle_2
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 2;
|
||||
|
||||
typedef RCircle_2 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright (c) 2005 Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
|
||||
// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
|
||||
// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
|
||||
// and Tel-Aviv University (Israel). 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 Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// 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) : Sylvain Pion
|
||||
|
||||
#ifndef CGAL_DIMENSION_H
|
||||
#define CGAL_DIMENSION_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Kernel_traits.h>
|
||||
#include <climits>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
// This is a tool to obtain the static dimension of a kernel object.
|
||||
// That is, the dimension of the ambiant space.
|
||||
|
||||
template < typename T, typename K = typename Kernel_traits<T>::Kernel >
|
||||
struct Dimension
|
||||
{
|
||||
static const int value = K::template Dimension<T>::value;
|
||||
};
|
||||
|
||||
static const int Dynamic_dimension = INT_MAX;
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_DIMENSION_H
|
||||
|
|
@ -47,6 +47,8 @@ class Direction_2 : public R_::Kernel_base::Direction_2
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 2;
|
||||
|
||||
typedef RDirection_2 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ class Direction_3 : public R_::Kernel_base::Direction_3
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 3;
|
||||
|
||||
typedef typename R_::Kernel_base::Direction_3 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ class Iso_cuboid_3 : public R_::Kernel_base::Iso_cuboid_3
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 3;
|
||||
|
||||
typedef typename R_::Kernel_base::Iso_cuboid_3 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ class Iso_rectangle_2 : public R_::Kernel_base::Iso_rectangle_2
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 2;
|
||||
|
||||
typedef typename R_::Kernel_base::Iso_rectangle_2 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -1,187 +0,0 @@
|
|||
// Copyright (c) 2005 Utrecht University (The Netherlands),
|
||||
// ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
|
||||
// INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
|
||||
// (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
|
||||
// and Tel-Aviv University (Israel). 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 Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// 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) : Sylvain Pion
|
||||
|
||||
#ifndef CGAL_KERNEL_DIMENSION_H
|
||||
#define CGAL_KERNEL_DIMENSION_H
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Kernel_traits.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
// This is a tool to obtain the static dimension of a kernel object.
|
||||
// Currently undocumented => for CGAL internal use only.
|
||||
|
||||
// TODO :
|
||||
// - Should the default be that kernel objects export this value themselves ?
|
||||
// This way, user defined objects will work as well ?
|
||||
// But an object could have a dimension depending on the traits...
|
||||
// => Well, let's make it work first.
|
||||
// - Should it be named Dimension_traits<> ?
|
||||
|
||||
template < typename T, typename K = typename Kernel_traits<T>::Kernel >
|
||||
struct Dimension;
|
||||
|
||||
// 2D objects
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Point_2, K >
|
||||
{ static const int value = 2; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Vector_2, K >
|
||||
{ static const int value = 2; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Direction_2, K >
|
||||
{ static const int value = 2; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Line_2, K >
|
||||
{ static const int value = 2; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Ray_2, K >
|
||||
{ static const int value = 2; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Segment_2, K >
|
||||
{ static const int value = 2; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Triangle_2, K >
|
||||
{ static const int value = 2; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Iso_rectangle_2, K >
|
||||
{ static const int value = 2; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Circle_2, K >
|
||||
{ static const int value = 2; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Conic_2, K >
|
||||
{ static const int value = 2; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Aff_transformation_2, K >
|
||||
{ static const int value = 2; };
|
||||
|
||||
|
||||
// 3D objects
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Point_3, K >
|
||||
{ static const int value = 3; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Plane_3, K >
|
||||
{ static const int value = 3; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Vector_3, K >
|
||||
{ static const int value = 3; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Direction_3, K >
|
||||
{ static const int value = 3; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Line_3, K >
|
||||
{ static const int value = 3; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Ray_3, K >
|
||||
{ static const int value = 3; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Segment_3, K >
|
||||
{ static const int value = 3; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Triangle_3, K >
|
||||
{ static const int value = 3; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Tetrahedron_3, K >
|
||||
{ static const int value = 3; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Iso_cuboid_3, K >
|
||||
{ static const int value = 3; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Sphere_3, K >
|
||||
{ static const int value = 3; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Aff_transformation_3, K >
|
||||
{ static const int value = 3; };
|
||||
|
||||
|
||||
// dD objects
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Point_d, K >
|
||||
{ static const int value = 0; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Vector_d, K >
|
||||
{ static const int value = 0; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Direction_d, K >
|
||||
{ static const int value = 0; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Hyperplane_d, K >
|
||||
{ static const int value = 0; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Aff_transformation_d, K >
|
||||
{ static const int value = 0; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Sphere_d, K >
|
||||
{ static const int value = 0; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Iso_box_d, K >
|
||||
{ static const int value = 0; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Segment_d, K >
|
||||
{ static const int value = 0; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Ray_d, K >
|
||||
{ static const int value = 0; };
|
||||
|
||||
template < typename K >
|
||||
struct Dimension < typename K::Line_d, K >
|
||||
{ static const int value = 0; };
|
||||
|
||||
CGAL_END_NAMESPACE
|
||||
|
||||
#endif // CGAL_KERNEL_DIMENSION_H
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
#define CGAL_KERNEL_DIMENSION_UTILS_H
|
||||
|
||||
#include <CGAL/Kernel_traits.h>
|
||||
#include <CGAL/Kernel/Dimension.h>
|
||||
#include <CGAL/Dimension.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ template < typename K >
|
|||
struct Point <3, K> { typedef typename K::Point_3 type; };
|
||||
|
||||
template < typename K >
|
||||
struct Point <0, K> { typedef typename K::Point_d type; };
|
||||
struct Point <Dynamic_dimension, K> { typedef typename K::Point_d type; };
|
||||
|
||||
|
||||
template < typename K >
|
||||
|
|
@ -76,7 +76,7 @@ template < typename K >
|
|||
struct Vector <3, K> { typedef typename K::Vector_3 type; };
|
||||
|
||||
template < typename K >
|
||||
struct Vector <0, K> { typedef typename K::Vector_d type; };
|
||||
struct Vector <Dynamic_dimension, K> { typedef typename K::Vector_d type; };
|
||||
|
||||
|
||||
template < typename K >
|
||||
|
|
@ -86,7 +86,7 @@ template < typename K >
|
|||
struct Iso_box <3, K> { typedef typename K::Iso_cuboid_3 type; };
|
||||
|
||||
template < typename K >
|
||||
struct Iso_box <0, K> { typedef typename K::Iso_box_d type; };
|
||||
struct Iso_box <Dynamic_dimension, K> { typedef typename K::Iso_box_d type; };
|
||||
|
||||
|
||||
template < typename K >
|
||||
|
|
@ -96,7 +96,7 @@ template < typename K >
|
|||
struct Direction <3, K> { typedef typename K::Direction_3 type; };
|
||||
|
||||
template < typename K >
|
||||
struct Direction <0, K> { typedef typename K::Direction_d type; };
|
||||
struct Direction <Dynamic_dimension, K> { typedef typename K::Direction_d type; };
|
||||
|
||||
|
||||
template < typename K >
|
||||
|
|
@ -106,7 +106,7 @@ template < typename K >
|
|||
struct Line <3, K> { typedef typename K::Line_3 type; };
|
||||
|
||||
template < typename K >
|
||||
struct Line <0, K> { typedef typename K::Line_d type; };
|
||||
struct Line <Dynamic_dimension, K> { typedef typename K::Line_d type; };
|
||||
|
||||
|
||||
template < typename K >
|
||||
|
|
@ -116,7 +116,7 @@ template < typename K >
|
|||
struct Ray <3, K> { typedef typename K::Ray_3 type; };
|
||||
|
||||
template < typename K >
|
||||
struct Ray <0, K> { typedef typename K::Ray_d type; };
|
||||
struct Ray <Dynamic_dimension, K> { typedef typename K::Ray_d type; };
|
||||
|
||||
|
||||
template < typename K >
|
||||
|
|
@ -126,7 +126,7 @@ template < typename K >
|
|||
struct Segment <3, K> { typedef typename K::Segment_3 type; };
|
||||
|
||||
template < typename K >
|
||||
struct Segment <0, K> { typedef typename K::Segment_d type; };
|
||||
struct Segment <Dynamic_dimension, K> { typedef typename K::Segment_d type; };
|
||||
|
||||
|
||||
template < typename K >
|
||||
|
|
@ -136,14 +136,14 @@ template < typename K >
|
|||
struct Triangle <3, K> { typedef typename K::Triangle_3 type; };
|
||||
|
||||
template < typename K >
|
||||
struct Triangle <0, K> { typedef typename K::Triangle_d type; };
|
||||
struct Triangle <Dynamic_dimension, K> { typedef typename K::Triangle_d type; };
|
||||
|
||||
|
||||
template < typename K >
|
||||
struct Tetrahedron <3, K> { typedef typename K::Tetrahedron_3 type; };
|
||||
|
||||
template < typename K >
|
||||
struct Tetrahedron <0, K> { typedef typename K::Tetrahedron_d type; };
|
||||
struct Tetrahedron <Dynamic_dimension, K> { typedef typename K::Tetrahedron_d type; };
|
||||
|
||||
|
||||
template < typename K >
|
||||
|
|
@ -153,7 +153,7 @@ template < typename K >
|
|||
struct Hypersphere <3, K> { typedef typename K::Sphere_3 type; };
|
||||
|
||||
template < typename K >
|
||||
struct Hypersphere <0, K> { typedef typename K::Sphere_d type; };
|
||||
struct Hypersphere <Dynamic_dimension, K> { typedef typename K::Sphere_d type; };
|
||||
|
||||
|
||||
template < typename K >
|
||||
|
|
@ -163,7 +163,7 @@ template < typename K >
|
|||
struct Hyperplane <3, K> { typedef typename K::Plane_3 type; };
|
||||
|
||||
template < typename K >
|
||||
struct Hyperplane <0, K> { typedef typename K::Hyperplane_d type; };
|
||||
struct Hyperplane <Dynamic_dimension, K> { typedef typename K::Hyperplane_d type; };
|
||||
|
||||
|
||||
template < typename K >
|
||||
|
|
@ -175,7 +175,7 @@ struct Aff_transformation <3, K>
|
|||
{ typedef typename K::Aff_transformation_3 type; };
|
||||
|
||||
template < typename K >
|
||||
struct Aff_transformation <0, K>
|
||||
struct Aff_transformation <Dynamic_dimension, K>
|
||||
{ typedef typename K::Aff_transformation_d type; };
|
||||
|
||||
|
||||
|
|
@ -224,7 +224,7 @@ struct Dimension_mapper <T, K, 3>
|
|||
};
|
||||
|
||||
template < typename T, typename K >
|
||||
struct Dimension_mapper <T, K, 0>
|
||||
struct Dimension_mapper <T, K, Dynamic_dimension>
|
||||
: public K
|
||||
{
|
||||
Dimension_mapper() {}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ class Line_2 : public R_::Kernel_base::Line_2
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 2;
|
||||
|
||||
typedef RLine_2 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ class Line_3 : public R_::Kernel_base::Line_3
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 3;
|
||||
|
||||
typedef typename R_::Kernel_base::Line_3 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ class Plane_3 : public R_::Kernel_base::Plane_3
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 3;
|
||||
|
||||
typedef typename R_::Kernel_base::Plane_3 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@ class Point_2 : public R_::Kernel_base::Point_2
|
|||
BOOST_STATIC_ASSERT((boost::is_same<Self, typename R_::Point_2>::value));
|
||||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 2;
|
||||
|
||||
typedef RPoint_2 Rep;
|
||||
typedef typename R_::Cartesian_const_iterator_2 Cartesian_const_iterator;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ class Point_3 : public R_::Kernel_base::Point_3
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 3;
|
||||
|
||||
typedef typename R_::Kernel_base::Point_3 Rep;
|
||||
typedef typename R_::Cartesian_const_iterator_3 Cartesian_const_iterator;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ class Ray_2 : public R_::Kernel_base::Ray_2
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 2;
|
||||
|
||||
typedef RRay_2 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ class Ray_3 : public R_::Kernel_base::Ray_3
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 3;
|
||||
|
||||
typedef typename R_::Kernel_base::Ray_3 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ class Segment_2 : public R_::Kernel_base::Segment_2
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 2;
|
||||
|
||||
typedef RSegment_2 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ class Segment_3 : public R_::Kernel_base::Segment_3
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 3;
|
||||
|
||||
typedef typename R_::Kernel_base::Segment_3 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -44,6 +44,8 @@ class Sphere_3 : public R_::Kernel_base::Sphere_3
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 3;
|
||||
|
||||
typedef typename R_::Kernel_base::Sphere_3 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ class Tetrahedron_3 : public R_::Kernel_base::Tetrahedron_3
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 3;
|
||||
|
||||
typedef typename R_::Kernel_base::Tetrahedron_3 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ class Triangle_2 : public R_::Kernel_base::Triangle_2
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 2;
|
||||
|
||||
typedef RTriangle_2 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ class Triangle_3 : public R_::Kernel_base::Triangle_3
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 3;
|
||||
|
||||
typedef typename R_::Kernel_base::Triangle_3 Rep;
|
||||
|
||||
const Rep& rep() const
|
||||
|
|
|
|||
|
|
@ -51,6 +51,8 @@ class Vector_2 : public R_::Kernel_base::Vector_2
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 2;
|
||||
|
||||
typedef RVector_2 Rep;
|
||||
typedef typename R_::Cartesian_const_iterator_2 Cartesian_const_iterator;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,8 @@ class Vector_3 : public R_::Kernel_base::Vector_3
|
|||
|
||||
public:
|
||||
|
||||
static const int static_dimension = 3;
|
||||
|
||||
typedef typename R_::Cartesian_const_iterator_3 Cartesian_const_iterator;
|
||||
typedef typename R_::Kernel_base::Vector_3 Rep;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
// Test program for Dimension<>.
|
||||
// Sylvain Pion, 2005.
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <cassert>
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Cartesian_d.h>
|
||||
#include <CGAL/Homogeneous.h>
|
||||
#include <CGAL/Homogeneous_d.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
|
||||
#include <CGAL/Kernel/Dimension.h>
|
||||
#include <CGAL/Dimension.h>
|
||||
#include <CGAL/Dimension_tag.h>
|
||||
|
||||
template < typename K >
|
||||
|
|
@ -42,25 +46,35 @@ void test(CGAL::Dimension_tag<3>)
|
|||
}
|
||||
|
||||
template < typename K >
|
||||
void test(CGAL::Dimension_tag<0>)
|
||||
void test(CGAL::Dimension_tag<CGAL::Dynamic_dimension>)
|
||||
{
|
||||
assert( 0 == CGAL::Dimension<typename K::Point_d>::value );
|
||||
assert( 0 == CGAL::Dimension<typename K::Hyperplane_d>::value );
|
||||
assert( 0 == CGAL::Dimension<typename K::Vector_d>::value );
|
||||
assert( 0 == CGAL::Dimension<typename K::Direction_d>::value );
|
||||
assert( 0 == CGAL::Dimension<typename K::Line_d>::value );
|
||||
assert( 0 == CGAL::Dimension<typename K::Ray_d>::value );
|
||||
assert( 0 == CGAL::Dimension<typename K::Segment_d>::value );
|
||||
assert( 0 == CGAL::Dimension<typename K::Iso_box_d>::value );
|
||||
assert( 0 == CGAL::Dimension<typename K::Sphere_d>::value );
|
||||
assert( 0 == CGAL::Dimension<typename K::Aff_transformation_d>::value );
|
||||
assert( CGAL::Dynamic_dimension == CGAL::Dimension<typename K::Point_d>::value );
|
||||
assert( CGAL::Dynamic_dimension == CGAL::Dimension<typename K::Hyperplane_d>::value );
|
||||
assert( CGAL::Dynamic_dimension == CGAL::Dimension<typename K::Vector_d>::value );
|
||||
assert( CGAL::Dynamic_dimension == CGAL::Dimension<typename K::Direction_d>::value );
|
||||
assert( CGAL::Dynamic_dimension == CGAL::Dimension<typename K::Line_d>::value );
|
||||
assert( CGAL::Dynamic_dimension == CGAL::Dimension<typename K::Ray_d>::value );
|
||||
assert( CGAL::Dynamic_dimension == CGAL::Dimension<typename K::Segment_d>::value );
|
||||
assert( CGAL::Dynamic_dimension == CGAL::Dimension<typename K::Iso_box_d>::value );
|
||||
assert( CGAL::Dynamic_dimension == CGAL::Dimension<typename K::Sphere_d>::value );
|
||||
assert( CGAL::Dynamic_dimension == CGAL::Dimension<typename K::Aff_transformation_d>::value );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
test<CGAL::Cartesian<int> >(CGAL::Dimension_tag<2>());
|
||||
test<CGAL::Cartesian<int> >(CGAL::Dimension_tag<3>());
|
||||
test<CGAL::Cartesian_d<int> >(CGAL::Dimension_tag<0>());
|
||||
test<CGAL::Cartesian_d<int> >(CGAL::Dimension_tag<CGAL::Dynamic_dimension>());
|
||||
|
||||
test<CGAL::Homogeneous<int> >(CGAL::Dimension_tag<2>());
|
||||
test<CGAL::Homogeneous<int> >(CGAL::Dimension_tag<3>());
|
||||
test<CGAL::Homogeneous_d<int> >(CGAL::Dimension_tag<CGAL::Dynamic_dimension>());
|
||||
|
||||
test<CGAL::Exact_predicates_inexact_constructions_kernel>(CGAL::Dimension_tag<2>());
|
||||
test<CGAL::Exact_predicates_inexact_constructions_kernel>(CGAL::Dimension_tag<3>());
|
||||
|
||||
test<CGAL::Exact_predicates_exact_constructions_kernel>(CGAL::Dimension_tag<2>());
|
||||
test<CGAL::Exact_predicates_exact_constructions_kernel>(CGAL::Dimension_tag<3>());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@
|
|||
#include <CGAL/Kernel_d/Interface_classes.h>
|
||||
#include <CGAL/Kernel_d/simple_objects.h>
|
||||
|
||||
#include <CGAL/Dimension.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <class pFT, class pLA = Linear_algebraCd<pFT> >
|
||||
|
|
@ -74,6 +76,11 @@ public:
|
|||
|
||||
typedef typename Point_d_base::Cartesian_const_iterator Cartesian_const_iterator_d;
|
||||
|
||||
template <typename>
|
||||
struct Dimension {
|
||||
static const int value = Dynamic_dimension;
|
||||
};
|
||||
|
||||
template <typename K>
|
||||
class Construct_cartesian_const_iterator
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@
|
|||
#include <CGAL/Kernel_d/Interface_classes.h>
|
||||
#include <CGAL/Kernel_d/simple_objects.h>
|
||||
|
||||
#include <CGAL/Dimension.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
||||
template <class pRT, class pLA = Linear_algebraHd<pRT> >
|
||||
|
|
@ -74,6 +76,11 @@ public:
|
|||
|
||||
typedef typename Point_d_base::Cartesian_const_iterator Cartesian_const_iterator_d;
|
||||
|
||||
template <typename>
|
||||
struct Dimension {
|
||||
static const int value = Dynamic_dimension;
|
||||
};
|
||||
|
||||
template <typename K>
|
||||
class Construct_cartesian_const_iterator
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Kernel_traits.h>
|
||||
#include <CGAL/Kernel/Dimension.h>
|
||||
#include <CGAL/Dimension.h>
|
||||
#include <CGAL/Kernel/Dimension_utils.h>
|
||||
|
||||
CGAL_BEGIN_NAMESPACE
|
||||
|
|
@ -148,7 +148,7 @@ struct bbox<3>
|
|||
};
|
||||
|
||||
template <>
|
||||
struct bbox<0>
|
||||
struct bbox<Dynamic_dimension>
|
||||
{
|
||||
template < class ForwardIterator, class Traits >
|
||||
typename Traits::Iso_box_d
|
||||
|
|
|
|||
Loading…
Reference in New Issue