diff --git a/Cartesian_kernel/include/CGAL/Cartesian/Cartesian_base.h b/Cartesian_kernel/include/CGAL/Cartesian/Cartesian_base.h index 61973aee365..96f3ab93da3 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/Cartesian_base.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/Cartesian_base.h @@ -102,8 +102,13 @@ struct Cartesian_base Angle; template - struct Dimension { - static const int value = T::static_dimension; + struct Ambiant_dimension { + typedef typename T::Ambiant_dimension type; + }; + + template + struct Feature_dimension { + typedef typename T::Feature_dimension type; }; typedef PointC2 Point_2; diff --git a/Conic_2/include/CGAL/Conic_2.h b/Conic_2/include/CGAL/Conic_2.h index 3b679a5fdad..03c3241a9f2 100644 --- a/Conic_2/include/CGAL/Conic_2.h +++ b/Conic_2/include/CGAL/Conic_2.h @@ -26,6 +26,7 @@ #define CGAL_CONIC_2_H #include +#include CGAL_BEGIN_NAMESPACE @@ -39,7 +40,8 @@ class Conic_2 : public R_::Kernel_base::Conic_2 { public: - static const int static_dimension = 2; + typedef Dimension_tag<2> Ambiant_dimension; + typedef Dimension_tag<1> Feature_dimension; // types typedef R_ R; diff --git a/Filtered_kernel/include/CGAL/Filtered_kernel.h b/Filtered_kernel/include/CGAL/Filtered_kernel.h index 7e67db78680..a7ce445f4f2 100644 --- a/Filtered_kernel/include/CGAL/Filtered_kernel.h +++ b/Filtered_kernel/include/CGAL/Filtered_kernel.h @@ -68,8 +68,13 @@ struct Filtered_kernel_base }; template < typename T > - struct Dimension { - static const int value = T::static_dimension; // maybe not the right way... + struct Ambiant_dimension { + typedef typename T::Ambiant_dimension type; // maybe not the right way... + }; + + template < typename T > + struct Feature_dimension { + typedef typename T::Feature_dimension type; // maybe not the right way... }; // We change the predicates. diff --git a/Filtered_kernel/include/CGAL/Lazy_kernel.h b/Filtered_kernel/include/CGAL/Lazy_kernel.h index ef67489490f..b9f927dbb6e 100644 --- a/Filtered_kernel/include/CGAL/Lazy_kernel.h +++ b/Filtered_kernel/include/CGAL/Lazy_kernel.h @@ -60,8 +60,13 @@ public: struct Base { typedef Lazy_kernel_generic_base Type; }; template < typename T > - struct Dimension { - static const int value = T::static_dimension; + struct Ambiant_dimension { + typedef typename T::Ambiant_dimension type; + }; + + template < typename T > + struct Feature_dimension { + typedef typename T::Feature_dimension type; }; // What to do with the tag ? diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/Homogeneous_base.h b/Homogeneous_kernel/include/CGAL/Homogeneous/Homogeneous_base.h index b59b17e8255..12807f1fcc7 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/Homogeneous_base.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/Homogeneous_base.h @@ -109,8 +109,13 @@ struct Homogeneous_base Angle; template - struct Dimension { - static const int value = T::static_dimension; + struct Ambiant_dimension { + typedef typename T::Ambiant_dimension type; + }; + + template + struct Feature_dimension { + typedef typename T::Feature_dimension type; }; typedef PointH2 Point_2; diff --git a/Kernel_23/doc_tex/Kernel_23_ref/Ambiant_dimension.tex b/Kernel_23/doc_tex/Kernel_23_ref/Ambiant_dimension.tex new file mode 100644 index 00000000000..649a04b1d5b --- /dev/null +++ b/Kernel_23/doc_tex/Kernel_23_ref/Ambiant_dimension.tex @@ -0,0 +1,39 @@ +\begin{ccRefClass} {Ambiant_dimension::Kernel>} + +\ccDefinition +The class \ccRefName\ allows to retrieve the dimension of the ambiant space of +a type. + +\ccInclude{CGAL/Dimension.h} + +\ccConstants + +\ccVariable{static const int value;}{The dimension value as a compile-time +integral constant. It is implemented as \ccc{K::Dimension::type::value}. +It exists only when the dimension is a compile-time constant.} + +\ccTypes + +\ccTypedef{type;}{Either \ccc{Dimension_tag} if the dimension is a +compile-time constant of value \ccc{dim}, or \ccc{Dynamic_dimension_tag} +otherwise. It is implemented as \ccc{K::Ambiant_dimension::type}. } + +\ccCreation +\ccCreationVariable{d} + +\ccExample + +The following retrieves the dimension of a point type. + +\begin{cprog} + typedef K::Point_2 Point; + int dimension = Ambiant_dimension::value; + assert(dimension == 2); +\end{cprog} + +\ccSeeAlso +\ccRefConceptPage{Dimension_tag} +\ccRefConceptPage{Dynamic_dimension_tag} +\ccRefConceptPage{Feature_dimension} + +\end{ccRefClass} diff --git a/Kernel_23/doc_tex/Kernel_23_ref/Dimension.tex b/Kernel_23/doc_tex/Kernel_23_ref/Dimension.tex deleted file mode 100644 index bdd1def1bdd..00000000000 --- a/Kernel_23/doc_tex/Kernel_23_ref/Dimension.tex +++ /dev/null @@ -1,31 +0,0 @@ -\begin{ccRefClass} {Dimension::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::value}. } - -\ccCreation -\ccCreationVariable{d} - -\ccExample - -The following retrieves the dimension of a point type. - -\begin{cprog} - typedef Point_2 Point; - int dimension = Dimension::value; - assert(dimension == 2); -\end{cprog} - -\ccSeeAlso -\ccRefConceptPage{Dimension_tag} - -\end{ccRefClass} diff --git a/Kernel_23/doc_tex/Kernel_23_ref/Dimension_tag.tex b/Kernel_23/doc_tex/Kernel_23_ref/Dimension_tag.tex index 28f2c651ef2..41d9be00fcd 100644 --- a/Kernel_23/doc_tex/Kernel_23_ref/Dimension_tag.tex +++ b/Kernel_23/doc_tex/Kernel_23_ref/Dimension_tag.tex @@ -6,7 +6,7 @@ for dispatching functions based on the dimension of an object, as provided by the \ccc{dim} parameter. It is useful in cases where it is not more practical to pass the dimension as a template parameter directly. -\ccInclude{CGAL/Dimension_tag.h} +\ccInclude{CGAL/Dimension.h} \ccConstants @@ -17,16 +17,19 @@ practical to pass the dimension as a template parameter directly. \ccExample -The following declaration creates two points at the origin, either in 2D or in 3D. +The following code declares two functions constructing two points at the origin, +either in 2D or in 3D. \begin{cprog} Point_2 get_origin(Dimension_tag<2>) { return Point_2(ORIGIN); } Point_3 get_origin(Dimension_tag<3>) { return Point_3(ORIGIN); } std::cout << get_origin(Dimension_tag<2>())) << std::endl; -\end{cprog} +\end{cprog} \ccSeeAlso -\ccRefConceptPage{Dimension} +\ccRefConceptPage{Ambiant_dimension} +\ccRefConceptPage{Feature_dimension} +\ccRefConceptPage{Dynamic_dimension_tag} -\end{ccRefClass} +\end{ccRefClass} diff --git a/Kernel_23/doc_tex/Kernel_23_ref/Dynamic_dimension_tag.tex b/Kernel_23/doc_tex/Kernel_23_ref/Dynamic_dimension_tag.tex new file mode 100644 index 00000000000..17af60a4e33 --- /dev/null +++ b/Kernel_23/doc_tex/Kernel_23_ref/Dynamic_dimension_tag.tex @@ -0,0 +1,32 @@ +\begin{ccRefClass} {Dynamic_dimension_tag} + +\ccDefinition +An object of the class \ccRefName\ is an empty object which can be used +for dispatching functions based on the dimension of an object. +\ccRefName\ indicates that the dimension is not known at compile-time. +\ccc{Dimension_tag} is the tag class dealing with compile-time dimensions. + +\ccInclude{CGAL/Dimension.h} + +\ccCreation +\ccCreationVariable{d} + +\ccExample + +The following code declares two functions constructing two points at the origin, +either in 2D or in 3D. + +\begin{cprog} + Point_2 get_origin(Dimension_tag<2>) { return Point_2(ORIGIN); } + Point_3 get_origin(Dimension_tag<3>) { return Point_3(ORIGIN); } + Point_d get_origin(Dynamic_dmension_tag) { return Point_d(ORIGIN); } + + std::cout << get_origin(Dynamic_dimension_tag())) << std::endl; +\end{cprog} + +\ccSeeAlso +\ccRefConceptPage{Dimension_tag} +\ccRefConceptPage{Ambiant_dimension} +\ccRefConceptPage{Feature_dimension} + +\end{ccRefClass} diff --git a/Kernel_23/doc_tex/Kernel_23_ref/Feature_dimension.tex b/Kernel_23/doc_tex/Kernel_23_ref/Feature_dimension.tex new file mode 100644 index 00000000000..521961ee11a --- /dev/null +++ b/Kernel_23/doc_tex/Kernel_23_ref/Feature_dimension.tex @@ -0,0 +1,38 @@ +\begin{ccRefClass} {Feature_dimension::Kernel>} + +\ccDefinition +The class \ccRefName\ allows to retrieve the geometric dimension of a type. + +\ccInclude{CGAL/Dimension.h} + +\ccConstants + +\ccVariable{static const int value;}{The dimension value as a compile-time +integral constant. It is implemented as \ccc{K::Feature_dimension::type::value}. +It exists only when the dimension is a compile-time constant.} + +\ccTypes + +\ccTypedef{type;}{Either \ccc{Dimension_tag} if the dimension is a +compile-time constant of value \ccc{dim}, or \ccc{Dynamic_dimension_tag} +otherwise. It is implemented as \ccc{K::Feature_dimension::type}. } + +\ccCreation +\ccCreationVariable{d} + +\ccExample + +The following retrieves the dimension of a point type. + +\begin{cprog} + typedef K::Point_2 Point; + int dimension = Feature_dimension::value; + assert(dimension == 0); +\end{cprog} + +\ccSeeAlso +\ccRefConceptPage{Dimension_tag} +\ccRefConceptPage{Dynamic_dimension_tag} +\ccRefConceptPage{Ambiant_dimension} + +\end{ccRefClass} diff --git a/Kernel_23/doc_tex/Kernel_23_ref/main.tex b/Kernel_23/doc_tex/Kernel_23_ref/main.tex index 1558b5e92cb..bdcc56b1520 100644 --- a/Kernel_23/doc_tex/Kernel_23_ref/main.tex +++ b/Kernel_23/doc_tex/Kernel_23_ref/main.tex @@ -464,6 +464,8 @@ in the kernel. \section{Dimension handling tools} \gdef\ccRefPageBreak{\ccFalse} -\input{Kernel_23_ref/Dimension.tex} +\input{Kernel_23_ref/Ambiant_dimension.tex} +\input{Kernel_23_ref/Feature_dimension.tex} \gdef\ccRefPageBreak{\ccTrue} \input{Kernel_23_ref/Dimension_tag.tex} +\input{Kernel_23_ref/Dynamic_dimension_tag.tex} diff --git a/Kernel_23/include/CGAL/Aff_transformation_2.h b/Kernel_23/include/CGAL/Aff_transformation_2.h index 124cf274373..249fc4b60de 100644 --- a/Kernel_23/include/CGAL/Aff_transformation_2.h +++ b/Kernel_23/include/CGAL/Aff_transformation_2.h @@ -18,14 +18,13 @@ // $URL$ // $Id$ // -// -// Author(s) : Andreas Fabri -// Stefan Schirra +// Author(s) : Andreas Fabri, Stefan Schirra #ifndef CGAL_AFF_TRANSFORMATION_2_H #define CGAL_AFF_TRANSFORMATION_2_H #include +#include CGAL_BEGIN_NAMESPACE @@ -39,9 +38,10 @@ class Aff_transformation_2 : public R_::Kernel_base::Aff_transformation_2 typedef typename R_::Vector_2 Vector_2; typedef typename R_::Kernel_base::Aff_transformation_2 RAff_transformation_2; public: - typedef R_ R; - static const int static_dimension = 2; + typedef CGAL::Dimension_tag<2> Ambiant_dimension; + + typedef R_ R; Aff_transformation_2() {} diff --git a/Kernel_23/include/CGAL/Aff_transformation_3.h b/Kernel_23/include/CGAL/Aff_transformation_3.h index 4d2cbe3ba24..00e22f25744 100644 --- a/Kernel_23/include/CGAL/Aff_transformation_3.h +++ b/Kernel_23/include/CGAL/Aff_transformation_3.h @@ -17,13 +17,14 @@ // // $URL$ // $Id$ -// // // Author(s) : Andreas Fabri, Stefan Schirra #ifndef CGAL_AFF_TRANSFORMATION_3_H #define CGAL_AFF_TRANSFORMATION_3_H +#include + CGAL_BEGIN_NAMESPACE template @@ -34,7 +35,7 @@ class Aff_transformation_3 : public R_::Kernel_base::Aff_transformation_3 typedef typename R_::Kernel_base::Aff_transformation_3 RAff_transformation_3; public: - static const int static_dimension = 3; + typedef CGAL::Dimension_tag<3> Ambiant_dimension; typedef R_ R; diff --git a/Kernel_23/include/CGAL/Bbox_2.h b/Kernel_23/include/CGAL/Bbox_2.h index 6242d6367b0..7a610db6492 100644 --- a/Kernel_23/include/CGAL/Bbox_2.h +++ b/Kernel_23/include/CGAL/Bbox_2.h @@ -18,7 +18,6 @@ // $URL$ // $Id$ // -// // Author(s) : Andreas Fabri #ifndef CGAL_BBOX_2_H @@ -28,9 +27,13 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE +template < typename T > +struct Simple_cartesian; + class Bbox_2 { typedef Fourtuple BBox_rep_2; @@ -39,7 +42,10 @@ class Bbox_2 public: - static const int static_dimension = 2; + typedef Dimension_tag<2> Ambiant_dimension; + typedef Dimension_tag<2> Feature_dimension; + + typedef Simple_cartesian R; Bbox_2() {} diff --git a/Kernel_23/include/CGAL/Bbox_3.h b/Kernel_23/include/CGAL/Bbox_3.h index 2267d23df76..fbdf4f5f29d 100644 --- a/Kernel_23/include/CGAL/Bbox_3.h +++ b/Kernel_23/include/CGAL/Bbox_3.h @@ -18,7 +18,6 @@ // $URL$ // $Id$ // -// // Author(s) : Andreas Fabri #ifndef CGAL_BBOX_3_H @@ -27,16 +26,23 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE +template < typename T > +struct Simple_cartesian; + class Bbox_3 { Sixtuple rep; public: - static const int static_dimension = 3; + typedef Dimension_tag<3> Ambiant_dimension; + typedef Dimension_tag<3> Feature_dimension; + + typedef Simple_cartesian R; Bbox_3() {} diff --git a/Kernel_23/include/CGAL/Circle_2.h b/Kernel_23/include/CGAL/Circle_2.h index bd9426285fd..8ab24c6ac1c 100644 --- a/Kernel_23/include/CGAL/Circle_2.h +++ b/Kernel_23/include/CGAL/Circle_2.h @@ -29,6 +29,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -45,7 +46,8 @@ class Circle_2 : public R_::Kernel_base::Circle_2 public: - static const int static_dimension = 2; + typedef Dimension_tag<2> Ambiant_dimension; + typedef Dimension_tag<1> Feature_dimension; typedef RCircle_2 Rep; diff --git a/Kernel_23/include/CGAL/Dimension.h b/Kernel_23/include/CGAL/Dimension.h index 3a42e631884..eec299299cc 100644 --- a/Kernel_23/include/CGAL/Dimension.h +++ b/Kernel_23/include/CGAL/Dimension.h @@ -1,8 +1,5 @@ -// 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. +// Copyright (c) 2008 INRIA Sophia-Antipolis (France). +// 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 @@ -17,7 +14,6 @@ // // $URL$ // $Id$ -// // // Author(s) : Sylvain Pion @@ -30,16 +26,48 @@ CGAL_BEGIN_NAMESPACE -// This is a tool to obtain the static dimension of a kernel object. -// That is, the dimension of the ambiant space. +// These tag classes help dispatching functions based on a geometric dimension. -template < typename T, typename K = typename Kernel_traits::Kernel > -struct Dimension +template < int dim > +struct Dimension_tag { - static const int value = K::template Dimension::value; + static const int value = dim; }; -static const int Dynamic_dimension = INT_MAX; +struct Dynamic_dimension_tag {}; + + +namespace CGALi { + + template < typename D > + struct Dim_value { + static const int value = D::value; + }; + + template <> + struct Dim_value {}; + +} // namespace CGALi + + +// Ambiant_dimension gives access to the dimension of the ambiant space of an object. + +template < typename T, typename K = typename Kernel_traits::Kernel > +struct Ambiant_dimension + : public CGALi::Dim_value< typename K::template Ambiant_dimension::type > +{ + typedef typename K::template Ambiant_dimension::type type; +}; + + +// Feature_dimension gives access to the dimension of an object. + +template < typename T, typename K = typename Kernel_traits::Kernel > +struct Feature_dimension + : public CGALi::Dim_value< typename K::template Feature_dimension::type > +{ + typedef typename K::template Feature_dimension::type type; +}; CGAL_END_NAMESPACE diff --git a/Kernel_23/include/CGAL/Dimension_tag.h b/Kernel_23/include/CGAL/Dimension_tag.h deleted file mode 100644 index aa1632ae2ef..00000000000 --- a/Kernel_23/include/CGAL/Dimension_tag.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2008 INRIA Sophia-Antipolis (France). -// 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_TAG_H -#define CGAL_DIMENSION_TAG_H - -#include - -CGAL_BEGIN_NAMESPACE - -// This class helps dispatching functions based on the geometric dimension. - -template < int dim > -struct Dimension_tag -{ - static const int value = dim; -}; - -CGAL_END_NAMESPACE - -#endif // CGAL_DIMENSION_TAG_H diff --git a/Kernel_23/include/CGAL/Direction_2.h b/Kernel_23/include/CGAL/Direction_2.h index c70b5df99cf..a008ba765b2 100644 --- a/Kernel_23/include/CGAL/Direction_2.h +++ b/Kernel_23/include/CGAL/Direction_2.h @@ -28,6 +28,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -47,7 +48,8 @@ class Direction_2 : public R_::Kernel_base::Direction_2 public: - static const int static_dimension = 2; + typedef Dimension_tag<2> Ambiant_dimension; + typedef Dimension_tag<0> Feature_dimension; typedef RDirection_2 Rep; diff --git a/Kernel_23/include/CGAL/Direction_3.h b/Kernel_23/include/CGAL/Direction_3.h index 7eefaf7ac5d..ebb203cbc06 100644 --- a/Kernel_23/include/CGAL/Direction_3.h +++ b/Kernel_23/include/CGAL/Direction_3.h @@ -28,6 +28,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -46,7 +47,8 @@ class Direction_3 : public R_::Kernel_base::Direction_3 public: - static const int static_dimension = 3; + typedef Dimension_tag<3> Ambiant_dimension; + typedef Dimension_tag<0> Feature_dimension; typedef typename R_::Kernel_base::Direction_3 Rep; diff --git a/Kernel_23/include/CGAL/Iso_cuboid_3.h b/Kernel_23/include/CGAL/Iso_cuboid_3.h index 5d7e2b96689..305ece6f8f3 100644 --- a/Kernel_23/include/CGAL/Iso_cuboid_3.h +++ b/Kernel_23/include/CGAL/Iso_cuboid_3.h @@ -28,6 +28,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -43,7 +44,8 @@ class Iso_cuboid_3 : public R_::Kernel_base::Iso_cuboid_3 public: - static const int static_dimension = 3; + typedef Dimension_tag<3> Ambiant_dimension; + typedef Dimension_tag<3> Feature_dimension; typedef typename R_::Kernel_base::Iso_cuboid_3 Rep; diff --git a/Kernel_23/include/CGAL/Iso_rectangle_2.h b/Kernel_23/include/CGAL/Iso_rectangle_2.h index 400f20a075c..11cd16aa71a 100644 --- a/Kernel_23/include/CGAL/Iso_rectangle_2.h +++ b/Kernel_23/include/CGAL/Iso_rectangle_2.h @@ -28,6 +28,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -44,7 +45,8 @@ class Iso_rectangle_2 : public R_::Kernel_base::Iso_rectangle_2 public: - static const int static_dimension = 2; + typedef Dimension_tag<2> Ambiant_dimension; + typedef Dimension_tag<2> Feature_dimension; typedef typename R_::Kernel_base::Iso_rectangle_2 Rep; diff --git a/Kernel_23/include/CGAL/Line_2.h b/Kernel_23/include/CGAL/Line_2.h index 20f388d8d0d..88e828035f9 100644 --- a/Kernel_23/include/CGAL/Line_2.h +++ b/Kernel_23/include/CGAL/Line_2.h @@ -27,6 +27,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -48,7 +49,8 @@ class Line_2 : public R_::Kernel_base::Line_2 public: - static const int static_dimension = 2; + typedef Dimension_tag<2> Ambiant_dimension; + typedef Dimension_tag<1> Feature_dimension; typedef RLine_2 Rep; diff --git a/Kernel_23/include/CGAL/Line_3.h b/Kernel_23/include/CGAL/Line_3.h index 5adba15ccba..0a9e4277a65 100644 --- a/Kernel_23/include/CGAL/Line_3.h +++ b/Kernel_23/include/CGAL/Line_3.h @@ -28,6 +28,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -48,7 +49,8 @@ class Line_3 : public R_::Kernel_base::Line_3 public: - static const int static_dimension = 3; + typedef Dimension_tag<3> Ambiant_dimension; + typedef Dimension_tag<1> Feature_dimension; typedef typename R_::Kernel_base::Line_3 Rep; diff --git a/Kernel_23/include/CGAL/Plane_3.h b/Kernel_23/include/CGAL/Plane_3.h index ec095fa0e3e..e07c50b55b2 100644 --- a/Kernel_23/include/CGAL/Plane_3.h +++ b/Kernel_23/include/CGAL/Plane_3.h @@ -27,6 +27,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -48,7 +49,8 @@ class Plane_3 : public R_::Kernel_base::Plane_3 public: - static const int static_dimension = 3; + typedef Dimension_tag<3> Ambiant_dimension; + typedef Dimension_tag<2> Feature_dimension; typedef typename R_::Kernel_base::Plane_3 Rep; diff --git a/Kernel_23/include/CGAL/Point_2.h b/Kernel_23/include/CGAL/Point_2.h index 46ad95e3945..99afa28758e 100644 --- a/Kernel_23/include/CGAL/Point_2.h +++ b/Kernel_23/include/CGAL/Point_2.h @@ -30,6 +30,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -47,7 +48,8 @@ class Point_2 : public R_::Kernel_base::Point_2 public: - static const int static_dimension = 2; + typedef Dimension_tag<2> Ambiant_dimension; + typedef Dimension_tag<0> Feature_dimension; typedef RPoint_2 Rep; typedef typename R_::Cartesian_const_iterator_2 Cartesian_const_iterator; diff --git a/Kernel_23/include/CGAL/Point_3.h b/Kernel_23/include/CGAL/Point_3.h index 71aa0e927da..8e02600a6fb 100644 --- a/Kernel_23/include/CGAL/Point_3.h +++ b/Kernel_23/include/CGAL/Point_3.h @@ -31,6 +31,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -47,7 +48,8 @@ class Point_3 : public R_::Kernel_base::Point_3 public: - static const int static_dimension = 3; + typedef Dimension_tag<3> Ambiant_dimension; + typedef Dimension_tag<0> Feature_dimension; typedef typename R_::Kernel_base::Point_3 Rep; typedef typename R_::Cartesian_const_iterator_3 Cartesian_const_iterator; diff --git a/Kernel_23/include/CGAL/Ray_2.h b/Kernel_23/include/CGAL/Ray_2.h index 5b5eaa7f53e..6bb4d233f85 100644 --- a/Kernel_23/include/CGAL/Ray_2.h +++ b/Kernel_23/include/CGAL/Ray_2.h @@ -28,6 +28,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -49,7 +50,8 @@ class Ray_2 : public R_::Kernel_base::Ray_2 public: - static const int static_dimension = 2; + typedef Dimension_tag<2> Ambiant_dimension; + typedef Dimension_tag<1> Feature_dimension; typedef RRay_2 Rep; diff --git a/Kernel_23/include/CGAL/Ray_3.h b/Kernel_23/include/CGAL/Ray_3.h index beb41b3cf42..d3138680ca3 100644 --- a/Kernel_23/include/CGAL/Ray_3.h +++ b/Kernel_23/include/CGAL/Ray_3.h @@ -28,6 +28,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -46,7 +47,8 @@ class Ray_3 : public R_::Kernel_base::Ray_3 public: - static const int static_dimension = 3; + typedef Dimension_tag<3> Ambiant_dimension; + typedef Dimension_tag<1> Feature_dimension; typedef typename R_::Kernel_base::Ray_3 Rep; diff --git a/Kernel_23/include/CGAL/Segment_2.h b/Kernel_23/include/CGAL/Segment_2.h index d023e36cb23..f3614ff119f 100644 --- a/Kernel_23/include/CGAL/Segment_2.h +++ b/Kernel_23/include/CGAL/Segment_2.h @@ -28,6 +28,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -48,7 +49,8 @@ class Segment_2 : public R_::Kernel_base::Segment_2 public: - static const int static_dimension = 2; + typedef Dimension_tag<2> Ambiant_dimension; + typedef Dimension_tag<1> Feature_dimension; typedef RSegment_2 Rep; diff --git a/Kernel_23/include/CGAL/Segment_3.h b/Kernel_23/include/CGAL/Segment_3.h index fd23a6708cf..d1abf85b1b5 100644 --- a/Kernel_23/include/CGAL/Segment_3.h +++ b/Kernel_23/include/CGAL/Segment_3.h @@ -28,6 +28,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -47,7 +48,8 @@ class Segment_3 : public R_::Kernel_base::Segment_3 public: - static const int static_dimension = 3; + typedef Dimension_tag<3> Ambiant_dimension; + typedef Dimension_tag<1> Feature_dimension; typedef typename R_::Kernel_base::Segment_3 Rep; diff --git a/Kernel_23/include/CGAL/Sphere_3.h b/Kernel_23/include/CGAL/Sphere_3.h index e730c6bb66a..77521680eb3 100644 --- a/Kernel_23/include/CGAL/Sphere_3.h +++ b/Kernel_23/include/CGAL/Sphere_3.h @@ -29,6 +29,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -44,7 +45,8 @@ class Sphere_3 : public R_::Kernel_base::Sphere_3 public: - static const int static_dimension = 3; + typedef Dimension_tag<3> Ambiant_dimension; + typedef Dimension_tag<2> Feature_dimension; typedef typename R_::Kernel_base::Sphere_3 Rep; diff --git a/Kernel_23/include/CGAL/Tetrahedron_3.h b/Kernel_23/include/CGAL/Tetrahedron_3.h index a31a3a57976..99d62f41262 100644 --- a/Kernel_23/include/CGAL/Tetrahedron_3.h +++ b/Kernel_23/include/CGAL/Tetrahedron_3.h @@ -28,6 +28,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -42,7 +43,8 @@ class Tetrahedron_3 : public R_::Kernel_base::Tetrahedron_3 public: - static const int static_dimension = 3; + typedef Dimension_tag<3> Ambiant_dimension; + typedef Dimension_tag<3> Feature_dimension; typedef typename R_::Kernel_base::Tetrahedron_3 Rep; diff --git a/Kernel_23/include/CGAL/Triangle_2.h b/Kernel_23/include/CGAL/Triangle_2.h index c22c4770fd5..0244dd67a6f 100644 --- a/Kernel_23/include/CGAL/Triangle_2.h +++ b/Kernel_23/include/CGAL/Triangle_2.h @@ -28,6 +28,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -43,7 +44,8 @@ class Triangle_2 : public R_::Kernel_base::Triangle_2 public: - static const int static_dimension = 2; + typedef Dimension_tag<2> Ambiant_dimension; + typedef Dimension_tag<2> Feature_dimension; typedef RTriangle_2 Rep; diff --git a/Kernel_23/include/CGAL/Triangle_3.h b/Kernel_23/include/CGAL/Triangle_3.h index 665e7f8e12c..5cda52364f1 100644 --- a/Kernel_23/include/CGAL/Triangle_3.h +++ b/Kernel_23/include/CGAL/Triangle_3.h @@ -28,6 +28,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -45,7 +46,8 @@ class Triangle_3 : public R_::Kernel_base::Triangle_3 public: - static const int static_dimension = 3; + typedef Dimension_tag<3> Ambiant_dimension; + typedef Dimension_tag<2> Feature_dimension; typedef typename R_::Kernel_base::Triangle_3 Rep; diff --git a/Kernel_23/include/CGAL/Vector_2.h b/Kernel_23/include/CGAL/Vector_2.h index 36839d88da6..33adf82d275 100644 --- a/Kernel_23/include/CGAL/Vector_2.h +++ b/Kernel_23/include/CGAL/Vector_2.h @@ -30,6 +30,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -51,7 +52,8 @@ class Vector_2 : public R_::Kernel_base::Vector_2 public: - static const int static_dimension = 2; + typedef Dimension_tag<2> Ambiant_dimension; + typedef Dimension_tag<0> Feature_dimension; typedef RVector_2 Rep; typedef typename R_::Cartesian_const_iterator_2 Cartesian_const_iterator; diff --git a/Kernel_23/include/CGAL/Vector_3.h b/Kernel_23/include/CGAL/Vector_3.h index bb77390c23d..800d712cf18 100644 --- a/Kernel_23/include/CGAL/Vector_3.h +++ b/Kernel_23/include/CGAL/Vector_3.h @@ -30,6 +30,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -50,7 +51,8 @@ class Vector_3 : public R_::Kernel_base::Vector_3 public: - static const int static_dimension = 3; + typedef Dimension_tag<3> Ambiant_dimension; + typedef Dimension_tag<0> Feature_dimension; typedef typename R_::Cartesian_const_iterator_3 Cartesian_const_iterator; typedef typename R_::Kernel_base::Vector_3 Rep; diff --git a/Kernel_23/test/Kernel_23/Dimension.cpp b/Kernel_23/test/Kernel_23/Dimension.cpp index 1e450a38341..8fde9e20ef3 100644 --- a/Kernel_23/test/Kernel_23/Dimension.cpp +++ b/Kernel_23/test/Kernel_23/Dimension.cpp @@ -1,5 +1,5 @@ -// Test program for Dimension<>. -// Sylvain Pion, 2005. +// Test program for Ambiant_dimension<> and Feature_dimension<>. +// Sylvain Pion, 2005, 2008. #include #include @@ -10,65 +10,107 @@ #include #include -#include +#include template < typename K > void test(CGAL::Dimension_tag<2>) { - assert( 2 == CGAL::Dimension::value ); - assert( 2 == CGAL::Dimension::value ); - assert( 2 == CGAL::Dimension::value ); - assert( 2 == CGAL::Dimension::value ); - assert( 2 == CGAL::Dimension::value ); - assert( 2 == CGAL::Dimension::value ); - assert( 2 == CGAL::Dimension::value ); - assert( 2 == CGAL::Dimension::value ); - assert( 2 == CGAL::Dimension::value ); - assert( 2 == CGAL::Dimension::value ); - assert( 2 == CGAL::Dimension::value ); + assert( 2 == CGAL::Ambiant_dimension::value ); + assert( 2 == CGAL::Ambiant_dimension::value ); + assert( 2 == CGAL::Ambiant_dimension::value ); + assert( 2 == CGAL::Ambiant_dimension::value ); + assert( 2 == CGAL::Ambiant_dimension::value ); + assert( 2 == CGAL::Ambiant_dimension::value ); + assert( 2 == CGAL::Ambiant_dimension::value ); + assert( 2 == CGAL::Ambiant_dimension::value ); + assert( 2 == CGAL::Ambiant_dimension::value ); + assert( 2 == CGAL::Ambiant_dimension::value ); + assert( 2 == CGAL::Ambiant_dimension::value ); + assert( 2 == CGAL::Ambiant_dimension::value ); + + assert( 0 == CGAL::Feature_dimension::value ); + assert( 0 == CGAL::Feature_dimension::value ); + assert( 0 == CGAL::Feature_dimension::value ); + assert( 1 == CGAL::Feature_dimension::value ); + assert( 1 == CGAL::Feature_dimension::value ); + assert( 1 == CGAL::Feature_dimension::value ); + assert( 2 == CGAL::Feature_dimension::value ); + assert( 2 == CGAL::Feature_dimension::value ); + assert( 1 == CGAL::Feature_dimension::value ); + assert( 1 == CGAL::Feature_dimension::value ); + // assert( ? == CGAL::Feature_dimension::value ); + assert( 2 == CGAL::Feature_dimension::value ); } template < typename K > void test(CGAL::Dimension_tag<3>) { - assert( 3 == CGAL::Dimension::value ); - assert( 3 == CGAL::Dimension::value ); - assert( 3 == CGAL::Dimension::value ); - assert( 3 == CGAL::Dimension::value ); - assert( 3 == CGAL::Dimension::value ); - assert( 3 == CGAL::Dimension::value ); - assert( 3 == CGAL::Dimension::value ); - assert( 3 == CGAL::Dimension::value ); - assert( 3 == CGAL::Dimension::value ); - assert( 3 == CGAL::Dimension::value ); - assert( 3 == CGAL::Dimension::value ); - assert( 3 == CGAL::Dimension::value ); + assert( 3 == CGAL::Ambiant_dimension::value ); + assert( 3 == CGAL::Ambiant_dimension::value ); + assert( 3 == CGAL::Ambiant_dimension::value ); + assert( 3 == CGAL::Ambiant_dimension::value ); + assert( 3 == CGAL::Ambiant_dimension::value ); + assert( 3 == CGAL::Ambiant_dimension::value ); + assert( 3 == CGAL::Ambiant_dimension::value ); + assert( 3 == CGAL::Ambiant_dimension::value ); + assert( 3 == CGAL::Ambiant_dimension::value ); + assert( 3 == CGAL::Ambiant_dimension::value ); + assert( 3 == CGAL::Ambiant_dimension::value ); + assert( 3 == CGAL::Ambiant_dimension::value ); + assert( 3 == CGAL::Ambiant_dimension::value ); + + assert( 0 == CGAL::Feature_dimension::value ); + assert( 2 == CGAL::Feature_dimension::value ); + assert( 0 == CGAL::Feature_dimension::value ); + assert( 0 == CGAL::Feature_dimension::value ); + assert( 1 == CGAL::Feature_dimension::value ); + assert( 1 == CGAL::Feature_dimension::value ); + assert( 1 == CGAL::Feature_dimension::value ); + assert( 2 == CGAL::Feature_dimension::value ); + assert( 3 == CGAL::Feature_dimension::value ); + assert( 3 == CGAL::Feature_dimension::value ); + assert( 2 == CGAL::Feature_dimension::value ); + // assert( ? == CGAL::Feature_dimension::value ); + assert( 3 == CGAL::Feature_dimension::value ); } +void check_dyn_dim(CGAL::Dynamic_dimension_tag) {} + template < typename K > -void test(CGAL::Dimension_tag) +void test(CGAL::Dynamic_dimension_tag) { - assert( CGAL::Dynamic_dimension == CGAL::Dimension::value ); - assert( CGAL::Dynamic_dimension == CGAL::Dimension::value ); - assert( CGAL::Dynamic_dimension == CGAL::Dimension::value ); - assert( CGAL::Dynamic_dimension == CGAL::Dimension::value ); - assert( CGAL::Dynamic_dimension == CGAL::Dimension::value ); - assert( CGAL::Dynamic_dimension == CGAL::Dimension::value ); - assert( CGAL::Dynamic_dimension == CGAL::Dimension::value ); - assert( CGAL::Dynamic_dimension == CGAL::Dimension::value ); - assert( CGAL::Dynamic_dimension == CGAL::Dimension::value ); - assert( CGAL::Dynamic_dimension == CGAL::Dimension::value ); + check_dyn_dim(typename CGAL::Ambiant_dimension::type() ); + check_dyn_dim(typename CGAL::Ambiant_dimension::type() ); + check_dyn_dim(typename CGAL::Ambiant_dimension::type() ); + check_dyn_dim(typename CGAL::Ambiant_dimension::type() ); + check_dyn_dim(typename CGAL::Ambiant_dimension::type() ); + check_dyn_dim(typename CGAL::Ambiant_dimension::type() ); + check_dyn_dim(typename CGAL::Ambiant_dimension::type() ); + check_dyn_dim(typename CGAL::Ambiant_dimension::type() ); + check_dyn_dim(typename CGAL::Ambiant_dimension::type() ); + check_dyn_dim(typename CGAL::Ambiant_dimension::type() ); + + assert( 0 == CGAL::Feature_dimension::value ); + assert( 0 == CGAL::Feature_dimension::value ); + assert( 0 == CGAL::Feature_dimension::value ); + assert( 1 == CGAL::Feature_dimension::value ); + assert( 1 == CGAL::Feature_dimension::value ); + assert( 1 == CGAL::Feature_dimension::value ); + check_dyn_dim(typename CGAL::Feature_dimension::type() ); + check_dyn_dim(typename CGAL::Feature_dimension::type() ); + check_dyn_dim(typename CGAL::Feature_dimension::type() ); + // check_dyn_dim(typename CGAL::Feature_dimension::type() ); } int main() { test >(CGAL::Dimension_tag<2>()); test >(CGAL::Dimension_tag<3>()); - test >(CGAL::Dimension_tag()); + test >(CGAL::Dynamic_dimension_tag()); test >(CGAL::Dimension_tag<2>()); test >(CGAL::Dimension_tag<3>()); - test >(CGAL::Dimension_tag()); + test >(CGAL::Dynamic_dimension_tag()); test(CGAL::Dimension_tag<2>()); test(CGAL::Dimension_tag<3>()); diff --git a/Kernel_d/include/CGAL/Cartesian_d.h b/Kernel_d/include/CGAL/Cartesian_d.h index 3edcc15c457..a79091eb81b 100644 --- a/Kernel_d/include/CGAL/Cartesian_d.h +++ b/Kernel_d/include/CGAL/Cartesian_d.h @@ -46,8 +46,6 @@ #include #include -#include - CGAL_BEGIN_NAMESPACE template > @@ -76,9 +74,14 @@ public: typedef typename Point_d_base::Cartesian_const_iterator Cartesian_const_iterator_d; - template - struct Dimension { - static const int value = Dynamic_dimension; + template + struct Ambiant_dimension { + typedef typename T::Ambiant_dimension type; + }; + + template + struct Feature_dimension { + typedef typename T::Feature_dimension type; }; template diff --git a/Kernel_d/include/CGAL/Homogeneous_d.h b/Kernel_d/include/CGAL/Homogeneous_d.h index 0a8c51da83b..79f3607d09c 100644 --- a/Kernel_d/include/CGAL/Homogeneous_d.h +++ b/Kernel_d/include/CGAL/Homogeneous_d.h @@ -47,8 +47,6 @@ #include #include -#include - CGAL_BEGIN_NAMESPACE template > @@ -76,9 +74,14 @@ public: typedef typename Point_d_base::Cartesian_const_iterator Cartesian_const_iterator_d; - template - struct Dimension { - static const int value = Dynamic_dimension; + template + struct Ambiant_dimension { + typedef typename T::Ambiant_dimension type; + }; + + template + struct Feature_dimension { + typedef typename T::Feature_dimension type; }; template diff --git a/Kernel_d/include/CGAL/Kernel_d/Aff_transformation_d.h b/Kernel_d/include/CGAL/Kernel_d/Aff_transformation_d.h index 68fd07eb02d..41e550107df 100644 --- a/Kernel_d/include/CGAL/Kernel_d/Aff_transformation_d.h +++ b/Kernel_d/include/CGAL/Kernel_d/Aff_transformation_d.h @@ -18,17 +18,21 @@ // $URL$ // $Id$ // -// // Author(s) : Michael Seel #ifndef CGAL_AFF_TRANSFORMATION_D_H #define CGAL_AFF_TRANSFORMATION_D_H +#include + CGAL_BEGIN_NAMESPACE template class Aff_transformation_d : public pR::Aff_transformation_d_base { public: + + typedef CGAL::Dynamic_dimension_tag Ambiant_dimension; + typedef typename pR::Aff_transformation_d_base Base; typedef Aff_transformation_d Self; typedef pR R; diff --git a/Kernel_d/include/CGAL/Kernel_d/Direction_d.h b/Kernel_d/include/CGAL/Kernel_d/Direction_d.h index 407e78ca216..b197f208fdb 100644 --- a/Kernel_d/include/CGAL/Kernel_d/Direction_d.h +++ b/Kernel_d/include/CGAL/Kernel_d/Direction_d.h @@ -20,14 +20,21 @@ // // // Author(s) : Michael Seel + #ifndef CGAL_DIRECTION_D_H #define CGAL_DIRECTION_D_H +#include + CGAL_BEGIN_NAMESPACE template class Direction_d : public pR::Direction_d_base { public: + + typedef CGAL::Dynamic_dimension_tag Ambiant_dimension; + typedef CGAL::Dimension_tag<0> Feature_dimension; + typedef typename pR::Direction_d_base Base; typedef Direction_d Self; typedef pR R; diff --git a/Kernel_d/include/CGAL/Kernel_d/Hyperplane_d.h b/Kernel_d/include/CGAL/Kernel_d/Hyperplane_d.h index 0143696951c..9589a9cf025 100644 --- a/Kernel_d/include/CGAL/Kernel_d/Hyperplane_d.h +++ b/Kernel_d/include/CGAL/Kernel_d/Hyperplane_d.h @@ -24,12 +24,18 @@ #ifndef CGAL_HYPERPLANE_D_H #define CGAL_HYPERPLANE_D_H +#include + CGAL_BEGIN_NAMESPACE template class Hyperplane_d : public pR::Hyperplane_d_base { public: + + typedef CGAL::Dynamic_dimension_tag Ambiant_dimension; + typedef CGAL::Dynamic_dimension_tag Feature_dimension; + typedef typename pR::Hyperplane_d_base Base; typedef Hyperplane_d Self; typedef pR R; diff --git a/Kernel_d/include/CGAL/Kernel_d/Iso_box_d.h b/Kernel_d/include/CGAL/Kernel_d/Iso_box_d.h index 074f152a7fa..577a35e2cd2 100644 --- a/Kernel_d/include/CGAL/Kernel_d/Iso_box_d.h +++ b/Kernel_d/include/CGAL/Kernel_d/Iso_box_d.h @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -311,6 +312,9 @@ namespace CGAL { public: + typedef CGAL::Dynamic_dimension_tag Ambiant_dimension; + typedef CGAL::Dynamic_dimension_tag Feature_dimension; + Iso_box_d() {} Iso_box_d(const Point_d& p, const Point_d& q) diff --git a/Kernel_d/include/CGAL/Kernel_d/Line_d.h b/Kernel_d/include/CGAL/Kernel_d/Line_d.h index 5313cba709a..afcf2a7e22b 100644 --- a/Kernel_d/include/CGAL/Kernel_d/Line_d.h +++ b/Kernel_d/include/CGAL/Kernel_d/Line_d.h @@ -27,6 +27,7 @@ #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -50,6 +51,10 @@ An instance of data type |Line_d| is an oriented line in $d$-dimensional Euclidian space.}*/ public: + + typedef CGAL::Dynamic_dimension_tag Ambiant_dimension; + typedef CGAL::Dimension_tag<1> Feature_dimension; + /*{\Mtypes 5}*/ typedef p_R R; /*{\Mtypemember the representation type.}*/ diff --git a/Kernel_d/include/CGAL/Kernel_d/Point_d.h b/Kernel_d/include/CGAL/Kernel_d/Point_d.h index 2b07aa38434..040c5dd1c5b 100644 --- a/Kernel_d/include/CGAL/Kernel_d/Point_d.h +++ b/Kernel_d/include/CGAL/Kernel_d/Point_d.h @@ -20,9 +20,12 @@ // // // Author(s) : Michael Seel + #ifndef CGAL_POINT_D_H #define CGAL_POINT_D_H +#include + CGAL_BEGIN_NAMESPACE template @@ -37,6 +40,9 @@ private: typedef typename R::LA LA; public: + typedef CGAL::Dynamic_dimension_tag Ambiant_dimension; + typedef CGAL::Dimension_tag<0> Feature_dimension; + Point_d(int d=0) : Base(d) {} Point_d(int d, const Origin &o) : Base(d,o) {} diff --git a/Kernel_d/include/CGAL/Kernel_d/Ray_d.h b/Kernel_d/include/CGAL/Kernel_d/Ray_d.h index ad6ac38d0c0..de2e548a8ab 100644 --- a/Kernel_d/include/CGAL/Kernel_d/Ray_d.h +++ b/Kernel_d/include/CGAL/Kernel_d/Ray_d.h @@ -20,12 +20,14 @@ // // // Author(s) : Michael Seel + #ifndef CGAL_RAY_D_H #define CGAL_RAY_D_H #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -51,6 +53,10 @@ Euclidian space. It starts in a point called the source of |\Mvar| and it goes to infinity.}*/ public: + + typedef CGAL::Dynamic_dimension_tag Ambiant_dimension; + typedef CGAL::Dimension_tag<1> Feature_dimension; + /*{\Mtypes 4}*/ typedef p_R R; /*{\Mtypemember the representation type.}*/ diff --git a/Kernel_d/include/CGAL/Kernel_d/Segment_d.h b/Kernel_d/include/CGAL/Kernel_d/Segment_d.h index 604432d35e3..a2e7aa6bb3d 100644 --- a/Kernel_d/include/CGAL/Kernel_d/Segment_d.h +++ b/Kernel_d/include/CGAL/Kernel_d/Segment_d.h @@ -20,12 +20,14 @@ // // // Author(s) : Michael Seel + #ifndef CGAL_SEGMENT_D_H #define CGAL_SEGMENT_D_H #include #include #include +#include CGAL_BEGIN_NAMESPACE @@ -53,6 +55,10 @@ $p$ and $q$. $p$ is called the source point and $q$ is called the target point of $s$, both points are called endpoints of $s$. A segment whose endpoints are equal is called \emph{degenerate}.}*/ public: + + typedef CGAL::Dynamic_dimension_tag Ambiant_dimension; + typedef CGAL::Dimension_tag<1> Feature_dimension; + /*{\Mtypes 5}*/ typedef p_R R; /*{\Mtypemember the representation type.}*/ diff --git a/Kernel_d/include/CGAL/Kernel_d/Sphere_d.h b/Kernel_d/include/CGAL/Kernel_d/Sphere_d.h index 9c6d7951536..06d895b2eea 100644 --- a/Kernel_d/include/CGAL/Kernel_d/Sphere_d.h +++ b/Kernel_d/include/CGAL/Kernel_d/Sphere_d.h @@ -20,11 +20,13 @@ // // // Author(s) : Michael Seel + #ifndef CGAL_SPHERE_D_H #define CGAL_SPHERE_D_H #include #include +#include CGAL_BEGIN_NAMESPACE @@ -77,6 +79,9 @@ set of defining points to be legal. The orientation of $S$ is equal to the orientation of the defining points, i.e., |orientation(A)|. }*/ public: + typedef CGAL::Dynamic_dimension_tag Ambiant_dimension; + typedef CGAL::Dynamic_dimension_tag Feature_dimension; + /*{\Mtypes 4}*/ typedef Sphere_d_rep Rep; diff --git a/Kernel_d/include/CGAL/Kernel_d/Vector_d.h b/Kernel_d/include/CGAL/Kernel_d/Vector_d.h index 75d05412024..0bc4409f72d 100644 --- a/Kernel_d/include/CGAL/Kernel_d/Vector_d.h +++ b/Kernel_d/include/CGAL/Kernel_d/Vector_d.h @@ -17,17 +17,23 @@ // // $URL$ // $Id$ -// // // Author(s) : Michael Seel + #ifndef CGAL_VECTOR_D_H #define CGAL_VECTOR_D_H +#include + CGAL_BEGIN_NAMESPACE template class Vector_d : public pR::Vector_d_base { public: + + typedef CGAL::Dynamic_dimension_tag Ambiant_dimension; + typedef CGAL::Dimension_tag<0> Feature_dimension; + typedef typename pR::Vector_d_base Base; typedef Vector_d Self; typedef pR R; diff --git a/Principal_component_analysis/include/CGAL/PCA_util.h b/Principal_component_analysis/include/CGAL/PCA_util.h index 6d32b4a6006..e3de021e356 100644 --- a/Principal_component_analysis/include/CGAL/PCA_util.h +++ b/Principal_component_analysis/include/CGAL/PCA_util.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include CGAL_BEGIN_NAMESPACE diff --git a/Principal_component_analysis/include/CGAL/centroid.h b/Principal_component_analysis/include/CGAL/centroid.h index e2b7a5dccdf..18133b76225 100644 --- a/Principal_component_analysis/include/CGAL/centroid.h +++ b/Principal_component_analysis/include/CGAL/centroid.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include // Functions to compute the centroid of N points. diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h index 20c27325f8e..86082c66122 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_2.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include diff --git a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h index 72d64c7c127..fd696ad3ebd 100644 --- a/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h +++ b/Principal_component_analysis/include/CGAL/linear_least_squares_fitting_3.h @@ -31,7 +31,7 @@ #include #include -#include +#include #include #include