diff --git a/.gitattributes b/.gitattributes index e29281a5fa5..141dd62ca7a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1376,7 +1376,6 @@ Combinatorial_map/doc_tex/Combinatorial_map_ref/Dart_base.tex -text Combinatorial_map/doc_tex/Combinatorial_map_ref/intro.tex -text Combinatorial_map/doc_tex/Combinatorial_map_ref/main.tex -text Combinatorial_map/dont_submit -text -Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt -text Combinatorial_map/examples/Combinatorial_map/map_3_marks.cpp -text Combinatorial_map/examples/Combinatorial_map/map_3_operations.cpp -text Combinatorial_map/examples/Combinatorial_map/map_3_simple_example.cpp -text @@ -1770,6 +1769,7 @@ Installation/config/support/print_QT_version.cpp -text Installation/config/support/print_TAUCS_version.cpp -text Installation/config/support/print_ZLIB_version.cpp -text Installation/config/support/test_BOOST_THREAD.cpp -text +Installation/config/testfiles/CGAL_CFG_NO_CPP0X_COPY_N.cpp -text Installation/config/testfiles/CGAL_CFG_NO_CPP0X_ISFINITE.cpp -text Installation/config/testfiles/CGAL_CFG_NO_CPP0X_NEXT_PREV.cpp -text Installation/config/version.h.in -text @@ -2579,6 +2579,8 @@ Min_sphere_of_spheres_d/test_extensive/stability/maple/balls-on-boundary-3.mws - Min_sphere_of_spheres_d/web/figs/heuristic/excess.xfig -text svneol=unset#application/octet-stream Min_sphere_of_spheres_d/web/figs/mbex/mbex.xfig -text svneol=unset#application/octet-stream Min_sphere_of_spheres_d/web/figs/pivot/cex.xfig -text svneol=unset#application/octet-stream +Minkowski_sum_2/benchmark/Minkowski_sum_2/print_utils.h -text +Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp -text Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/Minkowski_sum_2.png -text Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/approx_offset.fig -text svneol=unset#application/octet-stream Minkowski_sum_2/doc_tex/Minkowski_sum_2/fig/approx_offset.gif -text svneol=unset#image/gif @@ -3328,6 +3330,9 @@ Ridges_3/examples/Ridges_3/data/poly2x^2+y^2-0.062500.off -text svneol=unset#app Ridges_3/examples/Ridges_3/skip_vcproj_auto_generation -text Ridges_3/test/Ridges_3/data/ellipsoid.off -text svneol=unset#application/octet-stream Robustness/demo/Robustness/help/index.html svneol=native#text/html +STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt -text +STL_Extension/benchmark/copy_n_benchmark/copy_n_benchmark.cpp -text +STL_Extension/benchmark/copy_n_benchmark/copy_n_use_case_benchmark.cpp -text STL_Extension/doc_tex/STL_Extension/plusplus.png -text STL_Extension/include/CGAL/internal/boost/array_binary_tree.hpp -text STL_Extension/include/CGAL/internal/boost/mutable_heap.hpp -text diff --git a/AABB_tree/doc_tex/AABB_tree_ref/AABB_tree.tex b/AABB_tree/doc_tex/AABB_tree_ref/AABB_tree.tex index 4f872291da5..3e30b0846f3 100644 --- a/AABB_tree/doc_tex/AABB_tree_ref/AABB_tree.tex +++ b/AABB_tree/doc_tex/AABB_tree_ref/AABB_tree.tex @@ -1,186 +1,186 @@ -% +------------------------------------------------------------------------+ -% | Reference manual page: AABB_tree.tex -% +------------------------------------------------------------------------+ -% | 21.02.2009 Author -% | Package: Package -% | -\RCSdef{\RCSAABBtreeRev}{$Id: header.tex 40270 2007-09-07 15:29:10Z lsaboret $} -\RCSdefDate{\RCSAABBtreeDate}{$Date: 2007-09-07 17:29:10 +0200 (Ven, 07 sep 2007) $} -% | -\ccRefPageBegin -%%RefPage: end of header, begin of main body -% +------------------------------------------------------------------------+ - - -\begin{ccRefClass}{AABB_tree} %% add template arg's if necessary - -%% \ccHtmlCrossLink{} %% add further rules for cross referencing links -%% \ccHtmlIndexC[class]{} %% add further index entries - -\ccDefinition - -Class \ccRefName\ is a static data structure for efficient intersection and distance computations in 3D. It builds a hierarchy of axis-aligned bounding boxes (an AABB tree) from a set of 3D geometric objects, and can receive intersection and distance queries, provided that the corresponding predicates are implemented in the traits class \ccc{AT}. The template parameter \ccc{AT} stands for a traits class which must be a model of the concept \ccc{AABBTraits}. - -\ccInclude{CGAL/AABB_tree.h} - -\ccTypes -\ccNestedType{size_type;}{Unsigned integral size type.} -\ccGlue -\ccTypedef{typedef AT::FT FT;}{Number type returned by the distance queries.} -\ccGlue -\ccTypedef{typedef AT::Point_3 Point;}{Type of 3D point.} -\ccGlue -\ccTypedef{typedef AT::Primitive Primitive;}{Type of input primitive.} -\ccGlue -\ccTypedef{typedef AT::Bounding_box Bounding_box;}{Type of bounding box.} -\ccGlue -\ccTypedef{typedef std::pair Point_and_primitive_id;}{} -\ccGlue -\ccTypedef{typedef std::pair Object_and_primitive_id;}{} - -\ccCreation -\ccCreationVariable{tree} - -\ccConstructor{AABB_tree();}{Constructs an empty tree.} -\ccConstructor{template < class InputIterator> - AABB_tree( InputIterator begin, - InputIterator beyond);}{Builds the AABB tree data structure. Type \ccc{InputIterator} can be any const iterator such that \ccc{Primitive} has a constructor taking a \ccc{InputIterator} as argument. The tree stays empty if the memory allocation is not successful.} - -\ccOperations - -\ccMethod{template < class InputIterator> - void rebuild(InputIterator begin, - InputIterator beyond);}{Clears the current tree and rebuilds it from scratch. See constructor above for the parameters. } -\ccGlue -\ccMethod{void clear();}{Clears the AABB tree. } - -\ccGlue -\ccMethod{template - void insert(InputIterator begin, InputIterator beyond);} - {Add a sequence of primitives to the set of primitive of the AABB - tree. Type \ccc{InputIterator} can be any const iterator such that \ccc{Primitive} - has a constructor taking an InputIterator as argument.} -\ccGlue -\ccMethod{void insert(const Primitive p);} - {Add a primitive to the set of primitives of the AABB tree.} - -\begin{ccAdvanced} -\ccMethod{void build();} - {After one or more calls to \ccHtmlNoLinksFrom{\ccc{insert}}, the internal data structure - of \ccRefName\ must be reconstructed. This procedure has a complexity of - \ccc{O(n log(n))}, where n is the number of primitives of the tree. This - procedure is called implicitly at the first call to a query member - function. You can call \ccc{build()} explicitly to ensure that the - next call to query functions will not trigger the reconstruction of the - data structure.} -\end{ccAdvanced} - - -\ccGlue -\ccMethod{Bounding_box bbox();}{Returns the axis-aligned bounding box of the whole tree. } -\ccGlue -\ccMethod{size_type size();}{Returns the number of primitives in the tree. } -\ccGlue -\ccMethod{bool empty();}{Returns \ccc{true}, iff tree contains no primitive. } - -% INTERSECTION TESTS -\ccHeading{Intersection Tests} - -\ccMethod{template - bool do_intersect(const Query& query);}{Returns \ccc{true}, iff the query intersects at least one of the input primitives. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} -\ccGlue -\ccMethod{template - size_type number_of_intersected_primitives(const Query& query);}{Returns the number of primitives intersected by the query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} -\ccGlue -\ccMethod{template - OutputIterator - all_intersected_primitives(const Query& query, - OutputIterator out);}{Outputs to the iterator the list of all intersected primitives ids. This function does not compute the intersection points and is hence faster than the function \ccc{all_intersections} function below. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} -\ccGlue -\ccMethod{template - boost::optional - any_intersected_primitive(const Query& query);}{Returns the first encountered intersected primitive id, iff the query intersects at least one of the input primitives. No particular order is guaranteed over the tree traversal, such that, e.g, the primitive returned is not necessarily the closest from the source point of a ray query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} - - -% INTERSECTIONS -\ccHeading{Intersections} - -\ccMethod{template - OutputIterator - all_intersections(const Query& query, - OutputIterator out);}{Outputs to the iterator the list of all intersections between the query and input data, as objects of type \ccc{Object_and_primitive_id}. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates and intersections are defined in the \ccc{AT} class.} -\ccGlue -\ccMethod{template - boost::optional - any_intersection(const Query& query);}{Returns the first encountered intersection, iff the query intersects at least one of the input primitives. No particular order is guaranteed over the tree traversal, such that, e.g, the primitive returned is not necessarily the closest from the source point of a ray query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates and intersections are defined in the \ccc{AT} class.} - - - -% DISTANCE QUERIES -\ccHeading{Distance Queries} - -\ccMethod{FT -squared_distance(const Point& query);}{Returns the minimum squared distance between the query point and all input primitives. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} -\ccGlue -\ccMethod{Point -closest_point(const Point& query);}{Returns the point in the union of all input primitives which is closest to the query. In case there are several closest points, one arbitrarily chosen closest point is returned. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} -\ccGlue -\ccMethod{Point_and_primitive_id -closest_point_and_primitive(const Point& query);}{Returns a \ccc{Point_and_primitive_id} which realizes the smallest distance between the query point and all input primitives. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} - -% ACCELERATING THE DISTANCE QUERIES - -\ccHeading{Accelerating the Distance Queries} - -\ccMethod{bool accelerate_distance_queries();}{ Constructs an internal data structure for accelerating distance queries. This method should be called once, before the first distance query. -Returns \ccc{true}, iff the memory allocation is successful.} - -\begin{ccAdvanced} -In the following paragraphs, we discuss details of the implementation of the distance queries. We explain the internal use of hints, how the user can pass his own hints to the tree, and how the user can influence the construction of the secondary data structure used for accelerating distance queries. - -Internally, the distance queries algorithms are initialized with some hint, which has the same type as the return type of the query, and this value is refined along a traversal of the tree, until it is optimal, that is to say until it realizes the shortest distance to the primitives. In particular, the exact specification of these internal algorithms is that they minimize the distance to the object composed of the union of the primitives and the hint. - -It follows that -\begin{itemize} -\item in order to return the exact distance to the set of primitives, the algorithms need the hint to be exactly on the primitives; -\item if this is not the case, and if the hint happens to be closer to the query point than any of the primitives, then the hint is returned. -\end{itemize} -This second observation is reasonable, in the sense that providing a hint to the algorithm means claiming that this hint belongs to the union of the primitives. These considerations about the hints being exactly on the primitives or not are important: in the case where the set of primitives is a triangle soup, and if some of the primitives are large, one may want to provide a much better hint than a vertex of the triangle soup could be. It could be, for example, the barycenter of one of the triangles. But, except with the use of an exact constructions kernel, one cannot easily construct points other than the vertices, that lie exactly on a triangle soup. Hence, providing a good hint sometimes means not being able to provide it exactly on the primitives. In rare occasions, this hint can be returned as the closest point. - -In order to accelerate distance queries significantly, the AABB tree builds an internal KD-tree containing a set of potential hints, when the method \ccc{accelerate_distance_queries} is called. This KD-tree provides very good hints that allow the algorithms to run much faster than with a default hint (such as the \ccc{reference_point} of the first primitive). The set of potential hints is a sampling of the union of the primitives, which is obtained, by default, by calling the method \ccc{reference_point} of each of the primitives. However, such a sampling with one point per primitive may not be the most relevant one: if some primitives are very large, it helps inserting more than one sample on them. Conversely, a sparser sampling with less than one point per input primitive is relevant in some cases. - -For this reason, the user can provide his own set of sample points: - -\ccMethod{template -bool accelerate_distance_queries(InputIterator begin, - InputIterator beyond, - PointAndIdBuilder idb = - PointAndIdBuilder());}{ Constructs an internal KD-tree containing the specified point set, to be used as the set of potential hints for accelerating the distance queries. Iterator \ccc{InputIterator} must be accepted as argument by the operator provided by the \ccc{idb} object: this operator returns a \ccc{Point_and_primitive_id} corresponding to the object the iterator points to.} - -Note that, in some cases, the user is not able to provide ids of the primitives on which the points lie. In these cases, providing a default value for the ids of the hints is possible. Still, the user should be aware that if she uses the \ccc{closest_point_and_primitive} method, there is a (tiny) chance that a hint is returned, along with this default value as corresponding primitive id. Hence, the validity of the returned primitive id should be checked in these cases. - -As an alternative to using the KD-tree, the user can also provide the hints directly, by using the following methods: - -\ccMethod{FT -squared_distance(const Point& query, const Point& hint);}{Returns the minimum squared distance between the query point and all input primitives. The internal KD-tree is not used.} - -\ccMethod{Point -closest_point(const Point& query, const Point& hint);}{Returns the point in the union of all input primitives which is closest to the query. In case there are several closest points, one arbitrarily chosen closest point is returned. The internal KD-tree is not used.} - -\ccMethod{Point_and_primitive_id -closest_point_and_primitive(const Point& query, const Point_and_primitive_id& hint);}{Returns a \ccc{Point_and_primitive_id} which realizes the smallest distance between the query point and all input primitives. The internal KD-tree is not used.} - -\end{ccAdvanced} - -\ccSeeAlso - -\ccc{AABBTraits}, \\ -\ccc{AABBPrimitive}. - -\end{ccRefClass} - -% +------------------------------------------------------------------------+ -%%RefPage: end of main body, begin of footer -\ccRefPageEnd -% EOF -% +------------------------------------------------------------------------+ +% +------------------------------------------------------------------------+ +% | Reference manual page: AABB_tree.tex +% +------------------------------------------------------------------------+ +% | 21.02.2009 Author +% | Package: Package +% | +\RCSdef{\RCSAABBtreeRev}{$Id: header.tex 40270 2007-09-07 15:29:10Z lsaboret $} +\RCSdefDate{\RCSAABBtreeDate}{$Date: 2007-09-07 17:29:10 +0200 (Ven, 07 sep 2007) $} +% | +\ccRefPageBegin +%%RefPage: end of header, begin of main body +% +------------------------------------------------------------------------+ + + +\begin{ccRefClass}{AABB_tree} %% add template arg's if necessary + +%% \ccHtmlCrossLink{} %% add further rules for cross referencing links +%% \ccHtmlIndexC[class]{} %% add further index entries + +\ccDefinition + +Class \ccRefName\ is a static data structure for efficient intersection and distance computations in 3D. It builds a hierarchy of axis-aligned bounding boxes (an AABB tree) from a set of 3D geometric objects, and can receive intersection and distance queries, provided that the corresponding predicates are implemented in the traits class \ccc{AT}. The template parameter \ccc{AT} stands for a traits class which must be a model of the concept \ccc{AABBTraits}. + +\ccInclude{CGAL/AABB_tree.h} + +\ccTypes +\ccNestedType{size_type;}{Unsigned integral size type.} +\ccGlue +\ccTypedef{typedef AT::FT FT;}{Number type returned by the distance queries.} +\ccGlue +\ccTypedef{typedef AT::Point_3 Point;}{Type of 3D point.} +\ccGlue +\ccTypedef{typedef AT::Primitive Primitive;}{Type of input primitive.} +\ccGlue +\ccTypedef{typedef AT::Bounding_box Bounding_box;}{Type of bounding box.} +\ccGlue +\ccTypedef{typedef std::pair Point_and_primitive_id;}{} +\ccGlue +\ccTypedef{typedef std::pair Object_and_primitive_id;}{} + +\ccCreation +\ccCreationVariable{tree} + +\ccConstructor{AABB_tree();}{Constructs an empty tree.} +\ccConstructor{template < class InputIterator> + AABB_tree( InputIterator begin, + InputIterator beyond);}{Builds the AABB tree data structure. Type \ccc{InputIterator} can be any const iterator such that \ccc{Primitive} has a constructor taking a \ccc{InputIterator} as argument. The tree stays empty if the memory allocation is not successful.} + +\ccOperations + +\ccMethod{template < class InputIterator> + void rebuild(InputIterator begin, + InputIterator beyond);}{Clears the current tree and rebuilds it from scratch. See constructor above for the parameters. } +\ccGlue +\ccMethod{void clear();}{Clears the AABB tree. } + +\ccGlue +\ccMethod{template + void insert(InputIterator begin, InputIterator beyond);} + {Add a sequence of primitives to the set of primitive of the AABB + tree. Type \ccc{InputIterator} can be any const iterator such that \ccc{Primitive} + has a constructor taking an InputIterator as argument.} +\ccGlue +\ccMethod{void insert(const Primitive p);} + {Add a primitive to the set of primitives of the AABB tree.} + +\begin{ccAdvanced} +\ccMethod{void build();} + {After one or more calls to \ccHtmlNoLinksFrom{\ccc{insert}}, the internal data structure + of \ccRefName\ must be reconstructed. This procedure has a complexity of + \ccc{O(n log(n))}, where n is the number of primitives of the tree. This + procedure is called implicitly at the first call to a query member + function. You can call \ccc{build()} explicitly to ensure that the + next call to query functions will not trigger the reconstruction of the + data structure.} +\end{ccAdvanced} + + +\ccGlue +\ccMethod{Bounding_box bbox() const;}{Returns the axis-aligned bounding box of the whole tree. } +\ccGlue +\ccMethod{size_type size() const;}{Returns the number of primitives in the tree. } +\ccGlue +\ccMethod{bool empty() const;}{Returns \ccc{true}, iff tree contains no primitive. } + +% INTERSECTION TESTS +\ccHeading{Intersection Tests} + +\ccMethod{template + bool do_intersect(const Query& query) const;}{Returns \ccc{true}, iff the query intersects at least one of the input primitives. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} +\ccGlue +\ccMethod{template + size_type number_of_intersected_primitives(const Query& query) const;}{Returns the number of primitives intersected by the query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} +\ccGlue +\ccMethod{template + OutputIterator + all_intersected_primitives(const Query& query, + OutputIterator out) const;}{Outputs to the iterator the list of all intersected primitives ids. This function does not compute the intersection points and is hence faster than the function \ccc{all_intersections} function below. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} +\ccGlue +\ccMethod{template + boost::optional + any_intersected_primitive(const Query& query) const;}{Returns the first encountered intersected primitive id, iff the query intersects at least one of the input primitives. No particular order is guaranteed over the tree traversal, such that, e.g, the primitive returned is not necessarily the closest from the source point of a ray query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates are defined in the \ccc{AT} class.} + + +% INTERSECTIONS +\ccHeading{Intersections} + +\ccMethod{template + OutputIterator + all_intersections(const Query& query, + OutputIterator out) const;}{Outputs to the iterator the list of all intersections between the query and input data, as objects of type \ccc{Object_and_primitive_id}. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates and intersections are defined in the \ccc{AT} class.} +\ccGlue +\ccMethod{template + boost::optional + any_intersection(const Query& query) const;}{Returns the first encountered intersection, iff the query intersects at least one of the input primitives. No particular order is guaranteed over the tree traversal, such that, e.g, the primitive returned is not necessarily the closest from the source point of a ray query. Type \ccc{Query} must be a type for which \ccHtmlNoLinksFrom{\ccc{do_intersect}} predicates and intersections are defined in the \ccc{AT} class.} + + + +% DISTANCE QUERIES +\ccHeading{Distance Queries} + +\ccMethod{FT +squared_distance(const Point& query) const;}{Returns the minimum squared distance between the query point and all input primitives. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} +\ccGlue +\ccMethod{Point +closest_point(const Point& query) const;}{Returns the point in the union of all input primitives which is closest to the query. In case there are several closest points, one arbitrarily chosen closest point is returned. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} +\ccGlue +\ccMethod{Point_and_primitive_id +closest_point_and_primitive(const Point& query) const;}{Returns a \ccc{Point_and_primitive_id} which realizes the smallest distance between the query point and all input primitives. Method \ccc{accelerate_distance_queries} should be called before the first distance query, so that an internal secondary search structure is build, for improving performance.} + +% ACCELERATING THE DISTANCE QUERIES + +\ccHeading{Accelerating the Distance Queries} + +\ccMethod{bool accelerate_distance_queries();}{ Constructs an internal data structure for accelerating distance queries. This method should be called once, before the first distance query. +Returns \ccc{true}, iff the memory allocation is successful.} + +\begin{ccAdvanced} +In the following paragraphs, we discuss details of the implementation of the distance queries. We explain the internal use of hints, how the user can pass his own hints to the tree, and how the user can influence the construction of the secondary data structure used for accelerating distance queries. + +Internally, the distance queries algorithms are initialized with some hint, which has the same type as the return type of the query, and this value is refined along a traversal of the tree, until it is optimal, that is to say until it realizes the shortest distance to the primitives. In particular, the exact specification of these internal algorithms is that they minimize the distance to the object composed of the union of the primitives and the hint. + +It follows that +\begin{itemize} +\item in order to return the exact distance to the set of primitives, the algorithms need the hint to be exactly on the primitives; +\item if this is not the case, and if the hint happens to be closer to the query point than any of the primitives, then the hint is returned. +\end{itemize} +This second observation is reasonable, in the sense that providing a hint to the algorithm means claiming that this hint belongs to the union of the primitives. These considerations about the hints being exactly on the primitives or not are important: in the case where the set of primitives is a triangle soup, and if some of the primitives are large, one may want to provide a much better hint than a vertex of the triangle soup could be. It could be, for example, the barycenter of one of the triangles. But, except with the use of an exact constructions kernel, one cannot easily construct points other than the vertices, that lie exactly on a triangle soup. Hence, providing a good hint sometimes means not being able to provide it exactly on the primitives. In rare occasions, this hint can be returned as the closest point. + +In order to accelerate distance queries significantly, the AABB tree builds an internal KD-tree containing a set of potential hints, when the method \ccc{accelerate_distance_queries} is called. This KD-tree provides very good hints that allow the algorithms to run much faster than with a default hint (such as the \ccc{reference_point} of the first primitive). The set of potential hints is a sampling of the union of the primitives, which is obtained, by default, by calling the method \ccc{reference_point} of each of the primitives. However, such a sampling with one point per primitive may not be the most relevant one: if some primitives are very large, it helps inserting more than one sample on them. Conversely, a sparser sampling with less than one point per input primitive is relevant in some cases. + +For this reason, the user can provide his own set of sample points: + +\ccMethod{template +bool accelerate_distance_queries(InputIterator begin, + InputIterator beyond, + PointAndIdBuilder idb = + PointAndIdBuilder());}{ Constructs an internal KD-tree containing the specified point set, to be used as the set of potential hints for accelerating the distance queries. Iterator \ccc{InputIterator} must be accepted as argument by the operator provided by the \ccc{idb} object: this operator returns a \ccc{Point_and_primitive_id} corresponding to the object the iterator points to.} + +Note that, in some cases, the user is not able to provide ids of the primitives on which the points lie. In these cases, providing a default value for the ids of the hints is possible. Still, the user should be aware that if she uses the \ccc{closest_point_and_primitive} method, there is a (tiny) chance that a hint is returned, along with this default value as corresponding primitive id. Hence, the validity of the returned primitive id should be checked in these cases. + +As an alternative to using the KD-tree, the user can also provide the hints directly, by using the following methods: + +\ccMethod{FT +squared_distance(const Point& query, const Point& hint) const;}{Returns the minimum squared distance between the query point and all input primitives. The internal KD-tree is not used.} + +\ccMethod{Point +closest_point(const Point& query, const Point& hint) const;}{Returns the point in the union of all input primitives which is closest to the query. In case there are several closest points, one arbitrarily chosen closest point is returned. The internal KD-tree is not used.} + +\ccMethod{Point_and_primitive_id +closest_point_and_primitive(const Point& query, const Point_and_primitive_id& hint) const;}{Returns a \ccc{Point_and_primitive_id} which realizes the smallest distance between the query point and all input primitives. The internal KD-tree is not used.} + +\end{ccAdvanced} + +\ccSeeAlso + +\ccc{AABBTraits}, \\ +\ccc{AABBPrimitive}. + +\end{ccRefClass} + +% +------------------------------------------------------------------------+ +%%RefPage: end of main body, begin of footer +\ccRefPageEnd +% EOF +% +------------------------------------------------------------------------+ diff --git a/AABB_tree/examples/AABB_tree/AABB_custom_indexed_triangle_set_array_example.cpp b/AABB_tree/examples/AABB_tree/AABB_custom_indexed_triangle_set_array_example.cpp old mode 100755 new mode 100644 diff --git a/AABB_tree/include/CGAL/AABB_tree.h b/AABB_tree/include/CGAL/AABB_tree.h index 83fa98978ed..95269c99a0b 100644 --- a/AABB_tree/include/CGAL/AABB_tree.h +++ b/AABB_tree/include/CGAL/AABB_tree.h @@ -1,4 +1,4 @@ -// Copyright (c) 2008 INRIA Sophia-Antipolis (France), ETH Zurich (Switzerland). +// Copyright (c) 2008,2011 INRIA Sophia-Antipolis (France), ETH Zurich (Switzerland). // All rights reserved. // // This file is part of CGAL (www.cgal.org); you may redistribute it under @@ -27,6 +27,10 @@ #include #include +#ifdef CGAL_HAS_THREADS +#include +#endif + namespace CGAL { /** @@ -121,12 +125,12 @@ namespace CGAL { // returns true iff successful memory allocation template bool accelerate_distance_queries(ConstPointIterator first, - ConstPointIterator beyond) const; + ConstPointIterator beyond); /// Construct internal search tree from /// a point set taken on the internal primitives // returns true iff successful memory allocation - bool accelerate_distance_queries() const; + bool accelerate_distance_queries(); // intersection tests template @@ -165,7 +169,7 @@ namespace CGAL { } // clears internal KD tree - void clear_search_tree() const + void clear_search_tree() { delete m_p_search_tree; m_p_search_tree = NULL; @@ -212,17 +216,26 @@ namespace CGAL { Primitives m_primitives; // single root node Node* m_p_root_node; - - Node* root_node() const { - if(m_need_build) - const_cast< AABB_tree* >(this)->build(); + #ifdef CGAL_HAS_THREADS + mutable boost::mutex internal_tree_mutex;//mutex used to protect const calls inducing build() + #endif + + const Node* root_node() const { + if(m_need_build){ + #ifdef CGAL_HAS_THREADS + //this ensure that build() will be called once + boost::mutex::scoped_lock scoped_lock(internal_tree_mutex); + if(m_need_build) + #endif + const_cast< AABB_tree* >(this)->build(); + } return m_p_root_node; } // search KD-tree - mutable Search_tree* m_p_search_tree; - mutable bool m_search_tree_constructed; - mutable bool m_default_search_tree_constructed; + const Search_tree* m_p_search_tree; + bool m_search_tree_constructed; + bool m_default_search_tree_constructed; bool m_need_build; private: @@ -329,7 +342,7 @@ namespace CGAL { template template bool AABB_tree::accelerate_distance_queries(ConstPointIterator first, - ConstPointIterator beyond) const + ConstPointIterator beyond) { // clears current KD tree clear_search_tree(); @@ -349,7 +362,7 @@ namespace CGAL { // constructs the search KD tree from internal primitives template - bool AABB_tree::accelerate_distance_queries() const + bool AABB_tree::accelerate_distance_queries() { CGAL_assertion(!m_primitives.empty()); diff --git a/AABB_tree/include/CGAL/internal/AABB_tree/AABB_search_tree.h b/AABB_tree/include/CGAL/internal/AABB_tree/AABB_search_tree.h index 370154f5339..91743d5e5bb 100644 --- a/AABB_tree/include/CGAL/internal/AABB_tree/AABB_search_tree.h +++ b/AABB_tree/include/CGAL/internal/AABB_tree/AABB_search_tree.h @@ -121,8 +121,8 @@ namespace CGAL delete m_p_tree; } - // TOFIX: make it const - Point_and_primitive_id closest_point(const Point& query) + + Point_and_primitive_id closest_point(const Point& query) const { typedef typename Add_decorated_point::Point_3 Decorated_point; Neighbor_search search(*m_p_tree, query, 1); diff --git a/Algebraic_foundations/examples/Algebraic_foundations/fraction_traits.cpp b/Algebraic_foundations/examples/Algebraic_foundations/fraction_traits.cpp index a05c03cee23..3958bc2c7b2 100644 --- a/Algebraic_foundations/examples/Algebraic_foundations/fraction_traits.cpp +++ b/Algebraic_foundations/examples/Algebraic_foundations/fraction_traits.cpp @@ -10,8 +10,8 @@ int main(){ typedef FT::Numerator_type Numerator_type; typedef FT::Denominator_type Denominator_type; - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); Numerator_type numerator; Denominator_type denominator; diff --git a/Algebraic_foundations/examples/Algebraic_foundations/interoperable.cpp b/Algebraic_foundations/examples/Algebraic_foundations/interoperable.cpp index bec92a98776..5967bbf089d 100644 --- a/Algebraic_foundations/examples/Algebraic_foundations/interoperable.cpp +++ b/Algebraic_foundations/examples/Algebraic_foundations/interoperable.cpp @@ -10,7 +10,7 @@ binary_func(const A& a , const B& b){ typedef CGAL::Coercion_traits CT; // check for explicit interoperability - BOOST_STATIC_ASSERT((CT::Are_explicit_interoperable::value)); + CGAL_static_assertion((CT::Are_explicit_interoperable::value)); // CT::Cast is used to to convert both types into the coercion type typename CT::Cast cast; diff --git a/Algebraic_foundations/include/CGAL/Algebraic_structure_traits.h b/Algebraic_foundations/include/CGAL/Algebraic_structure_traits.h index 875bfc63004..804aeefb0a9 100644 --- a/Algebraic_foundations/include/CGAL/Algebraic_structure_traits.h +++ b/Algebraic_foundations/include/CGAL/Algebraic_structure_traits.h @@ -355,7 +355,7 @@ class Algebraic_structure_traits_base< Type_, Type& r ) const { typedef Coercion_traits< NT1, NT2 > CT; typedef typename CT::Type Type; - BOOST_STATIC_ASSERT(( + CGAL_static_assertion(( ::boost::is_same::value)); typename Coercion_traits< NT1, NT2 >::Cast cast; diff --git a/Algebraic_foundations/include/CGAL/Coercion_traits.h b/Algebraic_foundations/include/CGAL/Coercion_traits.h index e7b17217a65..6a8ee091f53 100644 --- a/Algebraic_foundations/include/CGAL/Coercion_traits.h +++ b/Algebraic_foundations/include/CGAL/Coercion_traits.h @@ -43,7 +43,7 @@ #define CGAL_IMPLICIT_INTEROPERABLE_BINARY_OPERATOR_WITH_RT( NT, Result_type ) \ template < class CT_Type_1, class CT_Type_2 > \ Result_type operator()( const CT_Type_1& x, const CT_Type_2& y ) const { \ - BOOST_STATIC_ASSERT((::boost::is_same< \ + CGAL_static_assertion((::boost::is_same< \ typename Coercion_traits< CT_Type_1, CT_Type_2 >::Type, NT \ >::value)); \ \ diff --git a/Algebraic_foundations/include/CGAL/Scalar_factor_traits.h b/Algebraic_foundations/include/CGAL/Scalar_factor_traits.h index 105dc498953..f59315ccb4d 100644 --- a/Algebraic_foundations/include/CGAL/Scalar_factor_traits.h +++ b/Algebraic_foundations/include/CGAL/Scalar_factor_traits.h @@ -92,13 +92,13 @@ public: // determine extractable scalar factor Scalar operator () (const NT& a) { - BOOST_STATIC_ASSERT(( ::boost::is_same< NT,Scalar >::value)); + CGAL_static_assertion(( ::boost::is_same< NT,Scalar >::value)); typedef typename Algebraic_structure_traits::Algebraic_category SAT; return scalar_factor(a, SAT()); } // determine extractable scalar factor Scalar operator () (const NT& a, const Scalar& d) { - BOOST_STATIC_ASSERT(( ::boost::is_same< NT,Scalar >::value)); + CGAL_static_assertion(( ::boost::is_same< NT,Scalar >::value)); typedef typename Algebraic_structure_traits::Algebraic_category SAT; return scalar_factor(a,d,SAT()); } diff --git a/Algebraic_foundations/include/CGAL/Test/_test_algebraic_structure.h b/Algebraic_foundations/include/CGAL/Test/_test_algebraic_structure.h index 3ac283bdd34..69de72f17d8 100644 --- a/Algebraic_foundations/include/CGAL/Test/_test_algebraic_structure.h +++ b/Algebraic_foundations/include/CGAL/Test/_test_algebraic_structure.h @@ -31,7 +31,7 @@ #include //#include -#include +#include #include #include #include @@ -48,7 +48,7 @@ template void check_result_type(AdaptableFunctor, ResultType){ typedef typename AdaptableFunctor::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); } // check nothing for CGAL::Null_functor template @@ -110,12 +110,12 @@ void test_algebraic_structure_intern( const CGAL::Integral_domain_tag& ) { CGAL_SNAP_AST_FUNCTORS(AST); using CGAL::Null_functor; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (!::boost::is_same< Integral_division, Null_functor >::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Divides, Null_functor >::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Is_zero, Null_functor >::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Is_one, Null_functor >::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Square, Null_functor >::value)); + CGAL_static_assertion((!::boost::is_same< Divides, Null_functor >::value)); + CGAL_static_assertion((!::boost::is_same< Is_zero, Null_functor >::value)); + CGAL_static_assertion((!::boost::is_same< Is_one, Null_functor >::value)); + CGAL_static_assertion((!::boost::is_same< Square, Null_functor >::value)); // functor const Is_zero is_zero = Is_zero(); @@ -194,7 +194,7 @@ void test_algebraic_structure_intern( CGAL_SNAP_AST_FUNCTORS(AST); using CGAL::Null_functor; - BOOST_STATIC_ASSERT((!::boost::is_same< Gcd, Null_functor>::value)); + CGAL_static_assertion((!::boost::is_same< Gcd, Null_functor>::value)); const Gcd gcd = Gcd(); assert( gcd( AS ( 0), AS ( 0)) == unit_normal( AS (0) ) ); @@ -256,9 +256,9 @@ void test_algebraic_structure_intern( const CGAL::Euclidean_ring_tag&) { CGAL_SNAP_AST_FUNCTORS(AST); using CGAL::Null_functor; - BOOST_STATIC_ASSERT((!::boost::is_same< Div, Null_functor>::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Mod, Null_functor>::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Div_mod, Null_functor>::value)); + CGAL_static_assertion((!::boost::is_same< Div, Null_functor>::value)); + CGAL_static_assertion((!::boost::is_same< Mod, Null_functor>::value)); + CGAL_static_assertion((!::boost::is_same< Div_mod, Null_functor>::value)); const Div div=Div(); const Mod mod=Mod(); @@ -374,7 +374,7 @@ void test_algebraic_structure_intern( const CGAL::Field_with_sqrt_tag& ) { CGAL_SNAP_AST_FUNCTORS(AST); - BOOST_STATIC_ASSERT((!::boost::is_same< Sqrt, Null_functor>::value)); + CGAL_static_assertion((!::boost::is_same< Sqrt, Null_functor>::value)); const Sqrt sqrt =Sqrt(); AS a(4); @@ -597,11 +597,11 @@ class Test_is_square { typedef typename Is_square::first_argument_type First_argument_type; typedef typename Is_square::second_argument_type Second_argument_type; typedef typename Is_square::result_type Result_type; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( ::boost::is_same< AS , First_argument_type>::value)); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( ::boost::is_same< AS& , Second_argument_type>::value)); - //BOOST_STATIC_ASSERT(( ::boost::is_same< bool , Result_type>::value)); + //CGAL_static_assertion(( ::boost::is_same< bool , Result_type>::value)); bool b = Result_type(true); CGAL_USE(b); AS test_number = AS(3)*AS(3); @@ -630,8 +630,8 @@ public: void operator() (const Sqrt& sqrt) { typedef typename Sqrt::argument_type Argument_type; typedef typename Sqrt::result_type Result_type; - BOOST_STATIC_ASSERT(( ::boost::is_same< AS , Argument_type>::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same< AS , Result_type>::value)); + CGAL_static_assertion(( ::boost::is_same< AS , Argument_type>::value)); + CGAL_static_assertion(( ::boost::is_same< AS , Result_type>::value)); typedef Algebraic_structure_traits AST; typedef typename AST::Is_exact Is_exact; assert( !Is_exact::value || AS (3) == sqrt( AS (9))); @@ -653,11 +653,11 @@ public: typedef typename Root::first_argument_type First_argument_type; typedef typename Root::second_argument_type Second_argument_type; typedef typename Root::result_type Result_type; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( ::boost::is_same::value)); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( ::boost::is_same< AS , Second_argument_type>::value)); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( ::boost::is_same< AS , Result_type>::value)); AS epsilon(1); assert( test_equality_epsilon( AS (2), @@ -781,7 +781,7 @@ void test_algebraic_structure(){ typedef CGAL::Algebraic_structure_traits< AS > AST; CGAL_SNAP_AST_FUNCTORS(AST); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef typename AST::Boolean Boolean; assert(!Boolean()); @@ -794,14 +794,14 @@ void test_algebraic_structure(){ using CGAL::Integral_domain_without_division_tag; using CGAL::Null_functor; // Test for desired exactness - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( ::boost::is_same< typename AST::Is_exact, Is_exact >::value)); - BOOST_STATIC_ASSERT(( ::boost::is_convertible< Tag, + CGAL_static_assertion(( ::boost::is_convertible< Tag, Integral_domain_without_division_tag >::value )); - BOOST_STATIC_ASSERT(( ::boost::is_same< Tag, Algebraic_category>::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Simplify, Null_functor>::value)); - BOOST_STATIC_ASSERT((!::boost::is_same< Unit_part, Null_functor>::value)); + CGAL_static_assertion(( ::boost::is_same< Tag, Algebraic_category>::value)); + CGAL_static_assertion((!::boost::is_same< Simplify, Null_functor>::value)); + CGAL_static_assertion((!::boost::is_same< Unit_part, Null_functor>::value)); const Simplify simplify=Simplify();; const Unit_part unit_part= Unit_part(); @@ -919,7 +919,7 @@ void test_algebraic_structure( const AS & a, const AS & b, const AS & c) { typedef CGAL::Algebraic_structure_traits AST; typedef typename AST::Is_numerical_sensitive Is_numerical_sensitive; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( !(::boost::is_same::value)); } diff --git a/Algebraic_foundations/include/CGAL/Test/_test_coercion_traits.h b/Algebraic_foundations/include/CGAL/Test/_test_coercion_traits.h index a1d9e65719f..eb75d48dbc2 100644 --- a/Algebraic_foundations/include/CGAL/Test/_test_coercion_traits.h +++ b/Algebraic_foundations/include/CGAL/Test/_test_coercion_traits.h @@ -329,7 +329,7 @@ void test_implicit_interoperable_one_way() { typedef typename CT::Type C; typedef typename CT::Are_implicit_interoperable Are_implicit_interoperable; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (::boost::is_same::value)); assert((::boost::is_same::value)); @@ -349,9 +349,9 @@ void test_explicit_interoperable_one_way(){ typedef typename CT::Cast Cast; typedef typename Cast::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); + CGAL_static_assertion((::boost::is_same::value)); typename CT::Cast cast; A a(3); diff --git a/Algebraic_foundations/include/CGAL/Test/_test_fraction_traits.h b/Algebraic_foundations/include/CGAL/Test/_test_fraction_traits.h index 9e7e63d0025..22d11d8da5e 100644 --- a/Algebraic_foundations/include/CGAL/Test/_test_fraction_traits.h +++ b/Algebraic_foundations/include/CGAL/Test/_test_fraction_traits.h @@ -44,11 +44,11 @@ void test_fraction_traits(){ typedef typename FT::Decompose Decompose; typedef typename FT::Compose Compose; - BOOST_STATIC_ASSERT( (::boost::is_same::value)); - BOOST_STATIC_ASSERT( (::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); + CGAL_static_assertion( (::boost::is_same::value)); + CGAL_static_assertion( (::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); // Decompose diff --git a/Algebraic_foundations/include/CGAL/Test/_test_rational_traits.h b/Algebraic_foundations/include/CGAL/Test/_test_rational_traits.h index c7451b9dd96..a02703146d0 100644 --- a/Algebraic_foundations/include/CGAL/Test/_test_rational_traits.h +++ b/Algebraic_foundations/include/CGAL/Test/_test_rational_traits.h @@ -38,7 +38,7 @@ void test_rational_traits(){ typedef Rational_traits Rational_traits; typedef typename Rational_traits::RT RT; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); assert( Rational_traits().numerator(x) == RT(7)); assert( Rational_traits().denominator(x) == RT(2)); diff --git a/Algebraic_foundations/include/CGAL/Test/_test_real_embeddable.h b/Algebraic_foundations/include/CGAL/Test/_test_real_embeddable.h index 4daa960d50a..6cc9a5854e0 100644 --- a/Algebraic_foundations/include/CGAL/Test/_test_real_embeddable.h +++ b/Algebraic_foundations/include/CGAL/Test/_test_real_embeddable.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -58,8 +58,8 @@ namespace CGAL { void operator() (const ToDouble& to_double) { typedef typename ToDouble::argument_type Argument_type; typedef typename ToDouble::result_type Result_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); assert(42.0 == to_double(Type(42))); } }; @@ -79,8 +79,8 @@ namespace CGAL { typedef typename To_interval::argument_type Argument_type; typedef typename To_interval::result_type Result_type; typedef std::pair Interval_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); // assert(NiX::in(42.0,to_Interval(Type(42)))); // Instead of 'NiX::in': @@ -145,7 +145,7 @@ void test_real_embeddable() { CGAL_SNAP_RET_FUNCTORS(RET); typedef typename RET::Is_real_embeddable Is_real_embeddable; using CGAL::Tag_true; - BOOST_STATIC_ASSERT(( ::boost::is_same< Is_real_embeddable, Tag_true>::value)); + CGAL_static_assertion(( ::boost::is_same< Is_real_embeddable, Tag_true>::value)); typedef typename RET::Boolean Boolean; typedef typename RET::Sign Sign; @@ -251,20 +251,20 @@ void test_not_real_embeddable() { typedef CGAL::Real_embeddable_traits RET; typedef typename RET::Is_real_embeddable Is_real_embeddable; using CGAL::Tag_false; - BOOST_STATIC_ASSERT(( ::boost::is_same< Is_real_embeddable, Tag_false>::value)); + CGAL_static_assertion(( ::boost::is_same< Is_real_embeddable, Tag_false>::value)); } //template //void test_rounded_log2_abs(Type zero, CGAL::Null_functor, CeilLog2Abs) { // typedef CGAL::Null_functor Null_functor; -// BOOST_STATIC_ASSERT(( ::boost::is_same< CeilLog2Abs, Null_functor>::value)); +// CGAL_static_assertion(( ::boost::is_same< CeilLog2Abs, Null_functor>::value)); //} // //template //void test_rounded_log2_abs(Type zero, FloorLog2Abs fl_log, CeilLog2Abs cl_log) { // typedef CGAL::Null_functor Null_functor; -// BOOST_STATIC_ASSERT((!::boost::is_same< CeilLog2Abs, Null_functor>::value)); +// CGAL_static_assertion((!::boost::is_same< CeilLog2Abs, Null_functor>::value)); // // assert( fl_log(Type( 7)) == 2 ); // assert( cl_log(Type( 7)) == 3 ); diff --git a/Algebraic_foundations/test/Algebraic_foundations/Algebraic_extension_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Algebraic_extension_traits.cpp index 9ac4edc9d3e..ca89fa93700 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Algebraic_extension_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Algebraic_extension_traits.cpp @@ -8,27 +8,27 @@ int main(){ typedef CGAL::Algebraic_extension_traits AET; typedef AET::Type Type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef AET::Is_extended Is_extended; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (::boost::is_same::value)); typedef AET::Normalization_factor Normalization_factor; { typedef Normalization_factor::argument_type argument_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef Normalization_factor::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); Normalization_factor nfac; assert(nfac(3)==1); } typedef AET::Denominator_for_algebraic_integers DFAI; { typedef DFAI::argument_type argument_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef DFAI::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); DFAI dfai; assert(dfai(3)==1); } @@ -38,18 +38,18 @@ int main(){ typedef CGAL::Algebraic_extension_traits AET; typedef AET::Type Type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef AET::Is_extended Is_extended; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (::boost::is_same::value)); typedef AET::Normalization_factor Normalization_factor; { typedef Normalization_factor::argument_type argument_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef Normalization_factor::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); Normalization_factor nfac; assert(nfac(EXT(3))==1); assert(nfac(EXT(3,0,5))==1); @@ -58,9 +58,9 @@ int main(){ typedef AET::Denominator_for_algebraic_integers DFAI; { typedef DFAI::argument_type argument_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef DFAI::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); DFAI dfai; assert(dfai(EXT(3))==1); assert(dfai(EXT(3,0,5))==1); diff --git a/Algebraic_foundations/test/Algebraic_foundations/Algebraic_structure_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Algebraic_structure_traits.cpp index 7c1f3f8cbae..6c3722c4f81 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Algebraic_structure_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Algebraic_structure_traits.cpp @@ -6,7 +6,7 @@ #define CGAL_IS_AST_NULL_FUNCTOR(NAME) \ { \ typedef AST::NAME NAME; \ - BOOST_STATIC_ASSERT( \ + CGAL_static_assertion( \ (::boost::is_same::value)); \ } @@ -14,16 +14,16 @@ int main(){ typedef CGAL::Algebraic_structure_traits AST; typedef AST::Type Type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef AST::Algebraic_category Algebraic_category; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (::boost::is_same::value)); typedef AST::Is_exact Is_exact; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef AST::Is_numerical_sensitive Is_sensitive; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); CGAL_IS_AST_NULL_FUNCTOR ( Simplify); CGAL_IS_AST_NULL_FUNCTOR ( Unit_part); diff --git a/Algebraic_foundations/test/Algebraic_foundations/Coercion_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Coercion_traits.cpp index fe1b943969a..cd462d85753 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Coercion_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Coercion_traits.cpp @@ -4,21 +4,21 @@ int main(){ { typedef CGAL::Coercion_traits CT; - BOOST_STATIC_ASSERT(( boost::is_same::value)); - BOOST_STATIC_ASSERT( + CGAL_static_assertion(( boost::is_same::value)); + CGAL_static_assertion( ( boost::is_same::value)); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( boost::is_same::value)); assert( 5 == CT::Cast()(5)); } { typedef CGAL::Coercion_traits CT; -// BOOST_STATIC_ASSERT(( boost::is_same::value)); - BOOST_STATIC_ASSERT( +// CGAL_static_assertion(( boost::is_same::value)); + CGAL_static_assertion( ( boost::is_same::value)); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( boost::is_same::value)); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( boost::is_same::value)); } } diff --git a/Algebraic_foundations/test/Algebraic_foundations/Real_embeddable_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Real_embeddable_traits.cpp index 30ef04c7de8..60edf2c2a8d 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Real_embeddable_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Real_embeddable_traits.cpp @@ -6,7 +6,7 @@ #define CGAL_IS_RET_NULL_FUNCTOR(NAME) \ { \ typedef RET::NAME NAME; \ - BOOST_STATIC_ASSERT( \ + CGAL_static_assertion( \ (::boost::is_same::value)); \ } @@ -14,10 +14,10 @@ int main(){ typedef CGAL::Real_embeddable_traits RET; typedef RET::Type Type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef RET::Is_real_embeddable Is_real_embeddable; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); CGAL_IS_RET_NULL_FUNCTOR(Abs); CGAL_IS_RET_NULL_FUNCTOR(Sgn); diff --git a/Algebraic_foundations/test/Algebraic_foundations/Scalar_factor_traits.cpp b/Algebraic_foundations/test/Algebraic_foundations/Scalar_factor_traits.cpp index c6bac8b1703..7a0f03fb503 100644 --- a/Algebraic_foundations/test/Algebraic_foundations/Scalar_factor_traits.cpp +++ b/Algebraic_foundations/test/Algebraic_foundations/Scalar_factor_traits.cpp @@ -6,27 +6,27 @@ int main(){ typedef CGAL::Scalar_factor_traits SFT; - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef SFT::Scalar_factor Scalar_factor; { typedef Scalar_factor::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef Scalar_factor::argument_type argument_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); } typedef SFT::Scalar_div Scalar_div; { typedef Scalar_div::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef Scalar_div::first_argument_type first_argument_type; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (::boost::is_same::value)); typedef Scalar_div::second_argument_type second_argument_type; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (::boost::is_same::value)); } diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h index b7dba1a05e4..a21eb739874 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_curve_kernel_2.h @@ -33,7 +33,7 @@ #include -#include +#include #include #include @@ -562,16 +562,16 @@ public: Curve_analysis_2 _construct_defining_polynomial_from(Bound b) const { typedef CGAL::Fraction_traits FT; // We rely on the fact that the Bound is a fraction - BOOST_STATIC_ASSERT((::boost::is_same::value)); typedef typename FT::Numerator_type Numerator; typedef typename FT::Denominator_type Denominator; typedef CGAL::Coercion_traits Num_coercion; - BOOST_STATIC_ASSERT((::boost::is_same + CGAL_static_assertion((::boost::is_same ::value)); typedef CGAL::Coercion_traits Denom_coercion; - BOOST_STATIC_ASSERT((::boost::is_same + CGAL_static_assertion((::boost::is_same ::value)); typename Num_coercion::Cast num_cast; @@ -2649,16 +2649,16 @@ public: Polynomial_1 operator() (const Polynomial_2& f, Bound b) const { typedef CGAL::Fraction_traits FT; // We rely on the fact that the Bound is a fraction - BOOST_STATIC_ASSERT((::boost::is_same::value)); typedef typename FT::Numerator_type Numerator; typedef typename FT::Denominator_type Denominator; typedef CGAL::Coercion_traits Num_coercion; - BOOST_STATIC_ASSERT((::boost::is_same + CGAL_static_assertion((::boost::is_same ::value)); typedef CGAL::Coercion_traits Denom_coercion; - BOOST_STATIC_ASSERT((::boost::is_same + CGAL_static_assertion((::boost::is_same ::value)); typename Num_coercion::Cast num_cast; diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h index f466c7c9f0b..dd9acd7a37b 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/Algebraic_real_d_1.h @@ -78,7 +78,7 @@ class Algebraic_real_d_1 : public ::CGAL::Handle_with_policy< AlgebraicRealRep_d_1, HandlePolicy > { // currently Rational is the only supported Bound type. - BOOST_STATIC_ASSERT( + CGAL_static_assertion( ( ::boost::is_same ::Arithmetic_kernel::Rational>::value)); diff --git a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h index 48a5d74f8e2..45988ddb0bd 100644 --- a/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h +++ b/Algebraic_kernel_d/include/CGAL/Algebraic_kernel_d/algebraic_curve_kernel_2_tools.h @@ -195,7 +195,7 @@ template::value_type >::value)); @@ -237,12 +237,12 @@ template typedef typename CGAL::Polynomial_traits_d::Coefficient_type Coefficient; typedef CGAL::Fraction_traits FT; - BOOST_STATIC_ASSERT((::boost::is_same::value)); typedef typename FT::Numerator_type Numerator; typedef typename FT::Denominator_type Denominator; typedef CGAL::Coercion_traits Num_coercion; - BOOST_STATIC_ASSERT((::boost::is_same + CGAL_static_assertion((::boost::is_same ::value)); Numerator p_num; diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/Real_embeddable_traits_extension.cpp b/Algebraic_kernel_d/test/Algebraic_kernel_d/Real_embeddable_traits_extension.cpp index 47a457966cd..b3b1d2ac858 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/Real_embeddable_traits_extension.cpp +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/Real_embeddable_traits_extension.cpp @@ -53,8 +53,8 @@ void test_real_embeddable_extension(const NT_&){ const Floor floor = Floor(); typedef typename Floor::argument_type Argument_type; typedef typename Floor::result_type Result_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); assert(Integer(42) == floor(NT(42))); assert(Integer(-42) == floor(NT(-42))); } @@ -63,8 +63,8 @@ void test_real_embeddable_extension(const NT_&){ const Floor_log2_abs floor_log2_abs = Floor_log2_abs(); typedef typename Floor_log2_abs::argument_type Argument_type; typedef typename Floor_log2_abs::result_type Result_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); assert(long(0) == floor_log2_abs(NT(1))); assert(long(0) == floor_log2_abs(NT(-1))); @@ -88,8 +88,8 @@ void test_real_embeddable_extension(const NT_&){ const Ceil ceil = Ceil(); typedef typename Ceil::argument_type Argument_type; typedef typename Ceil::result_type Result_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); assert(Integer(42) == ceil(NT(42))); assert(Integer(-42) == ceil(NT(-42))); } @@ -98,8 +98,8 @@ void test_real_embeddable_extension(const NT_&){ const Ceil_log2_abs ceil_log2_abs = Ceil_log2_abs(); typedef typename Ceil_log2_abs::argument_type Argument_type; typedef typename Ceil_log2_abs::result_type Result_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); assert(long(0) == ceil_log2_abs(NT(1))); assert(long(0) == ceil_log2_abs(NT(-1))); diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_curve_kernel_2.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_curve_kernel_2.h index 68deb364363..5f075d6dec5 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_curve_kernel_2.h +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_curve_kernel_2.h @@ -69,18 +69,18 @@ void test_algebraic_curve_kernel_2() { typedef AlgebraicCurveKernel_2 AK_2; - /* BOOST_STATIC_ASSERT( (::boost::is_same< + /* CGAL_static_assertion( (::boost::is_same< Algebraic_real_1, typename AK::Algebraic_real_1 >::value) ); - BOOST_STATIC_ASSERT((::boost::is_same< + CGAL_static_assertion((::boost::is_same< Isolator, typename AK::Isolator >::value) ); - BOOST_STATIC_ASSERT((::boost::is_same< + CGAL_static_assertion((::boost::is_same< Coefficient, typename AK::Coefficient >::value)); - BOOST_STATIC_ASSERT((::boost::is_same< + CGAL_static_assertion((::boost::is_same< Polynomial_1, typename AK::Polynomial_1 >::value));*/ diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h index c12f6f76e01..f6472fc433a 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_1.h @@ -112,17 +112,17 @@ void test_algebraic_kernel_1(const AlgebraicKernel_d_1& ak_1){ { \ typedef typename Name::argument_type AT_; \ typedef typename Name::result_type RT_; \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ } #define CGAL_CHECK_BFUNCTION(Name,AT1,AT2,RT) \ { \ typedef typename Name::first_argument_type AT1_; \ typedef typename Name::second_argument_type AT2_; \ typedef typename Name::result_type RT_; \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ } // TODO: missing check for Construct_algebraic_real_1 diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_2.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_2.h index 6cf8d6ad735..08fb2f85c56 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_2.h +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_algebraic_kernel_2.h @@ -101,21 +101,21 @@ void test_algebraic_kernel_2(const AlgebraicKernel_2& ak_2) { { \ typedef typename Name::argument_type AT_; \ typedef typename Name::result_type RT_; \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ } #define CGAL_CHECK_BFUNCTION(Name,AT1,AT2,RT) \ { \ typedef typename Name::first_argument_type AT1_; \ typedef typename Name::second_argument_type AT2_; \ typedef typename Name::result_type RT_; \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ - {BOOST_STATIC_ASSERT(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ + {CGAL_static_assertion(( ::boost::is_same::value));} \ } - BOOST_STATIC_ASSERT(( ::boost::is_same + CGAL_static_assertion(( ::boost::is_same ::value)); @@ -123,7 +123,7 @@ void test_algebraic_kernel_2(const AlgebraicKernel_2& ak_2) { CGAL_CHECK_UFUNCTION(Make_square_free_2,Polynomial_2,Polynomial_2); // TODO: missing check for Square_free_factorize_2 CGAL_CHECK_BFUNCTION(Is_coprime_2,Polynomial_2,Polynomial_2,bool); - BOOST_STATIC_ASSERT(( ::boost::is_same + CGAL_static_assertion(( ::boost::is_same ::value)); CGAL_CHECK_BFUNCTION(Number_of_solutions_2,Polynomial_2,Polynomial_2, size_type); @@ -133,7 +133,7 @@ void test_algebraic_kernel_2(const AlgebraicKernel_2& ak_2) { CGAL_CHECK_UFUNCTION(Compute_polynomial_y_2,Algebraic_real_2,Polynomial_1); CGAL_CHECK_BFUNCTION(Isolate_x_2,Algebraic_real_2,Polynomial_1,BInterval); CGAL_CHECK_BFUNCTION(Isolate_y_2,Algebraic_real_2,Polynomial_1,BInterval); - BOOST_STATIC_ASSERT(( ::boost::is_same + CGAL_static_assertion(( ::boost::is_same < BArray,typename Isolate_2::result_type>::value)); CGAL_CHECK_BFUNCTION(Sign_at_2,Polynomial_2,Algebraic_real_2,Sign); CGAL_CHECK_BFUNCTION(Is_zero_at_2,Polynomial_2,Algebraic_real_2,bool); diff --git a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_comparable.h b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_comparable.h index ca1a15b7310..7b1f23a5058 100644 --- a/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_comparable.h +++ b/Algebraic_kernel_d/test/Algebraic_kernel_d/include/CGAL/_test_real_comparable.h @@ -38,7 +38,7 @@ #include #include */ #include -#include +#include #include @@ -52,8 +52,8 @@ namespace internal { void operator() (ToDouble to_double) { typedef typename ToDouble::argument_type Argument_type; typedef typename ToDouble::result_type Result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); assert(42.0 == to_double(NT(42))); } }; @@ -72,8 +72,8 @@ namespace internal { void operator() (ToInterval to_Interval) { typedef typename ToInterval::argument_type Argument_type; typedef typename ToInterval::result_type Result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same< typename Argument_type::Interval, Result_type>::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same< typename Argument_type::Interval, Result_type>::value)); // TODO: NiX::in not available!? //assert(NiX::in(42.0,to_Interval(NT(42)))); @@ -112,7 +112,7 @@ void test_real_comparable() { typedef CGAL::Real_embeddable_traits Traits; typedef typename Traits::Is_real_embeddable Is_real_comparable; using ::CGAL::Tag_true; - BOOST_STATIC_ASSERT((::boost::is_same< Is_real_comparable, Tag_true>::value)); + CGAL_static_assertion((::boost::is_same< Is_real_comparable, Tag_true>::value)); typename Traits::Compare compare; typename Traits::Sign sign; typename Traits::Abs abs; @@ -181,20 +181,20 @@ void test_not_real_comparable() { typedef CGAL::Real_embeddable_traits Traits; typedef typename Traits::Is_real_embeddable Is_real_comparable; using ::CGAL::Tag_false; - BOOST_STATIC_ASSERT((::boost::is_same< Is_real_comparable, Tag_false>::value)); + CGAL_static_assertion((::boost::is_same< Is_real_comparable, Tag_false>::value)); } template void test_rounded_log2_abs(NT zero, ::CGAL::Null_functor, CeilLog2Abs) { typedef ::CGAL::Null_functor Nulltype; - BOOST_STATIC_ASSERT((::boost::is_same< CeilLog2Abs, Nulltype>::value)); + CGAL_static_assertion((::boost::is_same< CeilLog2Abs, Nulltype>::value)); } template void test_rounded_log2_abs(NT zero, FloorLog2Abs fl_log, CeilLog2Abs cl_log) { typedef ::CGAL::Null_functor Null_functor; - BOOST_STATIC_ASSERT((!::boost::is_same< CeilLog2Abs, Null_functor>::value)); + CGAL_static_assertion((!::boost::is_same< CeilLog2Abs, Null_functor>::value)); assert( fl_log(NT( 7)) == 2 ); assert( cl_log(NT( 7)) == 3 ); diff --git a/Alpha_shapes_2/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp b/Alpha_shapes_2/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp index aca832be0d6..b185f4e6084 100644 --- a/Alpha_shapes_2/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp +++ b/Alpha_shapes_2/examples/Alpha_shapes_2/ex_alpha_shapes_2.cpp @@ -79,7 +79,7 @@ file_input(OutputIterator out) int n; is >> n; std::cout << "Reading " << n << " points from file" << std::endl; - CGAL::copy_n(std::istream_iterator(is), n, out); + CGAL::cpp0x::copy_n(std::istream_iterator(is), n, out); return true; } diff --git a/Alpha_shapes_2/test/Alpha_shapes_2/test_alpha.cpp b/Alpha_shapes_2/test/Alpha_shapes_2/test_alpha.cpp index 7d5d2d32d71..f72f9a98d30 100644 --- a/Alpha_shapes_2/test/Alpha_shapes_2/test_alpha.cpp +++ b/Alpha_shapes_2/test/Alpha_shapes_2/test_alpha.cpp @@ -89,7 +89,7 @@ file_input(OutputIterator out) int n; is >> n; std::cout << "Reading " << n << " points from file" << std::endl; - CGAL::copy_n(std::istream_iterator(is), n, out); + CGAL::cpp0x::copy_n(std::istream_iterator(is), n, out); return true; } diff --git a/Arithmetic_kernel/test/Arithmetic_kernel/Get_arithmetic_kernel.cpp b/Arithmetic_kernel/test/Arithmetic_kernel/Get_arithmetic_kernel.cpp index e92a1e3c7c7..74cdc7d5505 100644 --- a/Arithmetic_kernel/test/Arithmetic_kernel/Get_arithmetic_kernel.cpp +++ b/Arithmetic_kernel/test/Arithmetic_kernel/Get_arithmetic_kernel.cpp @@ -16,15 +16,15 @@ int main() { typedef AK::Bigfloat_interval BFI; { typedef CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); } { typedef CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); } { typedef CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); } return 0; } diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_Bezier_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_Bezier_traits.tex index 4ac3e0c109d..b385c0d4c9a 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_Bezier_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_Bezier_traits.tex @@ -52,11 +52,18 @@ parameter, with \ccc{Cartesian} and respectively. The number types in this case are provided by the {\sc Core} library, with its ability to exactly represent simple algebraic numbers. +While \ccRefName{} models the concept +\ccc{ArrangementDirectionalXMonotoneTraits_2}, the implementation of +the \ccc{Arr_mergeable_2} operation does not enforce the input curves +to have the same direction as a precondition. Moreover, \ccRefName{} +supports the merging of curves of opposite directions. + \ccInclude{CGAL/Arr_Bezier_curve_traits_2.h} \ccIsModel - \ccc{ArrangementTraits_2} - + \ccc{ArrangementTraits_2}\\ + \ccc{ArrangementDirectionalXMonotoneTraits_2} + \ccTypes %------- diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_circle_segment_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_circle_segment_traits.tex index 5039dc482c0..9e7b559787b 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_circle_segment_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_circle_segment_traits.tex @@ -37,11 +37,17 @@ enables efficient comparison among different extensions. For more details see the documentation of \ccRefIdfierPage{CGAL::Sqrt_extension}\\ +While \ccRefName{} models the concept +\ccc{ArrangementDirectionalXMonotoneTraits_2}, the implementation of +the \ccc{Arr_mergeable_2} operation does not enforce the input curves +to have the same direction as a precondition. Moreover, \ccRefName{} +supports the merging of curves of opposite directions. \ccInclude{CGAL/Arr_circle_segment_traits_2.h} \ccIsModel - \ccc{ArrangementTraits_2} + \ccc{ArrangementTraits_2}\\ + \ccc{ArrangementDirectionalXMonotoneTraits_2} \subsection*{Class Arr\_circle\_segment\_traits\_2$<$Kernel$>$::Point\_2} diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_conic_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_conic_traits.tex index bda7e8478c6..e36ec04eeb0 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_conic_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_conic_traits.tex @@ -75,11 +75,18 @@ ability to exactly represent simple algebraic numbers. The traits class inherits its point type from \ccc{AlgKernel::Point_2}, and defines a curve and $x$-monotone curve types, as detailed below. +While the \ccRefName{} models the concept +\ccc{ArrangementDirectionalXMonotoneTraits_2}, the implementation of +the \ccc{Arr_mergeable_2} operation does not enforce the input curves +to have the same direction as a precondition. Moreover, \ccRefName{} +supports the merging of curves of opposite directions. + \ccInclude{CGAL/Arr_conic_traits_2.h} \ccIsModel - \ccc{ArrangementTraits_2} \\ - \ccc{ArrangementLandmarkTraits_2} \\ + \ccc{ArrangementTraits_2}\\ + \ccc{ArrangementLandmarkTraits_2}\\ + \ccc{ArrangementDirectionalXMonotoneTraits_2} \ccTypes %------- diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_non_caching_segment_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_non_caching_segment_traits.tex index 93bfc5a52bf..85773de4cad 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_non_caching_segment_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_non_caching_segment_traits.tex @@ -33,12 +33,19 @@ The \ccStyle{Arr_segment_traits_2} traits class avoids this cascading problem, and should be the default choice for implementing arrangements of line segments. It is recommended to use \ccRefName\ only for very sparse arrangements of huge sets of input segments. - + +While \ccRefName{} models the concept +\ccc{ArrangementDirectionalXMonotoneTraits_2}, the implementation of +the \ccc{Arr_mergeable_2} operation does not enforce the input curves +to have the same direction as a precondition. Moreover, \ccRefName{} +supports the merging of curves of opposite directions. + \ccInclude{CGAL/Arr_non_caching_segment_traits_2.h} \ccIsModel - \ccc{ArrangementTraits_2} \\ - \ccc{ArrangementLandmarkTraits_2} \\ + \ccc{ArrangementTraits_2}\\ + \ccc{ArrangementLandmarkTraits_2}\\ + \ccc{ArrangementDirectionalXMonotoneTraits_2} \ccInheritsFrom \ccc{Arr_non_caching_segment_basic_traits_2} diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_rational_function_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_rational_function_traits.tex index 6be3a3e60ca..0b4ec12395a 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_rational_function_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_rational_function_traits.tex @@ -72,6 +72,12 @@ The cache is automatically cleaned up from time to time. The amortized clean up costs are constant. However, there is also a separate member function that cleans up the cache on demand. +While \ccRefName{} models the concept +\ccc{ArrangementDirectionalXMonotoneTraits_2}, the implementation of +the \ccc{Arr_mergeable_2} operation does not enforce the input curves +to have the same direction as a precondition. Moreover, \ccRefName{} +supports the merging of curves of opposite directions. + \ccInclude{CGAL/Arr_rational_function_traits_2.h} \ccIsModel diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_segment_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_segment_traits.tex index 5651c0b057f..12a280a9c00 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_segment_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_segment_traits.tex @@ -13,23 +13,23 @@ \ccDefinition %============ -The traits class \ccRefName\ is a model of the \ccc{ArrangementTraits_2} -concept that allow the construction and maintenance of arrangements of +The traits class \ccRefName{} is a model of the \ccc{ArrangementTraits_2} +concept, which allows the construction and maintenance of arrangements of line segments. It should be parameterized with a \cgal-kernel model that is templated in turn with a number type. To avoid numerical errors and robustness problems, the number type should support exact rational arithmetic --- that is, the number type should support the arithmetic -operations $+$, $-$, $\times$ and $\div$ that should be carried out -without loss of precision. +operations $+$, $-$, $\times$ and $\div$ carried out without loss of +precision. For example, instantiating the traits -template with kernels such as \ccStyle{Cartesian >}, -or \ccStyle{Homogeneous} ensures the exact and robust operation of +template with kernels, such as \ccStyle{Cartesian >}, +or \ccStyle{Homogeneous}, ensures the exact and robust operation of the application. In particular, the \ccStyle{Cartesian} achieves -the fastest running times in most cases. Using other (inexact) number +the fastest running times in most cases. Using other inexact number types (for example, instantiating the template with -\ccStyle{Simple_cartesian}) is possible at the user's own risk: -selecting an inexact number type usually leads to faster running time at +\ccStyle{Simple_cartesian}) is at the user's own risk: +Selecting an inexact number type usually leads to faster running time at the expense of possible robustness problems. For optimal performance, we recommend instantiating the traits class with @@ -38,9 +38,9 @@ the default \ccc{Exact_predicates_exact_constructions_kernel} provided by only a minor overhead (in comparison to working with a fast, inexact number type) for most inputs. -\ccRefName\ defines \ccc{Kernel::Point_2} as its point type. However, it -does {\sl not} define \ccc{Kernel::Segment_2} as its curve type, as one may -expect. The reason is that the kernel segment is represented by its +\ccRefName{} defines \ccc{Kernel::Point_2} as its point type. However, it +does {\sl not} define \ccc{Kernel::Segment_2} as its curve type, as one +may expect. The reason is that the kernel segment is represented by its two endpoints only, while the traits class needs to store extra data with its segments, in order to efficiently operate on them. Nevertheless, the nested \ccc{X_monotone_curve_2} and \ccc{Curve_2} types (in this @@ -48,7 +48,7 @@ case both types refer to the same class, as {\sl every} line segment is (weakly) $x$-monotone) can however be converted to the type \ccc{Kernel::Segment_2}. -\ccRefName\ achieves faster running times than the +\ccRefName{} achieves faster running times than the \ccStyle{Arr_non_caching_segment_traits_2} traits-class, when arrangements with relatively many intersection points are constructed. It also allows for working with less accurate, yet computationally @@ -56,16 +56,23 @@ efficient number types, such as \ccStyle{Quotient}, which represents floating-point numbers with an unbounded mantissa, but with a bounded exponent. Using this traits class is therefore highly recommended for almost all applications that rely on arrangements of line segments. -On the other hand, \ccRefName\ uses more space and stores extra data with +On the other hand, \ccRefName{} uses more space and stores extra data with each segment, so constructing arrangements of huge sets of non-intersecting segments (or segments that intersect very sparsely) could be more efficient with the \ccStyle{Arr_non_caching_segment_traits_2} traits-class. +While \ccRefName{} models the concept +\ccc{ArrangementDirectionalXMonotoneTraits_2}, the implementation of +the \ccc{Arr_mergeable_2} operation does not enforce the input curves +to have the same direction as a precondition. Moreover, \ccRefName{} +supports the merging of curves of opposite directions. + \ccInclude{CGAL/Arr_segment_traits_2.h} \ccIsModel - \ccc{ArrangementTraits_2} \\ - \ccc{ArrangementLandmarkTraits_2} + \ccc{ArrangementTraits_2}\\ + \ccc{ArrangementLandmarkTraits_2}\\ + \ccc{ArrangementDirectionalXMonotoneTraits_2} \end{ccRefClass} diff --git a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_x_monotone_traits.tex b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_x_monotone_traits.tex index 5e1d7833b44..a1db1051a5a 100644 --- a/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_x_monotone_traits.tex +++ b/Arrangement_on_surface_2/doc_tex/Arrangement_on_surface_2_ref/Arr_x_monotone_traits.tex @@ -55,9 +55,9 @@ supported, the \ccc{Has_merge_category} tag should be defined as \ccThree{Construct_x_monotone_curve_2~~~}{}{\hspace*{7cm}} \ccThreeToTwo -\ccCreationVariable{traits} % \ccCreation -%========== +\ccCreationVariable{traits} +%========================== \ccHeading{Accessing Functor Objects} % =================================== @@ -109,9 +109,9 @@ the \ccc{Has_merge_category} tag should be defined as \ccc{Tag_true} (and \ccCreationVariable{fo} -\ccMethod{Output_iterator intersect(ArrTraits::X_monotone_curve_2 xc1, - ArrTraits::X_monotone_curve_2 xc2, - Output_iterator& oi);}{% +\ccMethod{Output_iterator operator()(ArrTraits::X_monotone_curve_2 xc1, + ArrTraits::X_monotone_curve_2 xc2, + Output_iterator& oi);}{% computes the intersections of \ccc{xc1} and \ccc{xc2} and inserts them {\sl in an ascending lexicographic $xy$-order} into the output iterator \ccc{oi}. The value-type of \ccc{Output_iterator} is @@ -136,10 +136,10 @@ the \ccc{Has_merge_category} tag should be defined as \ccc{Tag_true} (and \ccCreationVariable{fo} \def\ccTagRmConstRefPair{\ccFalse}% -\ccMethod{void split(ArrTraits::X_monotone_curve_2 xc, - ArrTraits::Point_2 p, - ArrTraits::X_monotone_curve_2& xc1, - ArrTraits::X_monotone_curve_2& xc2);}{% +\ccMethod{void operator()(ArrTraits::X_monotone_curve_2 xc, + ArrTraits::Point_2 p, + ArrTraits::X_monotone_curve_2& xc1, + ArrTraits::X_monotone_curve_2& xc2);}{% accepts an input curve \ccc{xc} and a split point \ccc{p} in its interior. It splits \ccc{xc} at the split point into two subcurves \ccc{xc1} and \ccc{xc2}, such that \ccc{p} is \ccc{xc1}'s {\sl right} endpoint and @@ -158,11 +158,14 @@ the \ccc{Has_merge_category} tag should be defined as \ccc{Tag_true} (and \ccCreationVariable{fo} -\ccMethod{bool are_mergeable(ArrTraits::X_monotone_curve_2 xc1, - ArrTraits::X_monotone_curve_2 xc2);}{% - accepts two $x$-monotone curves \ccc{xc1} and \ccc{xc2} that share - a common endpoint, and determines whether they can be merged to form - a single continuous $x$-monotone curve.} +\ccMethod{bool operator()(ArrTraits::X_monotone_curve_2 xc1, + ArrTraits::X_monotone_curve_2 xc2);}{% + accepts two $x$-monotone curves \ccc{xc1} and \ccc{xc2} and determines + whether they can be merged to form a single $x$-monotone curve. + \ccc{xc1} and \ccc{xc2} are mergeable if their underlying curves are + identical, they share a common endpoint, and they do not bend to form + a non-$x$-monotone curve.} + % \ccPrecond{\ccc{xc1} and \ccc{xc2} share a common endpoint.}} \end{ccRefConcept} \ccRefPageEnd @@ -179,9 +182,10 @@ the \ccc{Has_merge_category} tag should be defined as \ccc{Tag_true} (and \def\ccTagRmConstRefPair{\ccFalse}% \ccMethod{void merge(ArrTraits::X_monotone_curve_2 xc1, ArrTraits::X_monotone_curve_2 xc2, - ArrTraits::X_monotone_curve_2& xc);}{% - accepts two {\em mergeable} $x$-monotone curves \ccc{xc1} and \ccc{xc2} - (see definition above), and sets\ccc{xc} to be the merged curve.} + ArrTraits::X_monotone_curve_2& xc);}{% + accepts two \emph{mergeable} $x$-monotone curves \ccc{xc1} and \ccc{xc2} + and asigns \ccc{xc} with the merged curve. + \ccPrecond{\ccc{are_mergeable_2}(\ccc{xc1}, \ccc{xc2}) is true.}} \ccTagDefaults \end{ccRefConcept} \ccRefPageEnd diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h index bd62bb16fb0..38a7a5efff9 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_Bezier_curve_traits_2.h @@ -716,23 +716,38 @@ public: } /*! \class Merge_2 - * The Merge_2 functor. + * A functor that merges two x-monotone arcs into one. */ class Merge_2 { + typedef Arr_Bezier_curve_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_Bezier_curve_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve (segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same conic curve and share a common endpoint. + * \pre The two curves are mergeable. */ void operator() (const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, X_monotone_curve_2& c) const { + CGAL_precondition(m_traits->are_mergeable_2_object()(cv2, cv1)); + c = cv1.merge (cv2); return; } @@ -741,7 +756,7 @@ public: /*! Get a Merge_2 functor object. */ Merge_2 merge_2_object () const { - return Merge_2(); + return Merge_2(this); } //@} diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h index 4ebe902f307..d831d4021f0 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_circle_segment_traits_2.h @@ -36,7 +36,7 @@ namespace CGAL { /*! \class * A traits class for maintaining an arrangement of circles. */ -template +template class Arr_circle_segment_traits_2 { public: @@ -46,12 +46,12 @@ public: typedef typename Kernel::Point_2 Rational_point_2; typedef typename Kernel::Segment_2 Rational_segment_2; typedef typename Kernel::Circle_2 Rational_circle_2; - typedef _One_root_point_2 Point_2; + typedef _One_root_point_2 Point_2; typedef typename Point_2::CoordNT CoordNT; - typedef _Circle_segment_2 Curve_2; - typedef _X_monotone_circle_segment_2 X_monotone_curve_2; + typedef _Circle_segment_2 Curve_2; + typedef _X_monotone_circle_segment_2 X_monotone_curve_2; typedef unsigned int Multiplicity; - typedef Arr_circle_segment_traits_2 Self; + typedef Arr_circle_segment_traits_2 Self; // Category tags: typedef Tag_true Has_left_category; @@ -385,7 +385,7 @@ public: class Make_x_monotone_2 { private: - typedef Arr_circle_segment_traits_2 Self; + typedef Arr_circle_segment_traits_2 Self; bool m_use_cache; @@ -608,32 +608,47 @@ public: return Are_mergeable_2(); } + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { + protected: + typedef Arr_circle_segment_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_circle_segment_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve. * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same conic curve and share a common endpoint. + * \pre The two curves are mergeable. */ void operator() (const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, X_monotone_curve_2& c) const { + CGAL_precondition(m_traits->are_mergeable_2_object()(cv2, cv1)); + c = cv1; c.merge (cv2); - - return; } }; /*! Get a Merge_2 functor object. */ Merge_2 merge_2_object () const { - return Merge_2(); + return Merge_2(this); } class Compare_endpoints_xy_2 diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h index 3a216f962ae..517bdd0e198 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_conic_traits_2.h @@ -660,32 +660,47 @@ public: return Are_mergeable_2(); } + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { + protected: + typedef Arr_conic_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_conic_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve (segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same conic curve and share a common endpoint. + * \pre The two curves are mergeable. */ void operator() (const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, X_monotone_curve_2& c) const { + CGAL_precondition(m_traits->are_mergeable_2_object()(cv2, cv1)); + c = cv1; c.merge (cv2); - - return; } }; - /*! Get a Merge_2 functor object. */ - Merge_2 merge_2_object () const + /*! Obtain a Merge_2 functor object. */ + Merge_2 merge_2_object() const { - return Merge_2(); + return Merge_2(this); } //@} diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h index e98084cb6ba..99185c83a22 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_curve_data_traits_2.h @@ -338,6 +338,9 @@ public: return Are_mergeable_2 (this); } + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { private: diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h b/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h index e6032e46a7d..fb5a27c1383 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_dcel_base.h @@ -35,14 +35,14 @@ #include #include #include -#include +#include namespace CGAL { inline void* _clean_pointer (const void* p) { - BOOST_STATIC_ASSERT(sizeof(void*) == sizeof(size_t)); + CGAL_static_assertion(sizeof(void*) == sizeof(size_t)); const size_t mask = ~1; const size_t val = (reinterpret_cast(p) & mask); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h index 1b0e4000e3d..34f2e3fc4e7 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geodesic_arc_on_sphere_traits_2.h @@ -1934,9 +1934,7 @@ public: * \param xc1 the first curve. * \param xc2 the second curve. * \param xc Output: the merged curve. - * \pre the two curves are mergeable. That is, they are supported by the - * same plane or oposite planes and share a common endpoint that is - * not on the discontinuity arc. + * \pre the two curves are mergeable. */ void operator()(const X_monotone_curve_2& xc1, const X_monotone_curve_2& xc2, diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_great_circular_arc_on_cylinder_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_great_circular_arc_on_cylinder_traits_2.h index 2af862ddff7..23e8d3098f9 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_great_circular_arc_on_cylinder_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_great_circular_arc_on_cylinder_traits_2.h @@ -2117,7 +2117,9 @@ public: Are_mergeable_2 are_mergeable_2_object() const { return Are_mergeable_2(this); } - /*! A functor that merges two x-monotone arcs into one */ + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { protected: typedef Arr_great_circular_arc_on_cylinder_traits_2 Traits; @@ -2137,9 +2139,7 @@ public: * \param xc1 the first curve. * \param xc2 the second curve. * \param xc Output: the merged curve. - * \pre the two curves are mergeable. That is, they are supported by the - * same plane or oposite planes and share a common endpoint that is - * not on the discontinuity arc. + * \pre the two curves are mergeable. */ void operator()(const X_monotone_curve_2 & xc1, const X_monotone_curve_2 & xc2, diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h index a7e81a049e6..43f8e8ca0fe 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_linear_traits_2.h @@ -1511,68 +1511,72 @@ public: return Are_mergeable_2(); } + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { + protected: + typedef Arr_linear_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_linear_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve (segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same line and share a common endpoint. + * \pre The two curves are mergeable. */ void operator() (const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, X_monotone_curve_2& c) const { - CGAL_precondition (! cv1.is_degenerate()); - CGAL_precondition (! cv2.is_degenerate()); + CGAL_precondition(m_traits->are_mergeable_2_object()(cv2, cv1)); - Kernel kernel; - typename Kernel::Equal_2 equal = kernel.equal_2_object(); + CGAL_precondition(!cv1.is_degenerate()); + CGAL_precondition(!cv2.is_degenerate()); - CGAL_precondition - (equal (cv1.supp_line(), - cv2.supp_line()) || - equal (cv1.supp_line(), - kernel.construct_opposite_line_2_object()(cv2.supp_line()))); + Equal_2 equal = m_traits->equal_2_object(); // Check which curve extends to the right of the other. if (cv1.has_right() && cv2.has_left() && - equal (cv1.right(), cv2.left())) + equal(cv1.right(), cv2.left())) { // cv2 extends cv1 to the right. c = cv1; if (cv2.has_right()) - c.set_right (cv2.right()); + c.set_right(cv2.right()); else c.set_right(); // Unbounded endpoint. } - else - { - CGAL_precondition (cv2.has_right() && cv1.has_left() && - equal (cv2.right(), cv1.left())); + else { + CGAL_precondition(cv2.has_right() && cv1.has_left() && + equal(cv2.right(), cv1.left())); // cv1 extends cv2 to the right. c = cv2; if (cv1.has_right()) - c.set_right (cv1.right()); + c.set_right(cv1.right()); else c.set_right(); // Unbounded endpoint. } - - return; } }; /*! Obtain a Merge_2 functor object. */ - Merge_2 merge_2_object () const - { - return Merge_2(); - } + Merge_2 merge_2_object () const { return Merge_2(this); } //@} /// \name Functor definitions for the landmarks point-location strategy. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h index 78a565c5b3a..fa2fc1fbe06 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_non_caching_segment_traits_2.h @@ -283,88 +283,106 @@ public: /*! \class * A functor for testing whether two segments are mergeable. */ - class Are_mergeable_2 - { + class Are_mergeable_2 { + protected: + typedef Arr_non_caching_segment_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Are_mergeable_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_non_caching_segment_traits_2; + public: /*! * Check whether it is possible to merge two given x-monotone curves. * \param cv1 The first curve. * \param cv2 The second curve. - * \return (true) if the two segments are mergeable - if they are supported - * by the same line and share a common endpoint; (false) otherwise. + * \return (true) if the two curves are mergeable, that is, if they are + * supported by the same line; (false) otherwise. + * \pre cv1 and cv2 share a common endpoint. */ bool operator()(const X_monotone_curve_2 & cv1, const X_monotone_curve_2 & cv2) const { - Base base; - Equal_2 equal = base.equal_2_object(); - Construct_min_vertex_2 min_vertex = base.construct_min_vertex_2_object(); - Construct_max_vertex_2 max_vertex = base.construct_max_vertex_2_object(); - + const Base* base = m_traits; + Equal_2 equal = base->equal_2_object(); + Construct_min_vertex_2 min_vertex = base->construct_min_vertex_2_object(); + Construct_max_vertex_2 max_vertex = base->construct_max_vertex_2_object(); + if (!equal(max_vertex(cv1), min_vertex(cv2)) && + !equal(max_vertex(cv2), min_vertex(cv1))) + return false; + // Check if the two curves have the same supporting line. - if (base.compare_slope_2_object()(cv1,cv2) != EQUAL) - return (false); - - // Check if the left endpoint of one curve is the right endpoint of the - // other. - return (equal(max_vertex(cv1), min_vertex(cv2)) || - equal(max_vertex(cv2), min_vertex(cv1))); + return (base->compare_slope_2_object()(cv1, cv2) == EQUAL); } }; /*! Obtain an Are_mergeable_2 functor object */ Are_mergeable_2 are_mergeable_2_object() const - { - return Are_mergeable_2(); - } + { return Are_mergeable_2(this); } - /*! \class - * A functor for merging two segments into one. + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. */ - class Merge_2 - { + class Merge_2 { + protected: + typedef Arr_non_caching_segment_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_non_caching_segment_traits_2; + public: /*! * Merge two given segments into a single segment. * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same line and share a common endpoint. + * \pre The two curves are mergeable. */ void operator()(const X_monotone_curve_2 & cv1, const X_monotone_curve_2 & cv2, X_monotone_curve_2 & c) const { - Base base; - CGAL_precondition(base.compare_slope_2_object()(cv2, cv1) == EQUAL); - Equal_2 equal = base.equal_2_object(); - Construct_min_vertex_2 min_vertex = base.construct_min_vertex_2_object(); - Construct_max_vertex_2 max_vertex = base.construct_max_vertex_2_object(); + CGAL_precondition(m_traits->are_mergeable_2_object()(cv2, cv1)); + + const Base* base = m_traits; + Equal_2 equal = base->equal_2_object(); + Construct_min_vertex_2 min_vertex = base->construct_min_vertex_2_object(); + Construct_max_vertex_2 max_vertex = base->construct_max_vertex_2_object(); // Check which curve extends to the right of the other. - const Point_2 & right1 = max_vertex(cv1); - const Point_2 & left2 = min_vertex(cv2); - const Point_2 & left1 = min_vertex(cv1); - const Point_2 & right2 = max_vertex(cv2); + const Point_2& left1 = min_vertex(cv1); + const Point_2& right1 = max_vertex(cv1); + const Point_2& left2 = min_vertex(cv2); + const Point_2& right2 = max_vertex(cv2); - if (!equal(right1, left2)) { - // cv1 extends cv2 to the right. - CGAL_precondition(base.equal_2_object()(right2, left1)); - c = base.construct_segment_2_object()(left2, right1); + if (equal(right1, left2)) { + // cv2 extends cv1 to the right. + c = base->construct_segment_2_object()(left1, right2); return; } - // cv2 extends cv1 to the right. - c = base.construct_segment_2_object()(left1, right2); + // cv1 extends cv2 to the right. + CGAL_precondition(equal(right2, left1)); + + c = base->construct_segment_2_object()(left2, right1); } }; /*! Obtain a Merge_2 functor object */ - Merge_2 merge_2_object() const - { - return Merge_2(); - } + Merge_2 merge_2_object() const { return Merge_2(this); } //@} //! \name Functor definitions for the Boolean set-operations. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h index e1580b2282a..102bb4fa18a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_overlay_2.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include namespace CGAL { @@ -73,16 +73,16 @@ void overlay (const Arrangement_on_surface_2& arr1, typedef Arrangement_on_surface_2 ArrRes; // some type assertions (not all, but better then nothing). - BOOST_STATIC_ASSERT((boost::is_convertible< \ + CGAL_static_assertion((boost::is_convertible< \ typename GeomTraitsA::Point_2, \ typename GeomTraitsRes::Point_2 >::value)); - BOOST_STATIC_ASSERT((boost::is_convertible< \ + CGAL_static_assertion((boost::is_convertible< \ typename GeomTraitsB::Point_2, \ typename GeomTraitsRes::Point_2 >::value)); - BOOST_STATIC_ASSERT((boost::is_convertible< \ + CGAL_static_assertion((boost::is_convertible< \ typename GeomTraitsA::X_monotone_curve_2, \ typename GeomTraitsRes::X_monotone_curve_2 >::value)); - BOOST_STATIC_ASSERT((boost::is_convertible< \ + CGAL_static_assertion((boost::is_convertible< \ typename GeomTraitsB::X_monotone_curve_2, \ typename GeomTraitsRes::X_monotone_curve_2 >::value)); diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h index 31a8b33e86d..64b4df00d9d 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polycurve_traits_2.h @@ -18,23 +18,23 @@ // Author(s) : Efi Fogel // Ron Wein -#ifndef CGAL_ARR_POLYLINE_TRAITS_2_H -#define CGAL_ARR_POLYLINE_TRAITS_2_H +#ifndef CGAL_ARR_POLYCURVE_TRAITS_2_H +#define CGAL_ARR_POLYCURVE_TRAITS_2_H /*! \file - * The traits-class for the linear piece-wiese(polyline) type of curves of the + * The traits-class for the piece-wise type of curves of the * arrangement package. */ #include #include #include -#include +#include namespace CGAL { template -class Arr_polyline_traits_2 { +class Arr_polycurve_traits_2 { public: typedef T_SegmentTraits_2 Segment_traits_2; @@ -49,7 +49,7 @@ public: typedef Arr_oblivious_side_tag Right_side_category; private: - typedef Arr_polyline_traits_2 Self; + typedef Arr_polycurve_traits_2 Self; // Data members: Segment_traits_2 m_seg_traits; // The base segment-traits class. @@ -59,11 +59,16 @@ private: public: /*! Default constructor */ - Arr_polyline_traits_2() : m_seg_traits() {} + Arr_polycurve_traits_2() : m_seg_traits() {} + + /*! Obtain the segment traits. + * \return the segment traits. + */ + const Segment_traits_2* segment_traits_2() const { return &m_seg_traits; } /// \name Types and functors inherited from the base segment traits. //@{ - + // Traits types: typedef typename Segment_traits_2::Point_2 Point_2; typedef typename Segment_traits_2::Curve_2 Segment_2; @@ -183,7 +188,7 @@ public: class Compare_y_at_x_2 { private: - typedef Arr_polyline_traits_2 Self; + typedef Arr_polycurve_traits_2 Self; const Segment_traits_2 * m_seg_traits; public: @@ -221,7 +226,7 @@ public: class Compare_y_at_x_left_2 { private: - typedef Arr_polyline_traits_2 Self; + typedef Arr_polycurve_traits_2 Self; const Segment_traits_2 * m_seg_traits; @@ -267,7 +272,7 @@ public: class Compare_y_at_x_right_2 { private: - typedef Arr_polyline_traits_2 Self; + typedef Arr_polycurve_traits_2 Self; const Segment_traits_2 * m_seg_traits; public: @@ -521,7 +526,7 @@ public: class Split_2 { private: - typedef Arr_polyline_traits_2 Self; + typedef Arr_polycurve_traits_2 Self; const Segment_traits_2 * m_seg_traits; @@ -598,7 +603,7 @@ public: class Intersect_2 { private: - typedef Arr_polyline_traits_2 Self; + typedef Arr_polycurve_traits_2 Self; const Segment_traits_2 * m_seg_traits; public: @@ -842,47 +847,59 @@ public: return Are_mergeable_2(&m_seg_traits); } + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { - private: - const Segment_traits_2 * m_seg_traits; + protected: + typedef Arr_polycurve_traits_2 Traits; - public: - /*! Constructor. */ - Merge_2(const Segment_traits_2 * traits) : m_seg_traits(traits) {} + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + friend class Arr_polycurve_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve(segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable. That is, they share a common - * endpoint. + * \pre The two curves are mergeable. */ void operator()(const X_monotone_curve_2 & cv1, const X_monotone_curve_2 & cv2, X_monotone_curve_2 & c) const { - typename Segment_traits_2::Construct_min_vertex_2 min_vertex = - m_seg_traits->construct_min_vertex_2_object(); - typename Segment_traits_2::Construct_max_vertex_2 max_vertex = - m_seg_traits->construct_max_vertex_2_object(); - typename Segment_traits_2::Equal_2 equal = m_seg_traits->equal_2_object(); + CGAL_precondition(m_traits->are_mergeable_2_object()(cv1, cv2)); + + const Segment_traits_2* seg_traits = m_traits->segment_traits_2(); + + Construct_min_vertex_2 min_vertex = + m_traits->construct_min_vertex_2_object(); + Construct_max_vertex_2 max_vertex = + m_traits->construct_max_vertex_2_object(); + Equal_2 equal = m_traits->equal_2_object(); const unsigned int n1 = cv1.size(); const unsigned int n2 = cv2.size(); unsigned int i; c.clear(); - if (equal(max_vertex(cv1[n1 - 1]), min_vertex(cv2[0]))) { + if (equal(max_vertex(cv1), min_vertex(cv2))) { // cv2 extends cv1 to the right: for (i = 0; i < n1 - 1; ++i) c.push_back(cv1[i]); - // Try to merge tthe to contiguous line segments: - if (m_seg_traits->are_mergeable_2_object()(cv1[n1 - 1], cv2[0])) { + // Try to merge the two contiguous line segments: + if (seg_traits->are_mergeable_2_object()(cv1[n1 - 1], cv2[0])) { Segment_2 seg; - m_seg_traits->merge_2_object()(cv1[n1 - 1], cv2[0], seg); + seg_traits->merge_2_object()(cv1[n1 - 1], cv2[0], seg); c.push_back(seg); } else { c.push_back(cv1[n1 - 1]); @@ -891,15 +908,17 @@ public: for (i = 1; i < n2; ++i) c.push_back(cv2[i]); - } else if (equal(max_vertex(cv2[n2 - 1]), min_vertex(cv1[0]))) { + } else { + CGAL_precondition(equal(max_vertex(cv2), min_vertex(cv1))); + // cv1 extends cv2 to the right: for (i = 0; i < n2 - 1; ++i) c.push_back(cv2[i]); - // Try to merge tthe to contiguous line segments: - if (m_seg_traits->are_mergeable_2_object()(cv2[n2 - 1], cv1[0])) { + // Try to merge the two contiguous line segments: + if (seg_traits->are_mergeable_2_object()(cv2[n2 - 1], cv1[0])) { Segment_2 seg; - m_seg_traits->merge_2_object()(cv2[n2 - 1], cv1[0], seg); + seg_traits->merge_2_object()(cv2[n2 - 1], cv1[0], seg); c.push_back(seg); } else { c.push_back(cv2[n2 - 1]); @@ -908,17 +927,12 @@ public: for (i = 1; i < n1; ++i) c.push_back(cv1[i]); - } else { - CGAL_precondition_msg(false, "The curves are not mergeable."); } } }; /*! Get a Merge_2 functor object. */ - Merge_2 merge_2_object() const - { - return Merge_2(&m_seg_traits); - } + Merge_2 merge_2_object() const { return Merge_2(this); } ///@} /// \name Functor definitions for the landmarks point-location strategy. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h index d520158dbf4..356f4b1bd67 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_polyline_traits_2.h @@ -61,6 +61,11 @@ public: /*! Default constructor */ Arr_polyline_traits_2() : m_seg_traits() {} + /*! Obtain the segment traits. + * \return the segment traits. + */ + const Segment_traits_2* segment_traits_2() const { return &m_seg_traits; } + /// \name Types and functors inherited from the base segment traits. //@{ @@ -842,47 +847,59 @@ public: return Are_mergeable_2(&m_seg_traits); } + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { - private: - const Segment_traits_2 * m_seg_traits; + protected: + typedef Arr_polyline_traits_2 Traits; - public: - /*! Constructor. */ - Merge_2(const Segment_traits_2 * traits) : m_seg_traits(traits) {} + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + friend class Arr_polyline_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve(segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable. That is, they share a common - * endpoint. + * \pre The two curves are mergeable. */ void operator()(const X_monotone_curve_2 & cv1, const X_monotone_curve_2 & cv2, X_monotone_curve_2 & c) const { - typename Segment_traits_2::Construct_min_vertex_2 min_vertex = - m_seg_traits->construct_min_vertex_2_object(); - typename Segment_traits_2::Construct_max_vertex_2 max_vertex = - m_seg_traits->construct_max_vertex_2_object(); - typename Segment_traits_2::Equal_2 equal = m_seg_traits->equal_2_object(); + CGAL_precondition(m_traits->are_mergeable_2_object()(cv1, cv2)); + + const Segment_traits_2* seg_traits = m_traits->segment_traits_2(); + + Construct_min_vertex_2 min_vertex = + m_traits->construct_min_vertex_2_object(); + Construct_max_vertex_2 max_vertex = + m_traits->construct_max_vertex_2_object(); + Equal_2 equal = m_traits->equal_2_object(); const unsigned int n1 = cv1.size(); const unsigned int n2 = cv2.size(); unsigned int i; c.clear(); - if (equal(max_vertex(cv1[n1 - 1]), min_vertex(cv2[0]))) { + if (equal(max_vertex(cv1), min_vertex(cv2))) { // cv2 extends cv1 to the right: for (i = 0; i < n1 - 1; ++i) c.push_back(cv1[i]); // Try to merge tthe to contiguous line segments: - if (m_seg_traits->are_mergeable_2_object()(cv1[n1 - 1], cv2[0])) { + if (seg_traits->are_mergeable_2_object()(cv1[n1 - 1], cv2[0])) { Segment_2 seg; - m_seg_traits->merge_2_object()(cv1[n1 - 1], cv2[0], seg); + seg_traits->merge_2_object()(cv1[n1 - 1], cv2[0], seg); c.push_back(seg); } else { c.push_back(cv1[n1 - 1]); @@ -891,15 +908,17 @@ public: for (i = 1; i < n2; ++i) c.push_back(cv2[i]); - } else if (equal(max_vertex(cv2[n2 - 1]), min_vertex(cv1[0]))) { + } else { + CGAL_precondition(equal(max_vertex(cv2), min_vertex(cv1))); + // cv1 extends cv2 to the right: for (i = 0; i < n2 - 1; ++i) c.push_back(cv2[i]); // Try to merge tthe to contiguous line segments: - if (m_seg_traits->are_mergeable_2_object()(cv2[n2 - 1], cv1[0])) { + if (seg_traits->are_mergeable_2_object()(cv2[n2 - 1], cv1[0])) { Segment_2 seg; - m_seg_traits->merge_2_object()(cv2[n2 - 1], cv1[0], seg); + seg_traits->merge_2_object()(cv2[n2 - 1], cv1[0], seg); c.push_back(seg); } else { c.push_back(cv2[n2 - 1]); @@ -908,17 +927,12 @@ public: for (i = 1; i < n1; ++i) c.push_back(cv1[i]); - } else { - CGAL_precondition_msg(false, "The curves are not mergeable."); } } }; /*! Get a Merge_2 functor object. */ - Merge_2 merge_2_object() const - { - return Merge_2(&m_seg_traits); - } + Merge_2 merge_2_object() const { return Merge_2(this); } ///@} /// \name Functor definitions for the landmarks point-location strategy. diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h index 7c19aa47d78..c85169b85d4 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Base_rational_arc_ds_1.h @@ -68,8 +68,8 @@ public: typedef std::vector > Root_multiplicity_vector; - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h index 419818cc875..5a7911fc46a 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rat_arc/Rational_arc_d_1.h @@ -103,8 +103,8 @@ public: typedef Algebraic_point_2 Point_2; - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rational_arc_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_rational_arc_traits_2.h index d88baa23cea..5404d208b39 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_rational_arc_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rational_arc_traits_2.h @@ -505,33 +505,47 @@ public: return Are_mergeable_2(); } - /*! A functor that merges two curves into one. */ + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { + protected: + typedef Arr_rational_arc_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_rational_arc_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve (segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same conic curve and share a common endpoint. + * \pre The two curves are mergeable. */ void operator() (const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, X_monotone_curve_2& c) const { + CGAL_precondition(m_traits->are_mergeable_2_object()(cv1, cv2)); + c = cv1; c.merge (cv2); - - return; } }; /*! Obtain a Merge_2 functor object. */ Merge_2 merge_2_object () const { - return Merge_2(); + return Merge_2(this); } //@} diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h index a16a60a5358..074ee5e9b82 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_rational_function_traits_2.h @@ -934,22 +934,38 @@ public: return Are_mergeable_2(); } - /*! A functor that merges two curves into one. */ + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ class Merge_2 { + protected: + typedef Arr_rational_function_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_rational_function_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve (segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same conic curve and share a common endpoint. + * \pre The two curves are mergeable. */ void operator()(const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2, X_monotone_curve_2& c) const { + CGAL_precondition(m_traits->are_mergeable_2_object()(cv2, cv1)); + c = cv1; c.merge(cv2); } @@ -958,7 +974,7 @@ public: /*! Obtain a Merge_2 functor object. */ Merge_2 merge_2_object() const { - return Merge_2(); + return Merge_2(this); } //@} diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h index f3abc0fb63e..e6f8ea1aa8b 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_segment_traits_2.h @@ -849,89 +849,100 @@ public: return Intersect_2(); } - class Are_mergeable_2 - { + class Are_mergeable_2 { + protected: + typedef Arr_segment_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Are_mergeable_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_segment_traits_2; + public: /*! * Check whether it is possible to merge two given x-monotone curves. * \param cv1 The first curve. * \param cv2 The second curve. - * \return (true) if the two curves are mergeable - if they are supported - * by the same line and share a common endpoint; (false) otherwise. + * \return (true) if the two curves are mergeable, that is, if they are + * supported by the same line; (false) otherwise. + * \pre cv1 and cv2 share a common endpoint. */ bool operator() (const X_monotone_curve_2& cv1, const X_monotone_curve_2& cv2) const { - Kernel kernel; - typename Kernel::Equal_2 equal = kernel.equal_2_object(); - - // Check if the two curves have the same supporting line. - if (! equal (cv1.line(), cv2.line()) && - ! equal (cv1.line(), - kernel.construct_opposite_line_2_object() (cv2.line()))) - return (false); - - // Check if the left endpoint of one curve is the right endpoint of the - // other. - return (equal (cv1.right(), cv2.left()) || - equal (cv2.right(), cv1.left())); + if (!m_traits->equal_2_object()(cv1.right(), cv2.left()) && + !m_traits->equal_2_object()(cv2.right(), cv1.left())) + return false; + + // Check whether the two curves have the same supporting line. + const Kernel* kernel = m_traits; + typename Kernel::Equal_2 equal = kernel->equal_2_object(); + return (equal(cv1.line(), cv2.line()) || + equal(cv1.line(), + kernel->construct_opposite_line_2_object()(cv2.line()))); } }; /*! Get an Are_mergeable_2 functor object. */ - Are_mergeable_2 are_mergeable_2_object () const - { - return Are_mergeable_2(); - } + Are_mergeable_2 are_mergeable_2_object() const + { return Are_mergeable_2(this); } - class Merge_2 - { + /*! \class Merge_2 + * A functor that merges two x-monotone arcs into one. + */ + class Merge_2 { + protected: + typedef Arr_segment_traits_2 Traits; + + /*! The traits (in case it has state) */ + const Traits* m_traits; + + /*! Constructor + * \param traits the traits (in case it has state) + */ + Merge_2(const Traits* traits) : m_traits(traits) {} + + friend class Arr_segment_traits_2; + public: /*! * Merge two given x-monotone curves into a single curve (segment). * \param cv1 The first curve. * \param cv2 The second curve. * \param c Output: The merged curve. - * \pre The two curves are mergeable, that is they are supported by the - * same line and share a common endpoint. + * \pre The two curves are mergeable. */ - void operator() (const X_monotone_curve_2& cv1, - const X_monotone_curve_2& cv2, - X_monotone_curve_2& c) const + void operator()(const X_monotone_curve_2& cv1, + const X_monotone_curve_2& cv2, + X_monotone_curve_2& c) const { - Kernel kernel; - typename Kernel::Equal_2 equal = kernel.equal_2_object(); - - CGAL_precondition - (equal (cv1.line(), cv2.line()) || - equal (cv1.line(), - kernel.construct_opposite_line_2_object() (cv2.line()))); + CGAL_precondition(m_traits->are_mergeable_2_object()(cv1, cv2)); + Equal_2 equal = m_traits->equal_2_object(); + // Check which curve extends to the right of the other. - if (equal (cv1.right(), cv2.left())) - { + if (equal(cv1.right(), cv2.left())) { // cv2 extends cv1 to the right. c = cv1; - c.set_right (cv2.right()); + c.set_right(cv2.right()); } - else - { - CGAL_precondition (equal (cv2.right(), cv1.left())); + else { + CGAL_precondition(equal(cv2.right(), cv1.left())); // cv1 extends cv2 to the right. c = cv2; - c.set_right (cv1.right()); + c.set_right(cv1.right()); } - - return; } }; /*! Get a Merge_2 functor object. */ - Merge_2 merge_2_object () const - { - return Merge_2(); - } + Merge_2 merge_2_object () const { return Merge_2(this); } //@} /// \name Functor definitions for the landmarks point-location strategy. diff --git a/Arrangement_on_surface_2/include/CGAL/Basic_sweep_line_2.h b/Arrangement_on_surface_2/include/CGAL/Basic_sweep_line_2.h index 5c0303e21b9..9c0d6ff3125 100644 --- a/Arrangement_on_surface_2/include/CGAL/Basic_sweep_line_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Basic_sweep_line_2.h @@ -44,6 +44,7 @@ #define CGAL_PRINT_INSERT(a) #define CGAL_PRINT_ERASE(a) #define CGAL_PRINT_NEW_EVENT(p, e) +#define CGAL_PRINT_UPDATE_EVENT(p, e) #define CGAL_PRINT(a) #else @@ -62,6 +63,9 @@ #define CGAL_PRINT_NEW_EVENT(p, e) \ { std::cout << "%%% a new event was created at " << (p) << std::endl; \ (e)->Print(); } +#define CGAL_PRINT_UPDATE_EVENT(p, e) \ +{ std::cout << "%%% an event was updated at " << (p) << std::endl; \ + (e)->Print(); } #define CGAL_PRINT(a) { std::cout << a ; } #endif diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h index 9661569d7e1..2e257043e00 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Arr_construction_sl_visitor.h @@ -776,7 +776,7 @@ Arr_construction_sl_visitor::insert_at_vertices if (res->is_on_inner_ccb() || res->twin()->is_on_inner_ccb()) { // In case a new face has been created (pointed by the new halfedge // we obtained), we have to examine the holes and isolated vertices - // in the existing face (pointed be the twin halfedge) and relocate + // in the existing face (pointed by the twin halfedge) and relocate // the relevant features in the new face. CGAL_assertion(res->face() != res->twin()->face()); this->relocate_in_new_face (res); diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h index 40f910cef91..56f86903b30 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Basic_sweep_line_2_impl.h @@ -486,7 +486,7 @@ void Basic_sweep_line_2::_sort_left_curves() Subcurve *curve = *(m_currentEvent->left_curves_begin()); Status_line_iterator sl_iter = curve->hint(); CGAL_assertion (*sl_iter == curve); - + //look for the first curve in the vertical ordering that is also in the left curve of the event for (++sl_iter; sl_iter != m_statusLine.end(); ++sl_iter) { if (std::find (m_currentEvent->left_curves_begin(), @@ -530,7 +530,7 @@ void Basic_sweep_line_2::_sort_left_curves() m_currentEvent->left_curves_end(), *sl_iter) == m_currentEvent->left_curves_end()) { - m_currentEvent->replace_left_curves(++sl_iter,end);; + m_currentEvent->replace_left_curves(++sl_iter,end); } else { @@ -717,8 +717,11 @@ _push_event (const Point_2& pt, Attribute type, // Insert the new event into the queue using the hint we got when we // looked for it. m_queue->insert_before (pair_res.first, e); + CGAL_PRINT_NEW_EVENT(pt, e); + } + else{ + CGAL_PRINT_UPDATE_EVENT(pt, e); } - CGAL_PRINT_NEW_EVENT(pt, e); // Return the resulting event and a flag indicating whether we have created // a new event. diff --git a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h index 098c266c496..b282c930522 100644 --- a/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h +++ b/Arrangement_on_surface_2/include/CGAL/Sweep_line_2/Sweep_line_2_impl.h @@ -417,42 +417,30 @@ _intersect (Subcurve *c1, Subcurve *c2) // The two subCurves may start at the same point, in that case we ignore the // first intersection point (if we got to that stage, they cannot overlap). - if (reinterpret_cast(c1->left_event()) == this->m_currentEvent && - reinterpret_cast(c2->left_event()) == this->m_currentEvent) - { - CGAL_PRINT(" [Skipping common left endpoint...]\n";); - ++vi; - } - else - { - // In case both left curve-ends have boundary conditions and are not - // open, check whether the left endpoints are the same. If they are, - // skip the first intersection point. - const Arr_parameter_space ps_x1 = - this->m_traits->parameter_space_in_x_2_object()(c1->last_curve(), - ARR_MIN_END); - const Arr_parameter_space ps_y1 = - this->m_traits->parameter_space_in_y_2_object()(c1->last_curve(), - ARR_MIN_END); - const Arr_parameter_space ps_x2 = - this->m_traits->parameter_space_in_x_2_object()(c2->last_curve(), - ARR_MIN_END); - const Arr_parameter_space ps_y2 = - this->m_traits->parameter_space_in_y_2_object()(c2->last_curve(), - ARR_MIN_END); - if ((ps_x1 == ps_x2) && (ps_y1 == ps_y2) && - ((ps_x1 != ARR_INTERIOR) || (ps_y2 != ARR_INTERIOR)) && - this->m_traits->is_closed_2_object()(c1->last_curve(), ARR_MIN_END) && - this->m_traits->is_closed_2_object()(c2->last_curve(), ARR_MIN_END)) + const Arr_parameter_space ps_x1 = + this->m_traits->parameter_space_in_x_2_object()(c1->last_curve(), + ARR_MIN_END); + const Arr_parameter_space ps_y1 = + this->m_traits->parameter_space_in_y_2_object()(c1->last_curve(), + ARR_MIN_END); + const Arr_parameter_space ps_x2 = + this->m_traits->parameter_space_in_x_2_object()(c2->last_curve(), + ARR_MIN_END); + const Arr_parameter_space ps_y2 = + this->m_traits->parameter_space_in_y_2_object()(c2->last_curve(), + ARR_MIN_END); + + if ((ps_x1 == ps_x2) && (ps_y1 == ps_y2) && + this->m_traits->is_closed_2_object()(c1->last_curve(), ARR_MIN_END) && + this->m_traits->is_closed_2_object()(c2->last_curve(), ARR_MIN_END)) + { + if (this->m_traits->equal_2_object() + (this->m_traits->construct_min_vertex_2_object()(c1->last_curve()), + this->m_traits->construct_min_vertex_2_object()(c2->last_curve()))) { - if (this->m_traits->equal_2_object() - (this->m_traits->construct_min_vertex_2_object() (c1->last_curve()), - this->m_traits->construct_min_vertex_2_object() (c2->last_curve()))) - { - CGAL_PRINT(" [Skipping common left endpoint on boundary ...]\n";); - ++vi; - } + CGAL_PRINT(" [Skipping common left endpoint on boundary ...]\n";); + ++vi; } } @@ -513,6 +501,7 @@ _intersect (Subcurve *c1, Subcurve *c2) const std::pair *xp_point; + // Efi: why not skipping in a loop?check only one (that is, why not in a loop)? if(vi != vi_end) { xp_point = object_cast > (&(*vi)); diff --git a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp index ba73bb8347d..0efda44aa1b 100644 --- a/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp +++ b/Arrangement_on_surface_2/test/Arrangement_on_surface_2/test_tags.cpp @@ -271,38 +271,38 @@ int main () assert(ident12() == false); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same< CGAL::internal::Arr_complete_left_side_category< Traits5 >::Category, CGAL::Arr_oblivious_side_tag >::value) ); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same< CGAL::internal::Arr_complete_left_side_category< Traits1 >::Category, CGAL::Arr_open_side_tag >::value) ); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same::Category, CGAL::Arr_oblivious_side_tag >::value) ); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same::Category, CGAL::Arr_open_side_tag >::value) ); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same< CGAL::internal::Arr_complete_top_side_category< Traits5 >::Category, CGAL::Arr_oblivious_side_tag >::value) ); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same< CGAL::internal::Arr_complete_top_side_category< Traits1 >::Category, CGAL::Arr_open_side_tag >::value) ); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same< CGAL::internal::Arr_complete_right_side_category< Traits5 >::Category, CGAL::Arr_oblivious_side_tag >::value) ); - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same< CGAL::internal::Arr_complete_right_side_category< Traits1 >::Category, CGAL::Arr_open_side_tag >::value) ); diff --git a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Arr_dir_x_monotone_traits.tex b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Arr_dir_x_monotone_traits.tex index 5ea46fc3ee1..d96a3b72740 100644 --- a/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Arr_dir_x_monotone_traits.tex +++ b/Boolean_set_operations_2/doc_tex/Boolean_set_operations_2_ref/Arr_dir_x_monotone_traits.tex @@ -7,7 +7,7 @@ \begin{ccRefConcept}{ArrangementDirectionalXMonotoneTraits_2} \ccDefinition - +% =========== This concept refines the basic arrangement $x$-monotone traits concept. A model of this concept is able to handle \emph{directed} $x$-monotone curves that intersect in their interior. Namely, an instance of the @@ -16,8 +16,8 @@ that intersect in their interior. Namely, an instance of the (lexicographically smaller) endpoint and a \emph{right} endpoint. If the traits class is also a model of \ccc{ArrangementDirectionalXMonotoneTraits_2}, the $x$-monotone curve is -also required to have a direction, namely one of these two endpoint is -viewed as its \emph{source} and the other as its \emph{target}. +also required to have a direction, namely one of these two endpoint serves +as its \emph{source} and the other as its \emph{target}. \ccRefines \ccc{ArrangementXMonotoneTraits_2} @@ -29,51 +29,22 @@ viewed as its \emph{source} and the other as its \emph{target}. \ccThreeToTwo \ccNestedType{Compare_endpoints_xy_2} -{provides the operator~: \\ - \ccc{Comparison_result operator() (X_monotone_curve_2 c)} \\ - which accepts an input curve \ccc{c} and compare its source and target - point. It returns \ccc{SMALLER} if the curve is directed from left to right - (lexicographically --- i.e., in case of a vertical line segment, this means - it is directed upward), and \ccc{LARGER} if it is directed from right to - left.} +{models the concept \ccc{ArrDirectionalTraits::CompareEndpointsXy_2}.} \ccNestedType{Construct_opposite_2} -{provides the operator~: \\ - \ccc{X_monotone_curve_2 operator() (X_monotone_curve_2 c)} \\ - which accepts an $x$-monotone curve \ccc{c} and returns its opposite curve, - namely a curve whose graph is the same as \ccc{c}'s, and whose source and - target are swapped with respect to \ccc{c}'s source and target.} - -In addition, the two following functors, required by the concept -\ccc{ArrangementXMonotoneTraits_2} should operate as follows: +{models the concept \ccc{ArrDirectionalTraits::ConstructOpposite_2}.} \ccNestedType{Intersect_2} -{provides the operator (templated by the \ccc{OutputIterator} type)~: \\ - \ccc{OutputIterator operator() (X_monotone_curve_2 c1, X_monotone_curve_2 c2, - OutputIterator oi)} \\ - which computes the intersections of \ccc{c1} and \ccc{c2} and inserts them - {\sl in an ascending lexicographic $xy$-order} into the output iterator. - The value-type of \ccc{OutputIterator} is \ccc{CGAL::Object}, where each - \ccc{Object} either wraps a \ccc{pair} instance, which - represents an intersection point with its multiplicity (in case the - multiplicity is undefined or not known, it should be set to $0$) or an - \ccc{X_monotone_curve_2} instance, representing an overlapping subcurve of - \ccc{c1} and \ccc{c2}. In the latter case, if \ccc{c1} and \ccc{c2} have the - same direction, then the overlapping subcurves should also be directed the - same way; otherwise, they can be associated with an arbitrary direction. - The operator returns a past-the-end iterator for the output sequence.} +{models the concept \ccc{ArrDirectionalTraits::Intersect_2}.} \ccNestedType{Split_2} -{provides the operator~: \\ - \ccc{void operator() (X_monotone_curve_2 c, Point_2 p, - X_monotone_curve_2& c1, X_monotone_curve_2& c2)} \\ - which accepts an input curve \ccc{c} and a split point \ccc{p} in its - interior. It splits \ccc{c} at the split point into two subcurves \ccc{c1} - and \ccc{c2}, such that \ccc{p} is \ccc{c1}'s {\sl right} endpoint and - \ccc{c2}'s {\sl left} endpoint. The direction of \ccc{c} should be preserved: - in case \ccc{c} is directed from left to right then \ccc{p} becomes \ccc{c1}'s - target and \ccc{c2}'s source; otherwise, \ccc{p} becomes \ccc{c2}'s - target and \ccc{c1}'s source.} +{models the concept \ccc{ArrDirectionalTraits::Split_2}.} + +\ccNestedType{Are_mergeable_2} +{models the concept \ccc{ArrDirectionalTraits::AreMergeable_2}.} + +\ccNestedType{Merge_2} +{models the concept \ccc{ArrDirectionalTraits::Merge_2}.} \ccCreation \ccCreationVariable{traits} @@ -104,7 +75,9 @@ In addition, the two following functors, required by the concept \ccc{CGAL::Arr_non_caching_segment_traits_2} \\ \ccc{CGAL::Arr_circle_segment_traits_2} \\ \ccc{CGAL::Arr_conic_traits_2} \\ -\ccc{CGAL::Arr_rational_arc_traits_2} +\ccc{CGAL::Arr_rational_function_traits_2}\\ +\ccc{CGAL::Arr_Bezier_curve_traits_2}\\ +\ccc{CGAL::Arr_algebraic_segment_traits_2} \ccSeeAlso %========= @@ -115,3 +88,147 @@ In addition, the two following functors, required by the concept \end{ccRefConcept} \ccRefPageEnd + +%%%%%%%% Functors %%%%%%%% + +%%%%%%%% Intersect_2 +% ================== +\ccRefPageBegin +\begin{ccRefConcept}{ArrDirectionalTraits::Intersect_2} +\ccRefines{Functor} + +\ccHasModels\ccc{ArrangementDirectionalXMonotoneTraits_2::Intersect_2} + +\ccCreationVariable{fo} + +\ccMethod{Output_iterator operator()(ArrDirectionalTraits::X_monotone_curve_2 xc1, + ArrDirectionalTraits::X_monotone_curve_2 xc2, + Output_iterator& oi);} + {computes the intersections of \ccc{xc1} and \ccc{xc2} and + inserts them \emph{in an ascending lexicographic $xy$-order} into the + output iterator \ccc{oi}. The value-type of \ccc{Output_iterator} is + \ccc{CGAL::Object}, where each \ccc{Object} wraps either a + \ccc{pair} object, which + represents an intersection point with its multiplicity (in case the + multiplicity is undefined or unknown, it is set to $0$) or an + \ccc{ArrDirectionalTraits::X_monotone_curve_2} object, representing an + overlapping subcurve of \ccc{xc1} and \ccc{xc2}. In the latter case, + the overlapping subcurves are given the direction of \ccc{xc1} and + \ccc{xc2} if their directions are identical. Otherwise, the overlapping + subcurves are given an arbitrary direction. The operator returns a + past-the-end iterator for the output sequence.} +\end{ccRefConcept} +\ccRefPageEnd + +%%%%%%%% Split_2 +% ============== +\ccRefPageBegin +\begin{ccRefConcept}{ArrDirectionalTraits::Split_2} +\ccRefines{Functor} + +\ccHasModels\ccc{ArrangementDirectionalXMonotoneTraits_2::Split_2} + +\ccCreationVariable{fo} +\def\ccTagRmConstRefPair{\ccFalse}% +\ccMethod{void operator()(ArrDirectionalTraits::X_monotone_curve_2 xc, + ArrDirectionalTraits::Point_2 p, + ArrDirectionalTraits::X_monotone_curve_2& xc1, + ArrDirectionalTraits::X_monotone_curve_2& xc2);} + {accepts an input curve \ccc{xc} and a split point \ccc{p} in its + interior. It splits \ccc{xc} at the split point into two subcurves + \ccc{xc1} and \ccc{xc2}, such that \ccc{p} is \ccc{xc1}'s \emph{right} + endpoint and \ccc{xc2}'s \emph{left} endpoint. The direction of \ccc{xc} + is preserved. That is, in case \ccc{xc} is directed from left to right, + \ccc{p} becomes \ccc{xc1}'s target and \ccc{c2}'s source; + otherwise, \ccc{p} becomes \ccc{xc2}'s target and \ccc{xc1}'s source.}% +\ccTagDefaults +\end{ccRefConcept} +\ccRefPageEnd + +%%%%%%%% AreMergeable_2 +% ===================== +\ccRefPageBegin +\begin{ccRefConcept}{ArrDirectionalTraits::AreMergeable_2} +\ccRefines{Functor} + +\ccHasModels\ccc{ArrangementDirectionalXMonotoneTraits_2::Are_mergeable_2} + +\ccCreationVariable{fo} +\def\ccTagRmConstRefPair{\ccFalse}% +\ccMethod{bool operator()(ArrDirectionalTraits::X_monotone_curve_2 xc1, + ArrDirectionalTraits::X_monotone_curve_2 xc2);} + {accepts two $x$-monotone curves \ccc{xc1} and \ccc{xc2} and determines + whether they can be merged to form a single $x$-monotone curve. + \ccc{xc1} and \ccc{xc2} are mergeable if their underlying curves are + identical, they share a common endpoint, and they do not bend to form + a non-$x$-monotone curve. + \ccPrecond{The target point of \ccc{xc1} and the source point \ccc{xc2} + coincide or the source point of \ccc{xc2} and the target + point \ccc{xc2} coincide.}} +\end{ccRefConcept} +\ccRefPageEnd + +%%%%%%%% Merge_2 +% ============== +\ccRefPageBegin +\begin{ccRefConcept}{ArrDirectionalTraits::Merge_2} +\ccRefines{Functor} + +\ccHasModels\ccc{ArrangementDirectionalXMonotoneTraits_2::Merge_2} + +\ccCreationVariable{fo} +\def\ccTagRmConstRefPair{\ccFalse}% +\ccMethod{void operator()(ArrDirectionalTraits::X_monotone_curve_2 xc1, + ArrDirectionalTraits::X_monotone_curve_2 xc2, + ArrDirectionalTraits::X_monotone_curve_2& xc);} + {accepts two \emph{mergeable} $x$-monotone curves \ccc{xc1} and + \ccc{xc2} and asigns \ccc{xc} with the merged curve. If the target + point of \ccc{xc1} and the source point of \ccc{xc2} coincide; then + the source point of \ccc{xc1} and the target point of \ccc{xc2} become + the source and target points of \ccc{xc}, respectively. If the target + point of \ccc{xc2} and the source point of \ccc{xc1} coincide; then + the source point of \ccc{xc2} and the target point of \ccc{xc1} become + the source and target points of \ccc{xc}, respectively. + \ccPrecond{\ccc{are_mergeable_2}(\ccc{xc1}, \ccc{xc2}) is true.}} +\ccTagDefaults +\end{ccRefConcept} +\ccRefPageEnd + +%%%%%%%% CompareEndpointsXy_2 +% =========================== +\ccRefPageBegin +\begin{ccRefConcept}{ArrDirectionalTraits::CompareEndpointsXy_2} +\ccRefines{Functor} + +\ccHasModels\ccc{ArrangementDirectionalXMonotoneTraits_2::CompareEndpointsXy_2} + +\ccCreationVariable{fo} +\def\ccTagRmConstRefPair{\ccFalse}% +\ccMethod{Comparison_result operator()(ArrDirectionalTraits::X_monotone_curve_2 xc);} + {accepts an input curve \ccc{xc} and compares its source and target + points. It returns \ccc{SMALLER} if the curve is directed from + lexicographically left to right, and \ccc{LARGER} if it is directed + from lexicographically right to left.} + +\ccTagDefaults +\end{ccRefConcept} +\ccRefPageEnd + +%%%%%%%% ConstructOpposite_2 +% =========================== +\ccRefPageBegin +\begin{ccRefConcept}{ArrDirectionalTraits::ConstructOpposite_2} +\ccRefines{Functor} + +\ccHasModels\ccc{ArrangementDirectionalXMonotoneTraits_2::ConstructOpposite_2} + +\ccCreationVariable{fo} +\def\ccTagRmConstRefPair{\ccFalse}% +\ccMethod{ArrDirectionalTraits::X_monotone_curve_2 operator()(ArrDirectionalTraits::X_monotone_curve_2 xc);} + {accepts an $x$-monotone curve \ccc{xc} and returns its opposite curve, + namely a curve whose graph is the same as \ccc{xc}'s, and whose source and + target are swapped with respect to \ccc{xc}'s source and target.} + +\ccTagDefaults +\end{ccRefConcept} +\ccRefPageEnd diff --git a/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect.cpp b/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect.cpp index c080174f30a..0642e4e9b56 100644 --- a/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect.cpp +++ b/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect.cpp @@ -35,7 +35,7 @@ int main() { typedef CGAL::Join_input_iterator_3 Triangle_gen; Pts points( 1); // in centered cube [-1,1)^3 Triangle_gen triangle_gen( points, points, points); - CGAL::copy_n( triangle_gen, 10, std::back_inserter(triangles)); + CGAL::cpp0x::copy_n( triangle_gen, 10, std::back_inserter(triangles)); // Create the corresponding vector of bounding boxes std::vector boxes; diff --git a/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp b/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp index b3cab305fd4..640d1a31796 100644 --- a/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp +++ b/Box_intersection_d/examples/Box_intersection_d/triangle_self_intersect_pointers.cpp @@ -35,7 +35,7 @@ int main() { typedef CGAL::Join_input_iterator_3 Triangle_gen; Pts points( 1); // in centered cube [-1,1)^3 Triangle_gen triangle_gen( points, points, points); - CGAL::copy_n( triangle_gen, 10, std::back_inserter(triangles)); + CGAL::cpp0x::copy_n( triangle_gen, 10, std::back_inserter(triangles)); // Create the corresponding vector of bounding boxes std::vector boxes; diff --git a/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp b/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp index f38581d4e00..93def51c62c 100644 --- a/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp +++ b/CGAL_ipelets/demo/CGAL_ipelets/generator.cpp @@ -101,7 +101,7 @@ void generator::protected_run(int fn) switch(fn){ case 0:{//random point in a circle CGAL::Random_points_in_disc_2 gs( size); - CGAL::copy_n( gs, nbelements, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gs, nbelements, std::back_inserter(points)); } break; @@ -112,7 +112,7 @@ void generator::protected_run(int fn) case 6: case 2://points in a square : side = {CGAL::Random_points_in_square_2 gc (size); - CGAL::copy_n( gc, nbelements, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gc, nbelements, std::back_inserter(points)); } break; @@ -139,7 +139,7 @@ void generator::protected_run(int fn) typedef CGAL::Creator_uniform_2< Point_2, Segment_2> Seg_creator; typedef CGAL::Join_input_iterator_2< P1, P2, Seg_creator> Seg_iterator; Seg_iterator g( p1, p2); - CGAL::copy_n( g, nbelements, std::back_inserter(segments) ); + CGAL::cpp0x::copy_n( g, nbelements, std::back_inserter(segments) ); break; }; diff --git a/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt b/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt deleted file mode 100644 index 22ccc13909c..00000000000 --- a/Combinatorial_map/examples/Combinatorial_map/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -# Created by the script cgal_create_cmake_script -# This is the CMake script for compiling a CGAL application. - -# cmake ../ -DCMAKE_BUILD_TYPE=Debug -# ou -# cmake ../ -DCMAKE_BUILD_TYPE=Release - -project( Combinatorial_map_examples ) - -CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5) - -#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) - -SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -w -Wall -pedantic") # -Wextra") - -if ( COMMAND cmake_policy ) - cmake_policy( SET CMP0003 NEW ) -endif() - -# For the problem with valgrind -# add_definition(-DCGAL_DISABLE_ROUNDING_MATH_CHECK) - -find_package(CGAL QUIET COMPONENTS Core ) - -if ( CGAL_FOUND ) - - include( ${CGAL_USE_FILE} ) - - include( CGAL_CreateSingleSourceCGALProgram ) - include_directories(BEFORE ../../include) - - create_single_source_cgal_program( "map_3_simple_example.cpp" ) - create_single_source_cgal_program( "map_4_simple_example.cpp" ) - create_single_source_cgal_program( "map_3_with_colored_facets.cpp" ) - create_single_source_cgal_program( "map_3_operations.cpp" ) - create_single_source_cgal_program( "map_3_marks.cpp" ) -else() - - message(STATUS "This program requires the CGAL library, and will not be compiled.") - -endif() - diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index 4d39a7091b6..9e5c0f868dd 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -35,17 +35,6 @@ #pragma GCC diagnostic ignored "-Warray-bounds" #endif -// Temporary patch since CGAL_static_assertion_msg is not yet available. -#ifndef CGAL_static_assertion - -# define CGAL_static_assertion(EX) \ - BOOST_STATIC_ASSERT(EX) -# define CGAL_static_assertion_msg(EX,MSG) \ - BOOST_STATIC_ASSERT(EX) - -#endif -// end of temporary patch: to remove asap. - namespace CGAL { /** @file Combinatorial_map.h diff --git a/Combinatorial_map/include/CGAL/Dart.h b/Combinatorial_map/include/CGAL/Dart.h index 19fdcfd4006..3db4780d4fd 100644 --- a/Combinatorial_map/include/CGAL/Dart.h +++ b/Combinatorial_map/include/CGAL/Dart.h @@ -24,18 +24,6 @@ #include #include -// Temporary patch since CGAL_static_assertion_msg is not yet available. -#ifndef CGAL_static_assertion - -# define CGAL_static_assertion(EX) \ - BOOST_STATIC_ASSERT(EX) -# define CGAL_static_assertion_msg(EX,MSG) \ - BOOST_STATIC_ASSERT(EX) - -#endif -// end of temporary patch: to remove asap. - - namespace CGAL { /** @file Dart.h diff --git a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_utility.h b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_utility.h index 1e871349ca2..1a4eae9c65c 100644 --- a/Combinatorial_map/include/CGAL/internal/Combinatorial_map_utility.h +++ b/Combinatorial_map/include/CGAL/internal/Combinatorial_map_utility.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #ifdef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES #include @@ -650,7 +650,7 @@ struct Fill_disabled template struct Fill_type{ typedef void type; - BOOST_STATIC_ASSERT(size < 10); + CGAL_static_assertion(size < 10); }; template diff --git a/Convex_hull_3/benchmark/Convex_hull_3/compare_different_approach.cpp b/Convex_hull_3/benchmark/Convex_hull_3/compare_different_approach.cpp index 8094e016e7d..b50c1038cc1 100644 --- a/Convex_hull_3/benchmark/Convex_hull_3/compare_different_approach.cpp +++ b/Convex_hull_3/benchmark/Convex_hull_3/compare_different_approach.cpp @@ -43,7 +43,7 @@ int main(int argc,char** argv) if (argc==1){ CGAL::Random_points_in_sphere_3 gen(1.0); int nbpt=1000000; - CGAL::copy_n( gen, nbpt, std::back_inserter(points) ); + CGAL::cpp0x::copy_n( gen, nbpt, std::back_inserter(points) ); std::cout << "Using " << 1000000 << " random points in the unit ball\n"; } else{ diff --git a/Convex_hull_3/benchmark/Convex_hull_3/is_on_positive_side.cpp b/Convex_hull_3/benchmark/Convex_hull_3/is_on_positive_side.cpp index a9e37bcdd28..f9020343d45 100644 --- a/Convex_hull_3/benchmark/Convex_hull_3/is_on_positive_side.cpp +++ b/Convex_hull_3/benchmark/Convex_hull_3/is_on_positive_side.cpp @@ -157,7 +157,7 @@ int main() points.reserve(nb_pts); K::Point_3 p=*gen++,q=*gen++,r=*gen++; - CGAL::copy_n(gen,nb_pts,std::back_inserter(points)); + CGAL::cpp0x::copy_n(gen,nb_pts,std::back_inserter(points)); std::vector res0; res0.reserve(nb_pts); std::vector res1; res1.reserve(nb_pts); diff --git a/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp b/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp index 28135c29e06..3bd02fc30a5 100644 --- a/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp +++ b/Convex_hull_3/demo/Convex_hull_3/quickhull_3_demo.cpp @@ -115,7 +115,7 @@ int main(int argc, char* argv[]) Generator gen(100.0); // generate num points and copy them to a vector - CGAL::copy_n( gen, num, std::back_inserter(points) ); + CGAL::cpp0x::copy_n( gen, num, std::back_inserter(points) ); // define object to hold convex hull CGAL::Object ch_object; diff --git a/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp b/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp index 46585091a6d..1698e3e8b0f 100644 --- a/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp +++ b/Convex_hull_3/examples/Convex_hull_3/dynamic_hull_3.cpp @@ -20,7 +20,7 @@ int main() // generate 250 points randomly on a sphere of radius 100.0 // and insert them into the triangulation - CGAL::copy_n(gen, 250, std::back_inserter(points) ); + CGAL::cpp0x::copy_n(gen, 250, std::back_inserter(points) ); Delaunay T; T.insert(points.begin(), points.end()); diff --git a/Convex_hull_3/examples/Convex_hull_3/incremental_hull_3.cpp b/Convex_hull_3/examples/Convex_hull_3/incremental_hull_3.cpp index e9ecb2a274f..f9a34addbb4 100644 --- a/Convex_hull_3/examples/Convex_hull_3/incremental_hull_3.cpp +++ b/Convex_hull_3/examples/Convex_hull_3/incremental_hull_3.cpp @@ -26,7 +26,7 @@ int main() std::vector V; // generate 250 points randomly on a sphere of radius 100.0 and copy // them to a vector - CGAL::copy_n( gen, 250, std::back_inserter(V) ); + CGAL::cpp0x::copy_n( gen, 250, std::back_inserter(V) ); Polyhedron P; // define polyhedron to hold convex hull diff --git a/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp b/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp index 56551ca1bc8..273e0902a45 100644 --- a/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp +++ b/Convex_hull_3/examples/Convex_hull_3/quickhull_3.cpp @@ -32,7 +32,7 @@ int main() // generate 250 points randomly on a sphere of radius 100.0 // and copy them to a vector std::vector points; - CGAL::copy_n( gen, 250, std::back_inserter(points) ); + CGAL::cpp0x::copy_n( gen, 250, std::back_inserter(points) ); // define polyhedron to hold convex hull Polyhedron_3 poly; diff --git a/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp b/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp index a5a1ea0573d..22fa1ba2cbe 100644 --- a/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp +++ b/Convex_hull_3/test/Convex_hull_3/quick_hull_default_traits.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #ifdef CGAL_USE_LEDA @@ -29,11 +29,11 @@ using namespace CGAL::internal::Convex_hull_3; int main() { - BOOST_STATIC_ASSERT( (boost::is_same::type>::value) ); - BOOST_STATIC_ASSERT( (boost::is_same::type>::value) ); - BOOST_STATIC_ASSERT( (boost::is_same::type>::value) ); - BOOST_STATIC_ASSERT( (boost::is_same::type>::value) ); - BOOST_STATIC_ASSERT( (boost::is_same,Default_traits_for_Chull_3::type>::value) ); - BOOST_STATIC_ASSERT( (boost::is_same >::Protector,CGAL::Protect_FPU_rounding >::value) ); + CGAL_static_assertion( (boost::is_same::type>::value) ); + CGAL_static_assertion( (boost::is_same::type>::value) ); + CGAL_static_assertion( (boost::is_same::type>::value) ); + CGAL_static_assertion( (boost::is_same::type>::value) ); + CGAL_static_assertion( (boost::is_same,Default_traits_for_Chull_3::type>::value) ); + CGAL_static_assertion( (boost::is_same >::Protector,CGAL::Protect_FPU_rounding >::value) ); return 0; } diff --git a/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp b/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp index 9f98304a4c8..08b097aa6aa 100644 --- a/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp +++ b/Convex_hull_3/test/Convex_hull_3/quickhull_degenerate_test_3.cpp @@ -143,7 +143,7 @@ void test_collinear() // generate 100 points on the segment with endpoints (0,0) and (1,0) CGAL::Random_points_on_segment_2 g(Point_2(0,0), Point_2(1,0)); - CGAL::copy_n(g, 100, std::back_inserter(point_2_list)); + CGAL::cpp0x::copy_n(g, 100, std::back_inserter(point_2_list)); std::list::iterator point_it = point_2_list.begin(); point_3_list.push_back(Point_3(0,0,0)); diff --git a/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp b/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp index ed6fbaedf50..4a48e87b7f3 100644 --- a/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp +++ b/Convex_hull_3/test/Convex_hull_3/quickhull_test_3.cpp @@ -131,7 +131,7 @@ int main() std::cerr << "Testing 500 random points" << std::endl; std::vector points; Generator g(500); - CGAL::copy_n( g, num, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, num, std::back_inserter(points)); assert(points.size() == num); diff --git a/Filtered_kernel/benchmark/Filtered_kernel/orientation_3.cpp b/Filtered_kernel/benchmark/Filtered_kernel/orientation_3.cpp index c2fa744ce67..bade708b43a 100644 --- a/Filtered_kernel/benchmark/Filtered_kernel/orientation_3.cpp +++ b/Filtered_kernel/benchmark/Filtered_kernel/orientation_3.cpp @@ -31,7 +31,7 @@ int main() std::vector points; points.reserve(N); CGAL::Random_points_in_sphere_3 g( 100.0); - CGAL::copy_n( g, N, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, N, std::back_inserter(points)); timer.stop(); std::cout << "Fill vector: " << timer.time() << " sec" << std::endl; timer.reset(); diff --git a/Generator/demo/Generator/qt3/generator.cpp b/Generator/demo/Generator/qt3/generator.cpp index 7b2c6a89c58..c6dc23940cf 100644 --- a/Generator/demo/Generator/qt3/generator.cpp +++ b/Generator/demo/Generator/qt3/generator.cpp @@ -305,7 +305,7 @@ private slots: typedef CGAL::Creator_uniform_2< Point_2, Segment> Seg_creator; typedef CGAL::Join_input_iterator_2< P1, P2, Seg_creator> Seg_iterator; Seg_iterator g( p1, p2); - CGAL::copy_n( g, 200, std::back_inserter(list_of_segments)); + CGAL::cpp0x::copy_n( g, 200, std::back_inserter(list_of_segments)); something_changed(); } diff --git a/Generator/doc_tex/Generator/generators.tex b/Generator/doc_tex/Generator/generators.tex index b37c859088f..428ddff9065 100644 --- a/Generator/doc_tex/Generator/generators.tex +++ b/Generator/doc_tex/Generator/generators.tex @@ -18,7 +18,7 @@ Two kinds of point generators are provided: first, random point generators and second deterministic point generators. Most random point generators and a few deterministic point generators are provided as input iterators. The input iterators model an infinite sequence of -points. The function \ccc{CGAL::copy_n()} can be used to copy a +points. The function \ccc{CGAL::cpp0x::copy_n()} can be used to copy a finite sequence; see Section~\ref{sectionCopyN}. The iterator adaptor \ccc{Counting_iterator} can be used to create finite iterator ranges; see Section~\ref{sectionCountingIterator}. diff --git a/Generator/doc_tex/Generator_ref/Points_on_segment_2_functor.tex b/Generator/doc_tex/Generator_ref/Points_on_segment_2_functor.tex index 33a11fe8b40..b748b855fa2 100644 --- a/Generator/doc_tex/Generator_ref/Points_on_segment_2_functor.tex +++ b/Generator/doc_tex/Generator_ref/Points_on_segment_2_functor.tex @@ -54,7 +54,7 @@ spaced \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::points_on_segment} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_ball_d.tex b/Generator/doc_tex/Generator_ref/Random_points_in_ball_d.tex index c1b988ac8ec..b4f248ce594 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_ball_d.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_ball_d.tex @@ -36,7 +36,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_sphere_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_cube_3.tex b/Generator/doc_tex/Generator_ref/Random_points_in_cube_3.tex index c29ee8eb3dd..65bbc9e4079 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_cube_3.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_cube_3.tex @@ -38,7 +38,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Random_points_in_square_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_sphere_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_cube_d.tex b/Generator/doc_tex/Generator_ref/Random_points_in_cube_d.tex index 99c55b88dd4..64eaaea4ca7 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_cube_d.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_cube_d.tex @@ -38,7 +38,7 @@ For every point $ p = \ccc{*g}$ and for all $ i} \\ \ccRefIdfierPage{CGAL::Random_points_in_cube_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_disc_2.tex b/Generator/doc_tex/Generator_ref/Random_points_in_disc_2.tex index ee6edec4554..83760fa78be 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_disc_2.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_disc_2.tex @@ -39,7 +39,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Points_on_segment_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_square_2} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_sphere_3.tex b/Generator/doc_tex/Generator_ref/Random_points_in_sphere_3.tex index 779115bd2f0..00cdeb1ec45 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_sphere_3.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_sphere_3.tex @@ -38,7 +38,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_cube_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_in_square_2.tex b/Generator/doc_tex/Generator_ref/Random_points_in_square_2.tex index da018dc9616..581f783e85c 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_in_square_2.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_in_square_2.tex @@ -38,7 +38,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Points_on_segment_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_on_circle_2.tex b/Generator/doc_tex/Generator_ref/Random_points_on_circle_2.tex index 9f11d1943a2..d953efe62dc 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_on_circle_2.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_on_circle_2.tex @@ -42,7 +42,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Points_on_segment_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_on_segment_2.tex b/Generator/doc_tex/Generator_ref/Random_points_on_segment_2.tex index b054fb762f7..32a14fc8e9f 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_on_segment_2.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_on_segment_2.tex @@ -42,7 +42,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Points_on_segment_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_on_sphere_3.tex b/Generator/doc_tex/Generator_ref/Random_points_on_sphere_3.tex index d4782106696..27c6b710f88 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_on_sphere_3.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_on_sphere_3.tex @@ -41,7 +41,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Random_points_on_circle_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_cube_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_on_sphere_d.tex b/Generator/doc_tex/Generator_ref/Random_points_on_sphere_d.tex index 6e8cfc25465..7ad93a0bb26 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_on_sphere_d.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_on_sphere_d.tex @@ -41,7 +41,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Random_points_on_circle_2} \\ \ccRefIdfierPage{CGAL::Random_points_on_sphere_3} \\ diff --git a/Generator/doc_tex/Generator_ref/Random_points_on_square_2.tex b/Generator/doc_tex/Generator_ref/Random_points_on_square_2.tex index cf0a9fc3762..83725e65ea6 100644 --- a/Generator/doc_tex/Generator_ref/Random_points_on_square_2.tex +++ b/Generator/doc_tex/Generator_ref/Random_points_on_square_2.tex @@ -40,7 +40,7 @@ InputIterator \\ \ccSeeAlso -\ccRefIdfierPage{CGAL::copy_n} \\ +\ccRefIdfierPage{CGAL::cpp0x::copy_n} \\ \ccRefIdfierPage{CGAL::Counting_iterator} \\ \ccRefIdfierPage{CGAL::Points_on_segment_2} \\ \ccRefIdfierPage{CGAL::Random_points_in_disc_2} \\ diff --git a/Generator/examples/Generator/random_degenerate_point_set.cpp b/Generator/examples/Generator/random_degenerate_point_set.cpp index d63cd85e63b..db2581177db 100644 --- a/Generator/examples/Generator/random_degenerate_point_set.cpp +++ b/Generator/examples/Generator/random_degenerate_point_set.cpp @@ -20,7 +20,7 @@ int main() { // Create 600 points within a disc of radius 150. Random_points_in_disc_2 g( 150.0); - CGAL::copy_n( g, 600, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, 600, std::back_inserter(points)); // Create 200 points from a 15 x 15 grid. points_on_square_grid_2( 250.0, 200, std::back_inserter(points),Creator()); diff --git a/Generator/examples/Generator/random_grid.cpp b/Generator/examples/Generator/random_grid.cpp index d13cc88b628..df565b34c8c 100644 --- a/Generator/examples/Generator/random_grid.cpp +++ b/Generator/examples/Generator/random_grid.cpp @@ -31,7 +31,7 @@ int main() { // Create 250 points within a disc of radius 150. Random_points_in_disc_2 g( 150.0); - CGAL::copy_n( g, 250, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, 250, std::back_inserter(points)); // Check that we have really created 500 points. assert( points.size() == 500); diff --git a/Generator/examples/Generator/random_segments1.cpp b/Generator/examples/Generator/random_segments1.cpp index 158a9793da9..6fe4e366d81 100644 --- a/Generator/examples/Generator/random_segments1.cpp +++ b/Generator/examples/Generator/random_segments1.cpp @@ -35,7 +35,7 @@ int main() { typedef Creator_uniform_2< Point, Segment> Seg_creator; typedef Join_input_iterator_2< P1, P2, Seg_creator> Seg_iterator; Seg_iterator g( p1, p2); - CGAL::copy_n( g, 200, std::back_inserter(segs)); + CGAL::cpp0x::copy_n( g, 200, std::back_inserter(segs)); assert( segs.size() == 200); for ( Vector::iterator i = segs.begin(); i != segs.end(); i++){ diff --git a/Generator/include/CGAL/random_convex_set_2.h b/Generator/include/CGAL/random_convex_set_2.h index b064d137b45..b15a2a03ea7 100644 --- a/Generator/include/CGAL/random_convex_set_2.h +++ b/Generator/include/CGAL/random_convex_set_2.h @@ -52,7 +52,7 @@ random_convex_set_2( std::size_t n, using std::partial_sum; using std::less; using std::max_element; - using CGAL::copy_n; + using CGAL::cpp0x::copy_n; typedef typename Traits::Point_2 Point_2; typedef typename Traits::FT FT; @@ -71,7 +71,7 @@ random_convex_set_2( std::size_t n, // build random point set: Container points; points.reserve( n); - CGAL::copy_n( pg, n, back_inserter( points)); + CGAL::cpp0x::copy_n( pg, n, back_inserter( points)); // compute centroid of points: Point_2 centroid = CGAL::centroid( points.begin(), points.end(), t ); diff --git a/Generator/test/Generator/test_generators.cpp b/Generator/test/Generator/test_generators.cpp index 384cf662fb7..ff5c76de963 100644 --- a/Generator/test/Generator/test_generators.cpp +++ b/Generator/test/Generator/test_generators.cpp @@ -56,7 +56,7 @@ void test_point_generators_2() { std::vector points; points.reserve(1000); Random_points_in_disc_2 g1( 100.0); - CGAL::copy_n( g1, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g1, 100, std::back_inserter(points)); Random_points_on_circle_2 g2( 100.0); Random_points_in_square_2 g3( 100.0); Random_points_on_square_2 g4( 100.0); @@ -65,11 +65,11 @@ void test_point_generators_2() { Points_on_segment_2 g5a( Point_2( 50,-50), Point_2(-50, 50), 50); - CGAL::copy_n( g2, 100, std::back_inserter(points)); - CGAL::copy_n( g3, 100, std::back_inserter(points)); - CGAL::copy_n( g4, 100, std::back_inserter(points)); - CGAL::copy_n( g5, 50, std::back_inserter(points)); - CGAL::copy_n( g5a, 50, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g2, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g3, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g4, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g5, 50, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g5a, 50, std::back_inserter(points)); points_on_square_grid_2( 50.0, (std::size_t)1, std::back_inserter(points), Creator()); points_on_square_grid_2( 50.0, (std::size_t)2, @@ -90,7 +90,7 @@ void test_point_generators_2() { // the 100 x 100 square. 10 pixel perturbation allowed. Random_points_in_square_2 g6( 90.0); int count = 100 ; - CGAL::copy_n( g6, count, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g6, count, std::back_inserter(points)); std::vector::iterator i2 = points.end(); std::vector::iterator i1 = i2 ; std::advance(i1,-count); @@ -117,11 +117,11 @@ void test_point_generators_3() { std::vector points; points.reserve(500); Random_points_in_sphere_3 g1( 100.0); - CGAL::copy_n( g1, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g1, 100, std::back_inserter(points)); Random_points_on_sphere_3 g2( 100.0); Random_points_in_cube_3 g3( 100.0); - CGAL::copy_n( g2, 100, std::back_inserter(points)); - CGAL::copy_n( g3, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g2, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g3, 100, std::back_inserter(points)); points_on_cube_grid_3( 50.0, (std::size_t)1, std::back_inserter(points), Creator()); points_on_cube_grid_3( 50.0, (std::size_t)2, @@ -171,7 +171,7 @@ void test_point_generators_d() // 100 random points in dim 36 std::cout<<" cube dim 36"< gen (36, 1.0); - CGAL::copy_n( gen, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gen, 100, std::back_inserter(points)); i+=100; std::cout<<" done"< gen (4, 100.0); - CGAL::copy_n( gen, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gen, 100, std::back_inserter(points)); std::cout<<" done"< gen (3, 1.0); - CGAL::copy_n( gen, nb_g, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gen, nb_g, std::back_inserter(points)); std::cout<<" done"< gen (26, 1.0); - CGAL::copy_n( gen, 100, std::back_inserter(points)); + CGAL::cpp0x::copy_n( gen, 100, std::back_inserter(points)); std::cout<<" done"< Seg_creator; typedef CGAL::Join_input_iterator_2< Rpos_generator, Rpoc_generator, Seg_creator> Seg_iterator; Seg_iterator g( rpos, rpoc); - CGAL::copy_n( g, 200, std::back_inserter(segments)); + CGAL::cpp0x::copy_n( g, 200, std::back_inserter(segments)); emit(changed()); } diff --git a/Installation/AUTHORS b/Installation/AUTHORS index 4c74338eb1b..3137dea9eee 100644 --- a/Installation/AUTHORS +++ b/Installation/AUTHORS @@ -15,6 +15,7 @@ Nicolas Carrez Frédéric Cazals Raphaëlle Chaine Tran Kai Frank Da +Guillaume Damiand Christophe Delage Olivier Devillers Katrin Dobrindt diff --git a/Installation/changes.html b/Installation/changes.html index 11776392008..d439c815cd8 100644 --- a/Installation/changes.html +++ b/Installation/changes.html @@ -98,6 +98,20 @@ Number of lines of code of CGAL

+

Release 3.10

+
+

Release date: XXX 2011

+ +

+CGAL 3.10 offers the following improvements and new functionality :

+ +

AABB tree

+
    +
  • Document constness of member functions of the AABB_tree class.
  • +
  • The class AABB_tree is now guaranteed to be read-only thread-safe. As usual in CGAL, + this small overhead introduced for thread-safety can be deactivated by defining CGAL_HAS_NO_THREADS.
  • +
+

Release 3.9

Release date: XXX 2011

diff --git a/Installation/config/testfiles/CGAL_CFG_NO_CPP0X_COPY_N.cpp b/Installation/config/testfiles/CGAL_CFG_NO_CPP0X_COPY_N.cpp new file mode 100644 index 00000000000..562effc9c69 --- /dev/null +++ b/Installation/config/testfiles/CGAL_CFG_NO_CPP0X_COPY_N.cpp @@ -0,0 +1,39 @@ +// Copyright (c) 2011 GeometryFactory (France). All rights reserved. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// 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. +// +// 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) : Phillip Möller + +//| If a compiler does not support std::copy_n (from C++0x) +//| CGAL_CFG_NO_CPP0X_COPY_N is set. + +#undef NDEBUG +#include +#include + +int main() +{ + int arr[] = {1, 2, 3, 4, 5 }; + int arr2[] = {0, 0, 0, 0, 0 }; + std::copy_n(arr, 3, arr2); + + assert(arr2[0] == 1); + assert(arr2[1] == 2); + assert(arr2[2] == 3); + assert(arr2[3] == 0); + assert(arr2[4] == 0); + return 0; +} diff --git a/Installation/src/CMakeLists.txt b/Installation/src/CMakeLists.txt index 25ee817a177..cec8c05cd60 100644 --- a/Installation/src/CMakeLists.txt +++ b/Installation/src/CMakeLists.txt @@ -12,7 +12,13 @@ macro (build_cgal_library LIBRARY_NAME LIBRARY_DIR_NAME ADDITIONAL_FILES) foreach(source ${CGAL_LIBRARY_SOURCE_FILES}) - file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp "\#include \"${source}\"\n") + # It may happen that a file all_files.cpp had been created in-source by + # a previous in-source build. We certainly do not want to include that + # file in the new all_files.cpp because .cpp files would be included + # twice, and that breaks the one-definition rule (ODR). + if(NOT source MATCHES ".*/all_files.cpp") + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/all_files.cpp "\#include \"${source}\"\n") + endif() endforeach() # message(STATUS "Additional files: ${ADDITIONAL_FILES}") diff --git a/Interpolation/demo/Interpolation/surface_voronoi.cpp b/Interpolation/demo/Interpolation/surface_voronoi.cpp index 7737d73ec3b..1b5431d2211 100644 --- a/Interpolation/demo/Interpolation/surface_voronoi.cpp +++ b/Interpolation/demo/Interpolation/surface_voronoi.cpp @@ -92,7 +92,7 @@ void generate_sphere_points(const int& n, //the test point + normal Point &p, Vector &normal){ CGAL::Random_points_on_sphere_3 g(r); - CGAL::copy_n( g, n, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n, std::back_inserter(points)); p = Point(0,0, r); normal = Vector(p - CGAL::ORIGIN); } @@ -108,7 +108,7 @@ void generate_cylinder_points(const int& n, Point_2_vector points_2; points_2.reserve(n); CGAL::Random_points_on_circle_2 g(r); - CGAL::copy_n( g, n , std::back_inserter(points_2)); + CGAL::cpp0x::copy_n( g, n , std::back_inserter(points_2)); CGAL::Random random; double h; diff --git a/Interpolation/examples/Interpolation/interpolation_2.cpp b/Interpolation/examples/Interpolation/interpolation_2.cpp index a345174897d..c67aeeeb1f9 100644 --- a/Interpolation/examples/Interpolation/interpolation_2.cpp +++ b/Interpolation/examples/Interpolation/interpolation_2.cpp @@ -49,7 +49,7 @@ int main() // Create n+m-4 points within a disc of radius 2 double r_d = 3; CGAL::Random_points_in_disc_2 g(r_d ); - CGAL::copy_n( g, n+m, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n+m, std::back_inserter(points)); Delaunay_triangulation T; diff --git a/Interpolation/examples/Interpolation/surface_neighbor_coordinates_3.cpp b/Interpolation/examples/Interpolation/surface_neighbor_coordinates_3.cpp index 84f4291551a..333c68708fb 100644 --- a/Interpolation/examples/Interpolation/surface_neighbor_coordinates_3.cpp +++ b/Interpolation/examples/Interpolation/surface_neighbor_coordinates_3.cpp @@ -25,7 +25,7 @@ int main() std::cout << "Generate " << n << " random points on a sphere." << std::endl; CGAL::Random_points_on_sphere_3 g(1); - CGAL::copy_n( g, n, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n, std::back_inserter(points)); Point_3 p(1, 0,0); Vector_3 normal(p-CGAL::ORIGIN); diff --git a/Interpolation/test/Interpolation/include/CGAL/_test_interpolation_functions_2.cpp b/Interpolation/test/Interpolation/include/CGAL/_test_interpolation_functions_2.cpp index 5a76f8885ab..1832dfe634e 100644 --- a/Interpolation/test/Interpolation/include/CGAL/_test_interpolation_functions_2.cpp +++ b/Interpolation/test/Interpolation/include/CGAL/_test_interpolation_functions_2.cpp @@ -218,7 +218,7 @@ _test_interpolation_functions_2_delaunay( const Triangul &, // Create n+m-4 points within a disc of radius 2 CGAL::Random_points_in_square_2 g(r); - CGAL::copy_n( g, n+m, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n+m, std::back_inserter(points)); CGAL::Random random; diff --git a/Interpolation/test/Interpolation/include/CGAL/_test_regular_neighbors_2.cpp b/Interpolation/test/Interpolation/include/CGAL/_test_regular_neighbors_2.cpp index 9a2e9e63ed3..00612e909c5 100644 --- a/Interpolation/test/Interpolation/include/CGAL/_test_regular_neighbors_2.cpp +++ b/Interpolation/test/Interpolation/include/CGAL/_test_regular_neighbors_2.cpp @@ -87,7 +87,7 @@ _test_regular_neighbors_2( const Triangul & ) // Create n+m-4 points within a disc of radius 2 CGAL::Random_points_in_square_2 g(r); - CGAL::copy_n( g, n+m, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n+m, std::back_inserter(points)); CGAL::Random random; diff --git a/Interpolation/test/Interpolation/include/CGAL/_test_surface_neighbors_3.cpp b/Interpolation/test/Interpolation/include/CGAL/_test_surface_neighbors_3.cpp index cc54335e23b..19c39f06ab7 100644 --- a/Interpolation/test/Interpolation/include/CGAL/_test_surface_neighbors_3.cpp +++ b/Interpolation/test/Interpolation/include/CGAL/_test_surface_neighbors_3.cpp @@ -316,7 +316,7 @@ _test_surface_neighbors_3_sphere( const Triangul & ) // Create n+m-4 points on a sphere of radius 2 CGAL::Random_points_on_sphere_3 g(r); - CGAL::copy_n( g, n+m, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, n+m, std::back_inserter(points)); for(int i=0; i()); else{ CGAL::Random_points_in_square_2 g(r); - CGAL::copy_n( g, n, std::back_inserter(points_2_data)); + CGAL::cpp0x::copy_n( g, n, std::back_inserter(points_2_data)); } for(int i=0; i < n; i++){ T.insert(transform(Point(points_2_data[i].x(),points_2_data[i].y(), -r))); @@ -376,7 +376,7 @@ _test_surface_neighbors_3_cube(const Triangul &, const Transformation& std::vector points_2_test; points_2_test.reserve(m); CGAL::Random_points_in_square_2 g2(r-1.0); - CGAL::copy_n( g2, m, std::back_inserter(points_2_test)); + CGAL::cpp0x::copy_n( g2, m, std::back_inserter(points_2_test)); int k=0; for(int i=0;i #endif -#include +#include namespace CGAL { // TODO: rename this into MPFI_traits ? diff --git a/Interval_support/include/CGAL/Test/_test_bigfloat_interval_traits.h b/Interval_support/include/CGAL/Test/_test_bigfloat_interval_traits.h index f515bb08b25..98e7b3e0166 100644 --- a/Interval_support/include/CGAL/Test/_test_bigfloat_interval_traits.h +++ b/Interval_support/include/CGAL/Test/_test_bigfloat_interval_traits.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -46,7 +46,7 @@ void test_bigfloat_interval_traits() { typedef typename BFIT::Is_bigfloat_interval Is_bigfloat_interval; // using CGAL::Tag_true; - BOOST_STATIC_ASSERT(( ::boost::is_same< Is_bigfloat_interval, CGAL::Tag_true>::value)); + CGAL_static_assertion(( ::boost::is_same< Is_bigfloat_interval, CGAL::Tag_true>::value)); const typename BFIT::Construct construct = typename BFIT::Construct(); const typename BFIT::Set_precision set_precision = typename BFIT::Set_precision(); diff --git a/Interval_support/include/CGAL/Test/_test_convert_to_bfi.h b/Interval_support/include/CGAL/Test/_test_convert_to_bfi.h index fb210e397de..c51e37d05dd 100644 --- a/Interval_support/include/CGAL/Test/_test_convert_to_bfi.h +++ b/Interval_support/include/CGAL/Test/_test_convert_to_bfi.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -46,7 +46,7 @@ void test_convert_to_bfi_from(BFI,CGAL::Null_tag){return;} template void test_convert_to_bfi_from(BFI,From){ typedef typename CGAL::Coercion_traits::Type CT_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); assert(CGAL::convert_to_bfi(From(0)) == BFI(0)); assert(CGAL::convert_to_bfi(From(1)) == BFI(1)); assert(CGAL::convert_to_bfi(From(2)) == BFI(2)); diff --git a/Interval_support/include/CGAL/Test/_test_interval_traits.h b/Interval_support/include/CGAL/Test/_test_interval_traits.h index b98bc26dbdb..12f7f9e482c 100644 --- a/Interval_support/include/CGAL/Test/_test_interval_traits.h +++ b/Interval_support/include/CGAL/Test/_test_interval_traits.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -42,7 +42,7 @@ template void test_with_empty_interval(CGAL::Tag_false) { typedef CGAL::Interval_traits IT; typedef typename IT::Empty Empty; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (::boost::is_same< Empty, CGAL::Null_functor>::value)); // this part chages in case we allow empty intersection @@ -80,8 +80,8 @@ void test_interval_traits() { typedef typename IT::With_empty_interval With_empty_interval; using CGAL::Tag_true; - BOOST_STATIC_ASSERT(( ::boost::is_same< Is_interval, Tag_true>::value)); - BOOST_STATIC_ASSERT(( ::boost::is_same< Interval_, Interval>::value)); + CGAL_static_assertion(( ::boost::is_same< Is_interval, Tag_true>::value)); + CGAL_static_assertion(( ::boost::is_same< Interval_, Interval>::value)); test_with_empty_interval(With_empty_interval()); diff --git a/Kernel_23/include/CGAL/Circle_2.h b/Kernel_23/include/CGAL/Circle_2.h index 208d387a5d6..0c2a451823b 100644 --- a/Kernel_23/include/CGAL/Circle_2.h +++ b/Kernel_23/include/CGAL/Circle_2.h @@ -25,7 +25,7 @@ #ifndef CGAL_CIRCLE_2_H #define CGAL_CIRCLE_2_H -#include +#include #include #include #include @@ -42,7 +42,7 @@ class Circle_2 : public R_::Kernel_base::Circle_2 typedef typename R_::Aff_transformation_2 Aff_transformation_2; typedef Circle_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Circle_3.h b/Kernel_23/include/CGAL/Circle_3.h index 16c347bbfd0..82a7c7ff0f5 100644 --- a/Kernel_23/include/CGAL/Circle_3.h +++ b/Kernel_23/include/CGAL/Circle_3.h @@ -30,7 +30,7 @@ #ifndef CGAL_CIRCLE_3_H #define CGAL_CIRCLE_3_H -#include +#include #include #include #include @@ -52,7 +52,7 @@ template typedef typename R_::Direction_3 Direction_3; typedef Circle_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Direction_2.h b/Kernel_23/include/CGAL/Direction_2.h index 8b978fea446..b470330882b 100644 --- a/Kernel_23/include/CGAL/Direction_2.h +++ b/Kernel_23/include/CGAL/Direction_2.h @@ -24,7 +24,7 @@ #ifndef CGAL_DIRECTION_2_H #define CGAL_DIRECTION_2_H -#include +#include #include #include #include @@ -44,7 +44,7 @@ class Direction_2 : public R_::Kernel_base::Direction_2 typedef typename R_::Kernel_base::Direction_2 RDirection_2; typedef Direction_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Direction_3.h b/Kernel_23/include/CGAL/Direction_3.h index 76ffe708c1f..568d2e2ea7c 100644 --- a/Kernel_23/include/CGAL/Direction_3.h +++ b/Kernel_23/include/CGAL/Direction_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_DIRECTION_3_H #define CGAL_DIRECTION_3_H -#include +#include #include #include #include @@ -43,7 +43,7 @@ class Direction_3 : public R_::Kernel_base::Direction_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Direction_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Iso_cuboid_3.h b/Kernel_23/include/CGAL/Iso_cuboid_3.h index faddad5472e..07657844f31 100644 --- a/Kernel_23/include/CGAL/Iso_cuboid_3.h +++ b/Kernel_23/include/CGAL/Iso_cuboid_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_ISO_CUBOID_3_H #define CGAL_ISO_CUBOID_3_H -#include +#include #include #include #include @@ -40,7 +40,7 @@ class Iso_cuboid_3 : public R_::Kernel_base::Iso_cuboid_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Iso_cuboid_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Iso_rectangle_2.h b/Kernel_23/include/CGAL/Iso_rectangle_2.h index 3875e377d86..3d4ea099575 100644 --- a/Kernel_23/include/CGAL/Iso_rectangle_2.h +++ b/Kernel_23/include/CGAL/Iso_rectangle_2.h @@ -24,7 +24,7 @@ #ifndef CGAL_ISO_RECTANGLE_2_H #define CGAL_ISO_RECTANGLE_2_H -#include +#include #include #include #include @@ -41,7 +41,7 @@ class Iso_rectangle_2 : public R_::Kernel_base::Iso_rectangle_2 typedef typename R_::Aff_transformation_2 Aff_transformation_2; typedef Iso_rectangle_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Line_2.h b/Kernel_23/include/CGAL/Line_2.h index b9a892faa92..d08a4225511 100644 --- a/Kernel_23/include/CGAL/Line_2.h +++ b/Kernel_23/include/CGAL/Line_2.h @@ -24,7 +24,7 @@ #ifndef CGAL_LINE_2_H #define CGAL_LINE_2_H -#include +#include #include #include #include @@ -45,7 +45,7 @@ class Line_2 : public R_::Kernel_base::Line_2 typedef typename R_::Kernel_base::Line_2 RLine_2; typedef Line_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Line_3.h b/Kernel_23/include/CGAL/Line_3.h index 7d1f35baa83..a32dbac4d55 100644 --- a/Kernel_23/include/CGAL/Line_3.h +++ b/Kernel_23/include/CGAL/Line_3.h @@ -25,7 +25,7 @@ #ifndef CGAL_LINE_3_H #define CGAL_LINE_3_H -#include +#include #include #include #include @@ -45,7 +45,7 @@ class Line_3 : public R_::Kernel_base::Line_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Line_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Plane_3.h b/Kernel_23/include/CGAL/Plane_3.h index e2ac2b35e23..9cf4903120c 100644 --- a/Kernel_23/include/CGAL/Plane_3.h +++ b/Kernel_23/include/CGAL/Plane_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_PLANE_3_H #define CGAL_PLANE_3_H -#include +#include #include #include #include @@ -46,7 +46,7 @@ class Plane_3 : public R_::Kernel_base::Plane_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Plane_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Point_2.h b/Kernel_23/include/CGAL/Point_2.h index c1fcca5c03f..27ee6c40d63 100644 --- a/Kernel_23/include/CGAL/Point_2.h +++ b/Kernel_23/include/CGAL/Point_2.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include @@ -43,7 +43,7 @@ class Point_2 : public R_::Kernel_base::Point_2 typedef typename R_::Kernel_base::Point_2 RPoint_2; typedef Point_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Point_3.h b/Kernel_23/include/CGAL/Point_3.h index 3e8266a08c7..66b8a242c9c 100644 --- a/Kernel_23/include/CGAL/Point_3.h +++ b/Kernel_23/include/CGAL/Point_3.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include @@ -44,7 +44,7 @@ class Point_3 : public R_::Kernel_base::Point_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Point_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Ray_2.h b/Kernel_23/include/CGAL/Ray_2.h index bf1af8bab42..b6b37372380 100644 --- a/Kernel_23/include/CGAL/Ray_2.h +++ b/Kernel_23/include/CGAL/Ray_2.h @@ -24,7 +24,7 @@ #ifndef CGAL_RAY_2_H #define CGAL_RAY_2_H -#include +#include #include #include #include @@ -46,7 +46,7 @@ class Ray_2 : public R_::Kernel_base::Ray_2 typedef typename R_::Kernel_base::Ray_2 RRay_2; typedef Ray_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Ray_3.h b/Kernel_23/include/CGAL/Ray_3.h index a7636d28c5f..c997765085e 100644 --- a/Kernel_23/include/CGAL/Ray_3.h +++ b/Kernel_23/include/CGAL/Ray_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_RAY_3_H #define CGAL_RAY_3_H -#include +#include #include #include #include @@ -43,7 +43,7 @@ class Ray_3 : public R_::Kernel_base::Ray_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Ray_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Segment_2.h b/Kernel_23/include/CGAL/Segment_2.h index d2c1f9b4d96..db0e9eb6740 100644 --- a/Kernel_23/include/CGAL/Segment_2.h +++ b/Kernel_23/include/CGAL/Segment_2.h @@ -24,7 +24,7 @@ #ifndef CGAL_SEGMENT_2_H #define CGAL_SEGMENT_2_H -#include +#include #include #include #include @@ -45,7 +45,7 @@ class Segment_2 : public R_::Kernel_base::Segment_2 typedef typename R_::Kernel_base::Segment_2 RSegment_2; typedef Segment_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Segment_3.h b/Kernel_23/include/CGAL/Segment_3.h index d6f378adc46..bf52a886beb 100644 --- a/Kernel_23/include/CGAL/Segment_3.h +++ b/Kernel_23/include/CGAL/Segment_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_SEGMENT_3_H #define CGAL_SEGMENT_3_H -#include +#include #include #include #include @@ -44,7 +44,7 @@ class Segment_3 : public R_::Kernel_base::Segment_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Segment_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Sphere_3.h b/Kernel_23/include/CGAL/Sphere_3.h index a73b9e95747..b835fcc70c9 100644 --- a/Kernel_23/include/CGAL/Sphere_3.h +++ b/Kernel_23/include/CGAL/Sphere_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_SPHERE_3_H #define CGAL_SPHERE_3_H -#include +#include #include #include #include @@ -43,7 +43,7 @@ class Sphere_3 : public R_::Kernel_base::Sphere_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Sphere_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Tetrahedron_3.h b/Kernel_23/include/CGAL/Tetrahedron_3.h index bfaf2a2b283..1497b274004 100644 --- a/Kernel_23/include/CGAL/Tetrahedron_3.h +++ b/Kernel_23/include/CGAL/Tetrahedron_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_TETRAHEDRON_3_H #define CGAL_TETRAHEDRON_3_H -#include +#include #include #include #include @@ -39,7 +39,7 @@ class Tetrahedron_3 : public R_::Kernel_base::Tetrahedron_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Tetrahedron_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Triangle_2.h b/Kernel_23/include/CGAL/Triangle_2.h index c6cc26678b8..2bb82118163 100644 --- a/Kernel_23/include/CGAL/Triangle_2.h +++ b/Kernel_23/include/CGAL/Triangle_2.h @@ -24,7 +24,7 @@ #ifndef CGAL_TRIANGLE_2_H #define CGAL_TRIANGLE_2_H -#include +#include #include #include #include @@ -40,7 +40,7 @@ class Triangle_2 : public R_::Kernel_base::Triangle_2 typedef typename R_::Kernel_base::Triangle_2 RTriangle_2; typedef Triangle_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Triangle_3.h b/Kernel_23/include/CGAL/Triangle_3.h index 7ab023c0264..6556e8a8434 100644 --- a/Kernel_23/include/CGAL/Triangle_3.h +++ b/Kernel_23/include/CGAL/Triangle_3.h @@ -24,7 +24,7 @@ #ifndef CGAL_TRIANGLE_3_H #define CGAL_TRIANGLE_3_H -#include +#include #include #include #include @@ -42,7 +42,7 @@ class Triangle_3 : public R_::Kernel_base::Triangle_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Triangle_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Vector_2.h b/Kernel_23/include/CGAL/Vector_2.h index e127fd46278..f7cce5fdb3a 100644 --- a/Kernel_23/include/CGAL/Vector_2.h +++ b/Kernel_23/include/CGAL/Vector_2.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include #include @@ -48,7 +48,7 @@ class Vector_2 : public R_::Kernel_base::Vector_2 typedef typename R_::Kernel_base::Vector_2 RVector_2; typedef Vector_2 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kernel_23/include/CGAL/Vector_3.h b/Kernel_23/include/CGAL/Vector_3.h index 65ef9683aba..e9682bb5934 100644 --- a/Kernel_23/include/CGAL/Vector_3.h +++ b/Kernel_23/include/CGAL/Vector_3.h @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -48,7 +48,7 @@ class Vector_3 : public R_::Kernel_base::Vector_3 typedef typename R_::Aff_transformation_3 Aff_transformation_3; typedef Vector_3 Self; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); public: diff --git a/Kinetic_data_structures/include/CGAL/Kinetic/Default_instantaneous_kernel.h b/Kinetic_data_structures/include/CGAL/Kinetic/Default_instantaneous_kernel.h index 08ffcc70089..9e09f492a10 100644 --- a/Kinetic_data_structures/include/CGAL/Kinetic/Default_instantaneous_kernel.h +++ b/Kinetic_data_structures/include/CGAL/Kinetic/Default_instantaneous_kernel.h @@ -246,9 +246,9 @@ public: typedef typename Static_kernel::FT NT; typedef typename Traits::Simulator::Time Time; - BOOST_STATIC_ASSERT((boost::is_convertible::value)); - BOOST_STATIC_ASSERT((boost::is_convertible::value)); - BOOST_STATIC_ASSERT((boost::is_convertible::value)); + CGAL_static_assertion((boost::is_convertible::value)); + CGAL_static_assertion((boost::is_convertible::value)); Default_instantaneous_kernel(const Traits &tr): diff --git a/Kinetic_data_structures/include/CGAL/Kinetic/internal/Instantaneous_adaptor.h b/Kinetic_data_structures/include/CGAL/Kinetic/internal/Instantaneous_adaptor.h index 307a6e04608..cd386403eb3 100644 --- a/Kinetic_data_structures/include/CGAL/Kinetic/internal/Instantaneous_adaptor.h +++ b/Kinetic_data_structures/include/CGAL/Kinetic/internal/Instantaneous_adaptor.h @@ -36,7 +36,7 @@ class Instantaneous_adaptor { typedef typename Rep::Time Time; - BOOST_STATIC_ASSERT((boost::is_convertible::value)); + CGAL_static_assertion((boost::is_convertible::value)); public: Instantaneous_adaptor(typename Rep::Handle rep, Static_predicate pred, diff --git a/Kinetic_data_structures/include/CGAL/Polynomial/basic.h b/Kinetic_data_structures/include/CGAL/Polynomial/basic.h index 23241965068..52c9dee5f0c 100644 --- a/Kinetic_data_structures/include/CGAL/Polynomial/basic.h +++ b/Kinetic_data_structures/include/CGAL/Polynomial/basic.h @@ -23,7 +23,7 @@ #include #include -#include +#include /*! \file CGAL/Polynomial/basic.h The file which defines the basic @@ -167,7 +167,7 @@ inline Extended_sign extended_sign(const NT &nt) template inline Rt infinity() { - //BOOST_STATIC_ASSERT(std::numeric_limits::is_specialized); + //CGAL_static_assertion(std::numeric_limits::is_specialized); if (std::numeric_limits::has_infinity) return std::numeric_limits::infinity(); else return (std::numeric_limits::max)(); } diff --git a/Matrix_search/examples/Matrix_search/rectangular_p_center_2.cpp b/Matrix_search/examples/Matrix_search/rectangular_p_center_2.cpp index cd2167a71af..e1b997f5294 100644 --- a/Matrix_search/examples/Matrix_search/rectangular_p_center_2.cpp +++ b/Matrix_search/examples/Matrix_search/rectangular_p_center_2.cpp @@ -24,7 +24,7 @@ int main() CGAL::set_pretty_mode(std::cout); Cont points; - CGAL::copy_n(Generator(1), n, std::back_inserter(points)); + CGAL::cpp0x::copy_n(Generator(1), n, std::back_inserter(points)); std::cout << "Generated Point Set:\n"; std::copy(points.begin(), points.end(), cout_ip); diff --git a/Matrix_search/test/Matrix_search/rectangular_p_center_2_random1_test.cpp b/Matrix_search/test/Matrix_search/rectangular_p_center_2_random1_test.cpp index 50a6583d16f..8975826f1a7 100644 --- a/Matrix_search/test/Matrix_search/rectangular_p_center_2_random1_test.cpp +++ b/Matrix_search/test/Matrix_search/rectangular_p_center_2_random1_test.cpp @@ -174,7 +174,7 @@ main(int argc, char* argv[]) cerr << "random seed is " << random_seed << endl; #endif // CGAL_PCENTER_NO_OUTPUT PCont input_points; - CGAL::copy_n(Point_generator(1, rnd), + CGAL::cpp0x::copy_n(Point_generator(1, rnd), number_of_points, back_inserter(input_points)); diff --git a/Matrix_search/test/Matrix_search/rectangular_p_center_2_random2_test.cpp b/Matrix_search/test/Matrix_search/rectangular_p_center_2_random2_test.cpp index 39ec75ce055..444f457d790 100644 --- a/Matrix_search/test/Matrix_search/rectangular_p_center_2_random2_test.cpp +++ b/Matrix_search/test/Matrix_search/rectangular_p_center_2_random2_test.cpp @@ -197,7 +197,7 @@ main(int argc, char* argv[]) // generate a random cluster of size number_of_points: PCont input_points; - CGAL::copy_n(ptgen, + CGAL::cpp0x::copy_n(ptgen, number_of_points, back_inserter(input_points)); diff --git a/Min_annulus_d/web/Min_annulus_d.aw b/Min_annulus_d/web/Min_annulus_d.aw index 382bd860e84..5d00bea6173 100644 --- a/Min_annulus_d/web/Min_annulus_d.aw +++ b/Min_annulus_d/web/Min_annulus_d.aw @@ -1611,7 +1611,7 @@ or sphere, respectively. @macro (3) = @begin std::vector points_@1; points_@1.reserve( 100); - CGAL::copy_n( CGAL::Random_points_on_@3_@2( 0x100000), + CGAL::cpp0x::copy_n( CGAL::Random_points_on_@3_@2( 0x100000), 100, std::back_inserter( points_@1)); @end diff --git a/Minkowski_sum_2/benchmark/Minkowski_sum_2/print_utils.h b/Minkowski_sum_2/benchmark/Minkowski_sum_2/print_utils.h new file mode 100644 index 00000000000..3b030eb7bac --- /dev/null +++ b/Minkowski_sum_2/benchmark/Minkowski_sum_2/print_utils.h @@ -0,0 +1,53 @@ +#ifndef _PRINT_UTILS_H_ +#define _PRINT_UTILS_H_ + +#include +#include + +//----------------------------------------------------------------------------- +// Pretty-print a CGAL polygon. +// +template +void print_polygon (const CGAL::Polygon_2& P) +{ + typename CGAL::Polygon_2::Vertex_const_iterator vit; + + std::cout << "[ " << P.size() << " vertices:"; + for (vit = P.vertices_begin(); vit != P.vertices_end(); ++vit) + std::cout << " (" << *vit << ')'; + std::cout << " ]" << std::endl; + + return; +} + +//----------------------------------------------------------------------------- +// Pretty-print a polygon with holes. +// +template +void print_polygon_with_holes + (const CGAL::Polygon_with_holes_2& pwh) +{ + if (! pwh.is_unbounded()) + { + std::cout << "{ Outer boundary = "; + print_polygon (pwh.outer_boundary()); + } + else + std::cout << "{ Unbounded polygon." << std::endl; + + typename CGAL::Polygon_with_holes_2:: + Hole_const_iterator hit; + unsigned int k = 1; + + std::cout << " " << pwh.number_of_holes() << " holes:" << std::endl; + for (hit = pwh.holes_begin(); hit != pwh.holes_end(); ++hit, ++k) + { + std::cout << " Hole #" << k << " = "; + print_polygon (*hit); + } + std::cout << " }" << std::endl; + + return; +} + +#endif diff --git a/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp b/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp new file mode 100644 index 00000000000..f204e2c88ab --- /dev/null +++ b/Minkowski_sum_2/benchmark/Minkowski_sum_2/sum_by_decomposition.cpp @@ -0,0 +1,70 @@ +//! \file examples/Minkowski_sum_2/sum_by_decomposition.cpp +// Computing the Minkowski sum of two non-convex polygons read from a file +// using the small-side angle-bisector decomposition strategy. + +#include +#include +#include +#include +#include +#include +#include "print_utils.h" + +struct Kernel : public CGAL::Exact_predicates_exact_constructions_kernel {}; + +typedef Kernel::Point_2 Point_2; +typedef CGAL::Polygon_2 Polygon_2; +typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; + +int main (int argc, char * argv[]) +{ + CGAL::Timer t_mink_sum; + + if (argc < 3) + { + std::cerr << "Usage: " << argv[0] + << " " + << std::endl; + return (1); + } + + std::ifstream in_file1 (argv[1]); + + if (! in_file1.is_open()) + { + std::cerr << "Failed to open the input file 1." << std::endl; + return (1); + } + + // Read the two polygons from the files and compute their Minkowski sum. + Polygon_2 P, Q; + + in_file1 >> P; + + in_file1.close(); + + std::ifstream in_file2 (argv[2]); + + if (! in_file2.is_open()) + { + std::cerr << "Failed to open the input file 2." << std::endl; + return (1); + } + + in_file2 >> Q; + + in_file2.close(); + + // Compute the Minkowski sum using the decomposition approach. + CGAL::Small_side_angle_bisector_decomposition_2 ssab_decomp; + + t_mink_sum.start(); + + Polygon_with_holes_2 sum = minkowski_sum_2 (P, Q, ssab_decomp); + + t_mink_sum.stop(); + + std::cout << "Done! Time:" << t_mink_sum.time() << " seconds\n P (+) Q = "; print_polygon_with_holes (sum); + + return (0); +} diff --git a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h index 72b5c4ba836..d37d74997d8 100644 --- a/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h +++ b/Minkowski_sum_2/include/CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h @@ -20,9 +20,12 @@ #define CGAL_MINKOWSKI_SUM_DECOMP_2_H #include -#include -#include -#include +#include + +#include +#include +#include +#include namespace CGAL { @@ -31,12 +34,14 @@ namespace CGAL { * their decomposition two convex sub-polygons, taking the pairwise sums and * computing the union of the sub-sums. */ -template + +template class Minkowski_sum_by_decomposition_2 { public: typedef DecompStrategy_ Decomposition_strategy; + typedef Container_ Container; typedef typename Decomposition_strategy::Polygon_2 Polygon_2; private: @@ -46,7 +51,7 @@ private: typedef typename Kernel::Point_2 Point_2; typedef typename Kernel::Vector_2 Vector_2; typedef typename Kernel::Direction_2 Direction_2; - + // Kernel functors: typedef typename Kernel::Equal_2 Equal_2; typedef typename Kernel::Compare_angle_with_x_axis_2 Compare_angle_2; @@ -63,15 +68,11 @@ private: typedef std::list Polygons_list; typedef typename Polygons_list::iterator Polygons_iterator; - // Traits-related types: - typedef Arr_segment_traits_2 Segment_traits_2; - typedef Arr_labeled_traits_2 Traits_2; - - typedef typename Segment_traits_2::X_monotone_curve_2 Segment_2; - typedef typename Traits_2::X_monotone_curve_2 Labeled_segment_2; - typedef std::list Segments_list; - - typedef Union_of_segment_cycles_2 Union_2; + typedef CGAL::Arr_segment_traits_2 Arr_segment_traits; + typedef CGAL::Gps_segment_traits_2 Traits_2; + typedef CGAL::General_polygon_set_2 General_polygon_set_2; + typedef CGAL::Polygon_with_holes_2 Polygon_with_holes_2; + typedef std::list Polygon_with_holes_list; // Data members: Equal_2 f_equal; @@ -107,18 +108,12 @@ public: * Compute the Minkowski sum of two simple polygons. * \param pgn1 The first polygon. * \param pgn2 The second polygon. - * \param sum_bound Output: A polygon respresenting the outer boundary - * of the Minkowski sum. - * \param sum_holes Output: An output iterator for the holes in the sum, - * represented as simple polygons. * \pre Both input polygons are simple. - * \return A past-the-end iterator for the holes in the sum. + * \return The resulting polygon with holes, representing the sum. */ - template - OutputIterator operator() (const Polygon_2& pgn1, - const Polygon_2& pgn2, - Polygon_2& sum_bound, - OutputIterator sum_holes) const + Polygon_with_holes_2 + operator() (const Polygon_2& pgn1, + const Polygon_2& pgn2) const { CGAL_precondition (pgn1.is_simple()); CGAL_precondition (pgn2.is_simple()); @@ -127,6 +122,7 @@ public: Decomposition_strategy decomp_strat; Polygons_list sub_pgns1; Polygons_list sub_pgns2; + Polygons_list sub_sum_polygons; decomp_strat (pgn1, std::back_inserter(sub_pgns1)); decomp_strat (pgn2, std::back_inserter(sub_pgns2)); @@ -134,55 +130,48 @@ public: // Compute the sub-sums of all pairs of sub-polygons. Polygons_iterator end1 = sub_pgns1.end(); Polygons_iterator end2 = sub_pgns2.end(); - unsigned int sum_index = 0; Polygons_iterator curr1, curr2; - Segments_list boundary_segments; for (curr1 = sub_pgns1.begin(); curr1 != end1; ++curr1) { for (curr2 = sub_pgns2.begin(); curr2 != end2; ++curr2) { // Compute the sum of the current pair of convex sub-polygons. - sum_index++; - _compute_sum_of_convex (sum_index, - *curr1, - *curr2, - std::back_inserter (boundary_segments)); + Polygon_2 sub_sum; + _compute_sum_of_convex (*curr1, *curr2, sub_sum); + + sub_sum_polygons.push_back(sub_sum); + } } + + General_polygon_set_2 gps; + + gps.join(sub_sum_polygons.begin(),sub_sum_polygons.end()); + + Polygon_with_holes_list sum; - // Compute the union of the polygons that represent the Minkowski sums - // of all sub-polygon pairs. - Union_2 unite; - - sum_holes = unite (boundary_segments.begin(), boundary_segments.end(), - sum_bound, sum_holes); - - return (sum_holes); + gps.polygons_with_holes(std::back_inserter(sum)); + + return (*(sum.begin())); } private: /*! * Compute the Minkowski sum of two convex polygons. - * \param sum_index The index of the sub-sum. * \param pgn1 The first convex polygon. * \param pgn2 The second convex polygon. - * \param soi Output: An output iterator for the labeled segments along - * the counterclockwise-oriented Minkowski sum. - * \return A past-the-end iterator for the output segments. + * \param sub_sum Output: Polygon which is the sub sum of the two convex polygons */ - template - SegmentsOutputIter _compute_sum_of_convex (unsigned int sum_index, - const Polygon_2& pgn1, - const Polygon_2& pgn2, - SegmentsOutputIter soi) const + void _compute_sum_of_convex (const Polygon_2& pgn1, + const Polygon_2& pgn2, + Polygon_2& sub_sum) const { // Find the bottom-left vertex in both polygons. Vertex_circulator first1, curr1, next1; Vertex_circulator bottom_left1; Comparison_result res; - bottom_left1 = curr1 = first1 = pgn1.vertices_circulator(); ++curr1; while (curr1 != first1) @@ -220,7 +209,6 @@ private: ++next2; // Compute the Minkowski sum. - unsigned int seg_index = 0; Point_2 first_pt; Point_2 curr_pt; Point_2 prev_pt; @@ -240,19 +228,15 @@ private: // This is the first point we have computed. first_pt = prev_pt = curr_pt; is_first = false; + sub_sum.push_back(first_pt); } else { // Add a segment from the previously summed point to the current one. res = f_compare_xy (prev_pt, curr_pt); CGAL_assertion (res != EQUAL); - *soi = Labeled_segment_2 (Segment_2 (prev_pt, curr_pt), - X_curve_label ((res == SMALLER), - sum_index, - seg_index, false)); - ++soi; - seg_index++; prev_pt = curr_pt; + sub_sum.push_back(curr_pt); } // Compare the angles the current edges form with the x-axis. @@ -291,16 +275,7 @@ private: } while (curr1 != bottom_left1 || curr2 != bottom_left2); - // Add the final segment to close the outer boundary. - res = f_compare_xy (prev_pt, first_pt); - CGAL_assertion (res != EQUAL); - *soi = Labeled_segment_2 (Segment_2 (prev_pt, first_pt), - X_curve_label ((res == SMALLER), - sum_index, - seg_index, true)); - ++soi; - - return (soi); + return; } }; diff --git a/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h b/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h index c510c4f5b81..5a730c6f4eb 100644 --- a/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h +++ b/Minkowski_sum_2/include/CGAL/minkowski_sum_2.h @@ -21,6 +21,7 @@ #include #include + #include #include #include @@ -37,6 +38,7 @@ namespace CGAL { * \param pgn2 The second polygon. * \return The resulting polygon with holes, representing the sum. */ + template Polygon_with_holes_2 minkowski_sum_2 (const Polygon_2& pgn1, @@ -74,15 +76,15 @@ minkowski_sum_2 (const Polygon_2& pgn1, const Polygon_2& pgn2, const DecompositionStrategy&) { - Minkowski_sum_by_decomposition_2 mink_sum; - Polygon_2 sum_bound; - std::list > sum_holes; + Minkowski_sum_by_decomposition_2 mink_sum; - mink_sum (pgn1, pgn2, sum_bound, std::back_inserter(sum_holes)); + typedef Polygon_with_holes_2 Polygon_with_holes_2; + + Polygon_with_holes_2 sum; - return (Polygon_with_holes_2 (sum_bound, - sum_holes.begin(), - sum_holes.end())); + sum = mink_sum (pgn1, pgn2); + + return (sum); } } //namespace CGAL diff --git a/Modular_arithmetic/doc_tex/Modular_arithmetic/main.tex b/Modular_arithmetic/doc_tex/Modular_arithmetic/main.tex index bb7e7cfab2d..4925d41bf8c 100644 --- a/Modular_arithmetic/doc_tex/Modular_arithmetic/main.tex +++ b/Modular_arithmetic/doc_tex/Modular_arithmetic/main.tex @@ -40,7 +40,7 @@ of the class, that is, \ccc{CGAL::Residue} is not thread-safe in this case. In case \ccc{CGAL_HAS_THREADS} the implementation of the class is thread safe using \ccc{boost::thread_specific_ptr}. However, this may cause some performance -penalty. Hence, it may be advisable to configure \ccc{CGAL} with +penalty. Hence, it may be advisable to configure \cgal\ with \ccc{CGAL_HAS_NO_THREADS}. \end{ccAdvanced} @@ -68,4 +68,4 @@ The class \ccc{CGAL::Residue} is based on the C-code of Sylvain Pion et. al. as it was presented in \cite{bepp-sdrns-99}. The remaining part of the package is the result of the integration process -of the NumeriX library of \exacus\ \cite{beh+-eeeafcs-05} into CGAL. \ No newline at end of file +of the NumeriX library of \exacus\ \cite{beh+-eeeafcs-05} into \cgal. diff --git a/Nef_2/noweb/Segment_overlay.lw b/Nef_2/noweb/Segment_overlay.lw index f69a4d48c68..0c7bb65609d 100644 --- a/Nef_2/noweb/Segment_overlay.lw +++ b/Nef_2/noweb/Segment_overlay.lw @@ -2243,7 +2243,7 @@ int main(int argc, char** argv) for (int i = 0; i < 100; ++i,++sit) L.push_back(*sit); - // CGAL::copy_n(sit,100, std::back_inserter(L)); + // CGAL::cpp0x::copy_n(sit,100, std::back_inserter(L)); std::ofstream of("input.log"); for (lit = L.begin(); lit!= L.end(); ++lit) diff --git a/Nef_S2/include/CGAL/Nef_S2/Normalizing.h b/Nef_S2/include/CGAL/Nef_S2/Normalizing.h index c142073fa28..400002b94ad 100644 --- a/Nef_S2/include/CGAL/Nef_S2/Normalizing.h +++ b/Nef_S2/include/CGAL/Nef_S2/Normalizing.h @@ -282,9 +282,9 @@ class Normalizing { } #endif - + template static - CGAL::Plane_3 normalized(const CGAL::Plane_3& h) { + CGAL::Plane_3 normalized(const CGAL::Plane_3& h,Tag_true) { CGAL_assertion(!(h.a()==0 && h.b()==0 && h.c()==0 && h.d()==0)); typedef typename R::FT FT; @@ -326,6 +326,26 @@ class Normalizing { composer(vec[2],1), composer(vec[3],1)); } + + + + template static + CGAL::Plane_3 normalized(const CGAL::Plane_3& h,Tag_false) { + CGAL_assertion(!(h.a()==0 && h.b()==0 && h.c()==0 && h.d()==0)); + typedef typename R::FT FT; + if (h.a()!=0) + return typename R::Plane_3(FT(1),h.b()/h.a(),h.c()/h.a(),h.d()/h.a()); + if (h.b()!=0) + return typename R::Plane_3(h.a()/h.b(),FT(1),h.c()/h.b(),h.d()/h.b()); + if (h.c()!=0) + return typename R::Plane_3(h.a()/h.c(),h.b()/h.c(),FT(1),h.d()/h.c()); + return typename R::Plane_3(h.a()/h.d(),h.b()/h.d(),h.c()/h.d(),FT(1)); + } + + template static + CGAL::Plane_3 normalized(const CGAL::Plane_3& h) { + return normalized( h,typename Fraction_traits::Is_fraction() ); + } template static CGAL::Sphere_circle normalized(CGAL::Sphere_circle& c) { diff --git a/Number_types/include/CGAL/Lazy_exact_nt.h b/Number_types/include/CGAL/Lazy_exact_nt.h index 9f3f90064fe..455fe29df48 100644 --- a/Number_types/include/CGAL/Lazy_exact_nt.h +++ b/Number_types/include/CGAL/Lazy_exact_nt.h @@ -29,7 +29,7 @@ #include #include // for Root_of functor -#include +#include #include #include @@ -914,7 +914,7 @@ struct Div_mod_selector { void operator()( const NT1& x, const NT2& y, NT& q, NT& r ) const { - BOOST_STATIC_ASSERT((::boost::is_same< + CGAL_static_assertion((::boost::is_same< typename Coercion_traits< NT1, NT2 >::Type, NT >::value)); @@ -999,7 +999,7 @@ template < typename ET > class Real_embeddable_traits< Lazy_exact_nt > : public INTERN_RET::Real_embeddable_traits_base< Lazy_exact_nt , CGAL::Tag_true > { // Every type ET of Lazy_exact_nt has to be real embeddable. - BOOST_STATIC_ASSERT((::boost::is_same< typename Real_embeddable_traits< ET > + CGAL_static_assertion((::boost::is_same< typename Real_embeddable_traits< ET > ::Is_real_embeddable, Tag_true >::value)); public: diff --git a/Number_types/include/CGAL/Root_of_traits.h b/Number_types/include/CGAL/Root_of_traits.h index cffb0341412..7a72251c11a 100644 --- a/Number_types/include/CGAL/Root_of_traits.h +++ b/Number_types/include/CGAL/Root_of_traits.h @@ -130,7 +130,7 @@ private: // We have the typedef as VC10 fails with // static_assert(FrT::Is_fraction::value) typedef typename FrT::Is_fraction ISF; - BOOST_STATIC_ASSERT((ISF::value)); + CGAL_static_assertion((ISF::value)); typedef typename FrT::Numerator_type RT; diff --git a/Number_types/include/CGAL/Test/test_root_of_traits.h b/Number_types/include/CGAL/Test/test_root_of_traits.h index 7dc7e43eb3a..87ed06fe30c 100644 --- a/Number_types/include/CGAL/Test/test_root_of_traits.h +++ b/Number_types/include/CGAL/Test/test_root_of_traits.h @@ -10,8 +10,8 @@ void test_root_of_traits(){ typedef typename RoT::Root_of_1 Root_of_1; typedef typename RoT::Root_of_2 Root_of_2; - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef typename RoT::Make_root_of_2 Make_root_of_2; typedef typename RoT::Make_sqrt Make_sqrt; @@ -23,10 +23,10 @@ void test_root_of_traits(){ const Inverse& inverse = Inverse(); const Square& square = Square(); - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); { diff --git a/Number_types/include/CGAL/mpq_class.h b/Number_types/include/CGAL/mpq_class.h index 74a0db8291b..0b565b30ecf 100644 --- a/Number_types/include/CGAL/mpq_class.h +++ b/Number_types/include/CGAL/mpq_class.h @@ -38,7 +38,7 @@ // while ::__gmp_expr is the others "expressions". #define CGAL_CHECK_GMP_EXPR \ - BOOST_STATIC_ASSERT( \ + CGAL_static_assertion( \ (::boost::is_same< ::__gmp_expr< T , T >,Type>::value )); namespace CGAL { diff --git a/Number_types/include/CGAL/mpz_class.h b/Number_types/include/CGAL/mpz_class.h index 15da28bd30a..bae1ca32638 100644 --- a/Number_types/include/CGAL/mpz_class.h +++ b/Number_types/include/CGAL/mpz_class.h @@ -40,7 +40,7 @@ #define CGAL_CHECK_GMP_EXPR \ - BOOST_STATIC_ASSERT( \ + CGAL_static_assertion( \ (::boost::is_same< ::__gmp_expr< T , T >,Type>::value )); namespace CGAL { diff --git a/Number_types/include/CGAL/simplest_rational_in_interval.h b/Number_types/include/CGAL/simplest_rational_in_interval.h index e52f2e69415..b0b0056b2d9 100644 --- a/Number_types/include/CGAL/simplest_rational_in_interval.h +++ b/Number_types/include/CGAL/simplest_rational_in_interval.h @@ -48,9 +48,9 @@ simplest_rational_in_interval(double x, double y) { typedef typename FT::Compose Compose; // Must be a fraction - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); // Numerator_type,Denominator_type must be the same - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); if(x == y){ diff --git a/Number_types/include/CGAL/to_rational.h b/Number_types/include/CGAL/to_rational.h index 111f8e7aabd..6f160c730f5 100644 --- a/Number_types/include/CGAL/to_rational.h +++ b/Number_types/include/CGAL/to_rational.h @@ -41,8 +41,8 @@ to_rational(double x) typedef typename FT::Denominator_type Denominator_type; typename FT::Compose compose; - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); Numerator_type num(0),den(1); diff --git a/Number_types/test/Number_types/Coercion_traits.cpp b/Number_types/test/Number_types/Coercion_traits.cpp index d9b9ccbde6c..6fcfdacb56c 100644 --- a/Number_types/test/Number_types/Coercion_traits.cpp +++ b/Number_types/test/Number_types/Coercion_traits.cpp @@ -164,9 +164,9 @@ void AT_coercion_test_for_cgal_types_rat(){ typedef typename AT::Bigfloat_interval Bigfloat_interval; - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); CGAL::test_explicit_interoperable_from_to(); CGAL::test_explicit_interoperable_from_to(); @@ -222,10 +222,10 @@ void AT_coercion_test_for_cgal_types_fws(){ typedef typename AT::Bigfloat_interval Bigfloat_interval; typedef typename AT::Field_with_sqrt Real; - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); - BOOST_STATIC_ASSERT(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); + CGAL_static_assertion(!(::boost::is_same::value)); typedef CGAL::Sqrt_extension Extn_1; diff --git a/Number_types/test/Number_types/Lazy_exact_nt_new.cpp b/Number_types/test/Number_types/Lazy_exact_nt_new.cpp index 5600adbc97b..c6aaf361767 100644 --- a/Number_types/test/Number_types/Lazy_exact_nt_new.cpp +++ b/Number_types/test/Number_types/Lazy_exact_nt_new.cpp @@ -78,9 +78,9 @@ void test_lazy_exact_nt() { typedef CGAL::Lazy_exact_nt< typename AK::Integer > LI; typedef CGAL::Lazy_exact_nt< typename AK::Rational > LR; typedef CGAL::Coercion_traits CT; - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_true>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Type,LR>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_true>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Type,LR>::value)); LI i(4); LR r(4); @@ -94,8 +94,8 @@ void test_lazy_exact_nt() { typedef CGAL::Lazy_exact_nt T1; typedef CGAL::Lazy_exact_nt T2; typedef CGAL::Coercion_traits CT; - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_false>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_false>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_false>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_false>::value)); #endif #endif } diff --git a/Number_types/test/Number_types/Quotient_new.cpp b/Number_types/test/Number_types/Quotient_new.cpp index b0cedba2594..743d9beab32 100644 --- a/Number_types/test/Number_types/Quotient_new.cpp +++ b/Number_types/test/Number_types/Quotient_new.cpp @@ -60,9 +60,9 @@ void test_quotient() { typedef typename AT::Integer I ; typedef CGAL::Quotient QI; typedef CGAL::Coercion_traits CT; - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_true>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename CT::Type,QI>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Are_explicit_interoperable,CGAL::Tag_true>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Are_implicit_interoperable,CGAL::Tag_true>::value)); + CGAL_static_assertion((boost::is_same< typename CT::Type,QI>::value)); } } diff --git a/Number_types/test/Number_types/Sqrt_extension.cpp b/Number_types/test/Number_types/Sqrt_extension.cpp index 3e7d01c7911..e2a5fb1847b 100644 --- a/Number_types/test/Number_types/Sqrt_extension.cpp +++ b/Number_types/test/Number_types/Sqrt_extension.cpp @@ -20,7 +20,7 @@ inline void convert_to(const NT& x, RT& r){ typedef CGAL::Coercion_traits CT; typedef typename CT::Type Type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); r = typename CT::Cast()(x); } } //namespace CGAL @@ -696,15 +696,15 @@ void test_get_arithmetic_kernel(){ { typedef CGAL::Sqrt_extension EXT; typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel AT_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); } { typedef CGAL::Sqrt_extension EXT; typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel AT_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); } { typedef CGAL::Sqrt_extension EXT; typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel AT_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); } } diff --git a/Number_types/test/Number_types/include/CGAL/Test/test_root_of_2_traits.h b/Number_types/test/Number_types/include/CGAL/Test/test_root_of_2_traits.h index 66186d7199c..6936429d8d7 100644 --- a/Number_types/test/Number_types/include/CGAL/Test/test_root_of_2_traits.h +++ b/Number_types/test/Number_types/include/CGAL/Test/test_root_of_2_traits.h @@ -7,12 +7,12 @@ void test_root_of_traits(){ typedef typename RoT::Root_of_1 Root_of_1; typedef typename RoT::Root_of_2 Root_of_2; - BOOST_STATIC_ASSERT((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typedef typename RoT::Make_root_of_2 Make_root_of_2; typedef typename Make_root_of_2::result_type result_type; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); const Make_root_of_2& make_root_of_2 = Make_root_of_2(); Root_of_2 r = make_root_of_2(T(0),T(-1),T(2)); //-sqrt(2) diff --git a/Number_types/test/Number_types/known_bit_size_integers.cpp b/Number_types/test/Number_types/known_bit_size_integers.cpp index af4fb53447c..2085172687b 100644 --- a/Number_types/test/Number_types/known_bit_size_integers.cpp +++ b/Number_types/test/Number_types/known_bit_size_integers.cpp @@ -1,24 +1,24 @@ #include #include -#include +#include int main() { std::cout << "Verifying the sizes of boost::[u]int{8,16,32,64}_t" << std::endl; - BOOST_STATIC_ASSERT(sizeof(boost::int8_t) == 1); - BOOST_STATIC_ASSERT(sizeof(boost::int16_t) == 2); - BOOST_STATIC_ASSERT(sizeof(boost::int32_t) == 4); + CGAL_static_assertion(sizeof(boost::int8_t) == 1); + CGAL_static_assertion(sizeof(boost::int16_t) == 2); + CGAL_static_assertion(sizeof(boost::int32_t) == 4); #ifndef BOOST_NO_INT64_T - BOOST_STATIC_ASSERT(sizeof(boost::int64_t) == 8); + CGAL_static_assertion(sizeof(boost::int64_t) == 8); #endif - BOOST_STATIC_ASSERT(sizeof(boost::uint8_t) == 1); - BOOST_STATIC_ASSERT(sizeof(boost::uint16_t) == 2); - BOOST_STATIC_ASSERT(sizeof(boost::uint32_t) == 4); + CGAL_static_assertion(sizeof(boost::uint8_t) == 1); + CGAL_static_assertion(sizeof(boost::uint16_t) == 2); + CGAL_static_assertion(sizeof(boost::uint32_t) == 4); #ifndef BOOST_NO_INT64_T - BOOST_STATIC_ASSERT(sizeof(boost::uint64_t) == 8); + CGAL_static_assertion(sizeof(boost::uint64_t) == 8); #endif return 0; diff --git a/Point_set_2/test/Point_set_2/range_search.cpp b/Point_set_2/test/Point_set_2/range_search.cpp index c84ad86a302..ea50a69e862 100644 --- a/Point_set_2/test/Point_set_2/range_search.cpp +++ b/Point_set_2/test/Point_set_2/range_search.cpp @@ -42,7 +42,7 @@ int main() std::list points; std::list LV; - CGAL::copy_n(rpg, 1000, std::back_inserter(points)); + CGAL::cpp0x::copy_n(rpg, 1000, std::back_inserter(points)); PSet.insert(points.begin(), points.end()); Point_2 p(10, 10), q(50, 10), r(50, 50), s(10, 50); diff --git a/Point_set_2/test/Point_set_2/range_search_fcn.cpp b/Point_set_2/test/Point_set_2/range_search_fcn.cpp index 902e7e65ed9..df7fffd03d1 100644 --- a/Point_set_2/test/Point_set_2/range_search_fcn.cpp +++ b/Point_set_2/test/Point_set_2/range_search_fcn.cpp @@ -45,7 +45,7 @@ int main() std::list points; std::list LV; - CGAL::copy_n(rpg, 1000, std::back_inserter(points)); + CGAL::cpp0x::copy_n(rpg, 1000, std::back_inserter(points)); PSet.insert(points.begin(), points.end()); Point_2 p(10, 10), q(50, 10), r(50, 50), s(10, 50); diff --git a/Polynomial/include/CGAL/Exponent_vector.h b/Polynomial/include/CGAL/Exponent_vector.h index 73c865df730..eaa67cb271e 100644 --- a/Polynomial/include/CGAL/Exponent_vector.h +++ b/Polynomial/include/CGAL/Exponent_vector.h @@ -63,7 +63,7 @@ public: Exponent_vector(InputIterator begin , InputIterator end) :v(begin,end){ typedef typename std::iterator_traits::value_type value_type; - BOOST_STATIC_ASSERT(( ::boost::is_same::value)); + CGAL_static_assertion(( ::boost::is_same::value)); } diff --git a/Polynomial/include/CGAL/Polynomial.h b/Polynomial/include/CGAL/Polynomial.h index cd523c07b1e..7fe1ee8b608 100644 --- a/Polynomial/include/CGAL/Polynomial.h +++ b/Polynomial/include/CGAL/Polynomial.h @@ -45,7 +45,7 @@ #include -#include +#include #ifdef CGAL_USE_LEDA #if CGAL_LEDA_VERSION >= 500 diff --git a/Polynomial/include/CGAL/Polynomial/Algebraic_structure_traits.h b/Polynomial/include/CGAL/Polynomial/Algebraic_structure_traits.h index a6c4490c3a1..b969c87a2d0 100644 --- a/Polynomial/include/CGAL/Polynomial/Algebraic_structure_traits.h +++ b/Polynomial/include/CGAL/Polynomial/Algebraic_structure_traits.h @@ -281,7 +281,7 @@ class Polynomial_algebraic_structure_traits_base< POLY, Field_tag > template < class NT1, class NT2 > void operator()( const NT1& x, const NT2& y, POLY& q, POLY& r ) const { - BOOST_STATIC_ASSERT((::boost::is_same< + CGAL_static_assertion((::boost::is_same< typename Coercion_traits< NT1, NT2 >::Type, POLY >::value)); diff --git a/Polynomial/include/CGAL/Polynomial/Polynomial_type.h b/Polynomial/include/CGAL/Polynomial/Polynomial_type.h index e9b73ad44ea..c5aed1e00de 100644 --- a/Polynomial/include/CGAL/Polynomial/Polynomial_type.h +++ b/Polynomial/include/CGAL/Polynomial/Polynomial_type.h @@ -44,6 +44,10 @@ typename CGAL::internal::Innermost_coefficient_type::Type , 2>::Type #include #include +#ifdef CGAL_HAS_THREADS +# include +#endif + namespace CGAL { template class Polynomial; @@ -261,8 +265,15 @@ protected: // private: static Self& get_default_instance(){ - static Self x = Self(0); - return x; + #ifdef CGAL_HAS_THREADS + static boost::thread_specific_ptr< Self > safe_x_ptr; + if (safe_x_ptr.get() == NULL) + safe_x_ptr.reset(new Self(0)); + return *safe_x_ptr.get(); + #else + static Self x = Self(0); + return x; + #endif } public: //! \name Constructors @@ -540,7 +551,7 @@ public: * Also available as non-member function. */ CGAL::Sign sign() const { -// BOOST_STATIC_ASSERT( (boost::is_same< typename Real_embeddable_traits::Is_real_embeddable, +// CGAL_static_assertion( (boost::is_same< typename Real_embeddable_traits::Is_real_embeddable, // CGAL::Tag_true>::value) ); return CGAL::sign(lcoeff()); } diff --git a/Polynomial/include/CGAL/Polynomial/subresultants.h b/Polynomial/include/CGAL/Polynomial/subresultants.h index 301955a47de..6f906c25c6e 100644 --- a/Polynomial/include/CGAL/Polynomial/subresultants.h +++ b/Polynomial/include/CGAL/Polynomial/subresultants.h @@ -785,7 +785,7 @@ namespace CGAL { CGAL::Integral_domain_without_division_tag) { // polynomial_subresultants_with_cofactors requires // a model of IntegralDomain as coefficient type; - BOOST_STATIC_ASSERT(sizeof(Polynomial_traits_d)==0); + CGAL_static_assertion(sizeof(Polynomial_traits_d)==0); return sres_out; } diff --git a/Polynomial/include/CGAL/Polynomial_traits_d.h b/Polynomial/include/CGAL/Polynomial_traits_d.h index 12136244898..47cfbb16818 100644 --- a/Polynomial/include/CGAL/Polynomial_traits_d.h +++ b/Polynomial/include/CGAL/Polynomial_traits_d.h @@ -571,7 +571,7 @@ public: template Polynomial_d construct_value_type(Input_iterator begin, Input_iterator end, NT) const { typedef CGAL::Coercion_traits CT; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); typename CT::Cast cast; return Polynomial_d( boost::make_transform_iterator(begin,cast), @@ -672,7 +672,7 @@ public: typedef Polynomial_traits_d PT; typename PT::Construct_polynomial construct; - BOOST_STATIC_ASSERT(PT::d != 0); // Coefficient_type is a Polynomial + CGAL_static_assertion(PT::d != 0); // Coefficient_type is a Polynomial std::vector coefficients; Coefficient_type zero(0); diff --git a/Polynomial/include/CGAL/Test/_test_polynomial_traits_d.h b/Polynomial/include/CGAL/Test/_test_polynomial_traits_d.h index a15a0fff86b..7d984c0c7fc 100644 --- a/Polynomial/include/CGAL/Test/_test_polynomial_traits_d.h +++ b/Polynomial/include/CGAL/Test/_test_polynomial_traits_d.h @@ -34,7 +34,7 @@ static CGAL::Random my_rnd(346); // some seed #define ASSERT_IS_NULL_FUNCTOR(T) \ - BOOST_STATIC_ASSERT((boost::is_same::value)) + CGAL_static_assertion((boost::is_same::value)) @@ -154,10 +154,10 @@ void test_construct_polynomial(const Polynomial_traits_d&){ } { // Construct_polynomial typedef typename PT::Construct_polynomial Constructor; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( !(boost::is_same< Constructor , CGAL::Null_functor >::value)); typedef typename Constructor::result_type result_type; - BOOST_STATIC_ASSERT( + CGAL_static_assertion( (boost::is_same< result_type , Polynomial_d >::value)); typedef typename PT::Shift Shift; typedef typename PT::Evaluate Evaluate; @@ -1778,23 +1778,23 @@ void test_rebind(const PT& /*traits*/){ { const int dimension = 1; typedef typename PT:: template Rebind::Other PT_IC_1; - BOOST_STATIC_ASSERT((boost::is_same< typename PT_IC_1::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_IC_1::Innermost_coefficient_type, IC>::value)); - BOOST_STATIC_ASSERT((PT_IC_1::d==dimension)); + CGAL_static_assertion((PT_IC_1::d==dimension)); } { const int dimension = 2; typedef typename PT:: template Rebind::Other PT_IC_2; - BOOST_STATIC_ASSERT((boost::is_same< typename PT_IC_2::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_IC_2::Innermost_coefficient_type, IC>::value)); - BOOST_STATIC_ASSERT((PT_IC_2::d==dimension)); + CGAL_static_assertion((PT_IC_2::d==dimension)); } { const int dimension = 3; typedef typename PT:: template Rebind::Other PT_IC_3; - BOOST_STATIC_ASSERT((boost::is_same< typename PT_IC_3::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_IC_3::Innermost_coefficient_type, IC>::value)); - BOOST_STATIC_ASSERT((PT_IC_3::d==dimension)); + CGAL_static_assertion((PT_IC_3::d==dimension)); } { typedef typename PT:: template Rebind::Other PT_IC_1; @@ -1804,11 +1804,11 @@ void test_rebind(const PT& /*traits*/){ typedef typename PT_IC_1::Polynomial_d Poly1; typedef typename PT_IC_2::Polynomial_d Poly2; - BOOST_STATIC_ASSERT((boost::is_same< typename PT_IC_1::Coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_IC_1::Coefficient_type, IC>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename PT_IC_2::Coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_IC_2::Coefficient_type, Poly1>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename PT_IC_3::Coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_IC_3::Coefficient_type, Poly2>::value)); } @@ -1821,12 +1821,12 @@ void test_rebind(const PT& /*traits*/){ const int dimension = 4; typedef typename PT:: template Rebind::Other PT_Integer_4; typedef typename PT:: template Rebind::Other PT_Rational_4; - BOOST_STATIC_ASSERT((boost::is_same< typename PT_Integer_4::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_Integer_4::Innermost_coefficient_type, Integer>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename PT_Rational_4::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_Rational_4::Innermost_coefficient_type, Rational>::value)); - BOOST_STATIC_ASSERT((PT_Integer_4::d==dimension)); - BOOST_STATIC_ASSERT((PT_Rational_4::d==dimension)); + CGAL_static_assertion((PT_Integer_4::d==dimension)); + CGAL_static_assertion((PT_Rational_4::d==dimension)); } #endif #ifdef CGAL_USE_CORE @@ -1837,24 +1837,24 @@ void test_rebind(const PT& /*traits*/){ const int dimension = 4; typedef typename PT:: template Rebind::Other PT_Integer_4; typedef typename PT:: template Rebind::Other PT_Rational_4; - BOOST_STATIC_ASSERT((boost::is_same< typename PT_Integer_4::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_Integer_4::Innermost_coefficient_type, Integer>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename PT_Rational_4::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_Rational_4::Innermost_coefficient_type, Rational>::value)); - BOOST_STATIC_ASSERT((PT_Integer_4::d==dimension)); - BOOST_STATIC_ASSERT((PT_Rational_4::d==dimension)); + CGAL_static_assertion((PT_Integer_4::d==dimension)); + CGAL_static_assertion((PT_Rational_4::d==dimension)); } #endif { const int dimension = 4; typedef typename PT:: template Rebind::Other PT_Integer_4; typedef typename PT:: template Rebind::Other PT_Rational_4; - BOOST_STATIC_ASSERT((boost::is_same< typename PT_Integer_4::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_Integer_4::Innermost_coefficient_type, int>::value)); - BOOST_STATIC_ASSERT((boost::is_same< typename PT_Rational_4::Innermost_coefficient_type, + CGAL_static_assertion((boost::is_same< typename PT_Rational_4::Innermost_coefficient_type, double>::value)); - BOOST_STATIC_ASSERT((PT_Integer_4::d==dimension)); - BOOST_STATIC_ASSERT((PT_Rational_4::d==dimension)); + CGAL_static_assertion((PT_Integer_4::d==dimension)); + CGAL_static_assertion((PT_Rational_4::d==dimension)); } } diff --git a/Polynomial/test/Polynomial/Coercion_traits.cpp b/Polynomial/test/Polynomial/Coercion_traits.cpp index 36c83b9b30b..a0555c79561 100644 --- a/Polynomial/test/Polynomial/Coercion_traits.cpp +++ b/Polynomial/test/Polynomial/Coercion_traits.cpp @@ -149,7 +149,7 @@ void test_coercion_traits(){ /* { typedef CGAL::Coercion_traits CT; - BOOST_STATIC_ASSERT(( + CGAL_static_assertion(( ::boost::is_same< typename CT::Are_implicit_interoperable, CGAL::Tag_false>::value)); } diff --git a/Polynomial/test/Polynomial/Get_arithmetic_kernel.cpp b/Polynomial/test/Polynomial/Get_arithmetic_kernel.cpp index 0b40e1f58c0..15f5cbdbd22 100644 --- a/Polynomial/test/Polynomial/Get_arithmetic_kernel.cpp +++ b/Polynomial/test/Polynomial/Get_arithmetic_kernel.cpp @@ -8,11 +8,11 @@ void test_get_arithmetic_kernel(){ { typedef CGAL::Polynomial POLY; typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); }{ typedef CGAL::Polynomial > POLY; typedef typename CGAL::Get_arithmetic_kernel::Arithmetic_kernel AK_; - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); } } diff --git a/Polynomial/test/Polynomial/Polynomial_type_generator.cpp b/Polynomial/test/Polynomial/Polynomial_type_generator.cpp index 8b8e6e62e58..e29a074151e 100644 --- a/Polynomial/test/Polynomial/Polynomial_type_generator.cpp +++ b/Polynomial/test/Polynomial/Polynomial_type_generator.cpp @@ -10,14 +10,14 @@ int main(){ { typedef CGAL::Polynomial_type_generator::Type Polynomial; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); } { typedef CGAL::Polynomial_type_generator::Type Polynomial; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); } { typedef CGAL::Polynomial_type_generator::Type Polynomial; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); } } diff --git a/Polynomial/test/Polynomial/test_polynomial.h b/Polynomial/test/Polynomial/test_polynomial.h index d7a97807dbd..57babaaac6a 100644 --- a/Polynomial/test/Polynomial/test_polynomial.h +++ b/Polynomial/test/Polynomial/test_polynomial.h @@ -35,7 +35,7 @@ inline void convert_to(const NT& x, RT& r){ typedef CGAL::Coercion_traits CT; typedef typename CT::Coercion_type RET; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); r = typename CT::Cast()(x); } } //namespace CGAL @@ -879,7 +879,7 @@ void test_scalar_factor_traits(){ typedef CGAL::Scalar_factor_traits SFT; typedef typename AT::Integer Scalar; typedef typename SFT::Scalar Scalar_; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typename SFT::Scalar_factor sfac; @@ -905,7 +905,7 @@ void test_scalar_factor_traits(){ typedef CGAL::Scalar_factor_traits SFT; typedef typename AT::Integer Scalar; typedef typename SFT::Scalar Scalar_; - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); typename SFT::Scalar_factor sfac; diff --git a/QP_solver/include/CGAL/QP_solver/QP_solver_impl.h b/QP_solver/include/CGAL/QP_solver/QP_solver_impl.h index 95d82aa7892..431f6d4584e 100644 --- a/QP_solver/include/CGAL/QP_solver/QP_solver_impl.h +++ b/QP_solver/include/CGAL/QP_solver/QP_solver_impl.h @@ -417,7 +417,7 @@ ratio_test_init__A_Cj( Value_iterator A_Cj_it, int j_, Tag_true) // store exact version of `A_Cj' (implicit conversion) if ( j_ < qp_n) { // original variable - CGAL::copy_n( *(qp_A + j_), qp_m, A_Cj_it); + CGAL::cpp0x::copy_n( *(qp_A + j_), qp_m, A_Cj_it); } else { // artificial variable diff --git a/Ridges_3/include/CGAL/Ridges.h b/Ridges_3/include/CGAL/Ridges.h index 9144593c5df..2fe457b7835 100644 --- a/Ridges_3/include/CGAL/Ridges.h +++ b/Ridges_3/include/CGAL/Ridges.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include namespace CGAL { @@ -201,10 +201,10 @@ class Ridge_approximation typedef typename TriangulatedSurfaceMesh::Facet_const_iterator Facet_const_iterator; //requirements for the templates TriangulatedSurfaceMesh and Vertex2FTPropertyMap or Vertex2VectorPropertyMap - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); typedef std::pair< Halfedge_const_handle, FT> Ridge_halfhedge; typedef CGAL::Ridge_line Ridge_line; diff --git a/Ridges_3/include/CGAL/Umbilics.h b/Ridges_3/include/CGAL/Umbilics.h index e6d3d234e1f..d87871cc971 100644 --- a/Ridges_3/include/CGAL/Umbilics.h +++ b/Ridges_3/include/CGAL/Umbilics.h @@ -96,10 +96,10 @@ template < class TriangulatedSurfaceMesh, typedef typename TriangulatedSurfaceMesh::Vertex_const_iterator Vertex_const_iterator; //requirements for the templates TriangulatedSurfaceMesh and Vertex2FTPropertyMap or Vertex2VectorPropertyMap - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); - BOOST_STATIC_ASSERT((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); + CGAL_static_assertion((boost::is_same::value)); typedef CGAL::Umbilic Umbilic; diff --git a/Robustness/demo/Robustness/robustness.cpp b/Robustness/demo/Robustness/robustness.cpp index 077595a4c8c..fb0cfcef417 100644 --- a/Robustness/demo/Robustness/robustness.cpp +++ b/Robustness/demo/Robustness/robustness.cpp @@ -490,8 +490,8 @@ private slots: hdouble_segments.clear(); hdouble_segments2.clear(); - CGAL::copy_n( g, 100, std::back_inserter( double_segments) ); - CGAL::copy_n( g, 100, std::back_inserter( double_segments2) ); + CGAL::cpp0x::copy_n( g, 100, std::back_inserter( double_segments) ); + CGAL::cpp0x::copy_n( g, 100, std::back_inserter( double_segments2) ); CGAL::Cartesian_converter converter; std::transform( double_segments.begin(), diff --git a/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt b/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt new file mode 100644 index 00000000000..08be2c066e6 --- /dev/null +++ b/STL_Extension/benchmark/copy_n_benchmark/CMakeLists.txt @@ -0,0 +1,36 @@ +# Created by the script cgal_create_cmake_script +# This is the CMake script for compiling a CGAL application. + + +project( copy_n_benchmark_example ) + +cmake_minimum_required(VERSION 2.6.2) +if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6) + if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3) + cmake_policy(VERSION 2.8.4) + else() + cmake_policy(VERSION 2.6) + endif() +endif() + +find_package(CGAL QUIET COMPONENTS Core ) + +if ( CGAL_FOUND ) + + include( ${CGAL_USE_FILE} ) + + include( CGAL_CreateSingleSourceCGALProgram ) + + include_directories (BEFORE ../../include) + + create_single_source_cgal_program( "copy_n_benchmark.cpp" ) + + create_single_source_cgal_program( "copy_n_use_case_benchmark.cpp" ) + + +else() + + message(STATUS "This program requires the CGAL library, and will not be compiled.") + +endif() + diff --git a/STL_Extension/benchmark/copy_n_benchmark/copy_n_benchmark.cpp b/STL_Extension/benchmark/copy_n_benchmark/copy_n_benchmark.cpp new file mode 100644 index 00000000000..0b6acaec7a7 --- /dev/null +++ b/STL_Extension/benchmark/copy_n_benchmark/copy_n_benchmark.cpp @@ -0,0 +1,128 @@ +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +//class with non-trivial copy ctor +class non_trivial_cctor +{ +public: + non_trivial_cctor() { data = new char[n]; std::fill_n(data, n, 0); } + non_trivial_cctor(const non_trivial_cctor& x) { data = new char[n]; std::copy(x.data, x.data + n, this->data); } + ~non_trivial_cctor() { delete[] data; } +private: + const static int n; + char* data; +}; + +const int non_trivial_cctor::n = 64; + +int format_output(const char* lib, const char* container, const char* to, int n, float time) { + return std::printf("| %s || %s || %s || %d || %.4fM items/sec\n", lib, container, to, n, time); +} + +struct std_tag {}; +struct cgal_tag {}; + +#ifndef CGAL_CFG_NO_CPP0X_COPY_N +template +inline double test(ForwardIterator it, Size n, OutputIterator result, int repeats, std_tag) { + boost::timer timer; + timer.restart(); + for (int i = 0; i < repeats; ++i) { std::copy_n(it, n, result); } + return (double)n*repeats/timer.elapsed()/1.0E6; +} +#endif + +template +inline double test(ForwardIterator it, Size n, OutputIterator result, int repeats, cgal_tag) { + boost::timer timer; + timer.restart(); + for (int i = 0; i < repeats; ++i) { CGAL::copy_n(it, n, result); } + return (double)n*repeats/timer.elapsed()/1.0E6; +} + +int main(int argc, char* argv[]) { + int n = 20000000; + int repeats = 20; + + if(argc > 1) + n = boost::lexical_cast(argv[1]); + + if(argc > 2) + repeats = boost::lexical_cast(argv[2]); + + typedef std::vector vector; + typedef std::list list; + typedef std::vector vector2; + + vector v(n); + + typedef int* copy_mem; + typedef non_trivial_cctor* copy_mem2; + + copy_mem copy_m = new int[n]; + + //wiki markup header + std::cout << + "{| \n" + "! Library !! From Container !! To !! #Elements !! items/sec \n" + "|- \n"; + float item_sec; + +#ifndef CGAL_CFG_NO_CPP0X_COPY_N + item_sec = test(v.begin(), n, copy_m, repeats, std_tag()); + format_output("stdlib", "vector", "int*", n, item_sec); + std::cout << "|- \n"; +#endif + + item_sec = test(v.begin(), n, copy_m, repeats, cgal_tag()); + format_output("CGAL", "vector", "int*", n, item_sec); + std::cout << "|- \n"; + + //purge + v.clear(); + std::fill_n(copy_m, n, 0); + + list l(n); + +#ifndef CGAL_CFG_NO_CPP0X_COPY_N + item_sec = test(l.begin(), n, copy_m, repeats, std_tag()); + format_output("stdlib", "list", "int*", n, item_sec); + std::cout << "|- \n"; +#endif + + item_sec = test(l.begin(), n, copy_m, repeats, cgal_tag()); + format_output("CGAL", "list", "int*", n, item_sec); + std::cout << "|- \n"; + + delete[] copy_m; + + vector2 v2(n); + copy_mem2 copy_m2 = new non_trivial_cctor[n]; + +#ifndef CGAL_CFG_NO_CPP0X_COPY_N + item_sec = test(v2.begin(), n, copy_m2, repeats, std_tag()); + format_output("stdlib", "vector", "non_trivial_cctor*", n, item_sec); + std::cout << "|- \n"; +#endif + + item_sec = test(v2.begin(), n, copy_m2, repeats, cgal_tag()); + format_output("CGAL", "vector", "non_trivial_cctor*", n, item_sec); + + //wiki markup footer + std::cout << "|}" << std::endl; + + + + return EXIT_SUCCESS; +} diff --git a/STL_Extension/benchmark/copy_n_benchmark/copy_n_use_case_benchmark.cpp b/STL_Extension/benchmark/copy_n_benchmark/copy_n_use_case_benchmark.cpp new file mode 100644 index 00000000000..7c6a298ee2a --- /dev/null +++ b/STL_Extension/benchmark/copy_n_benchmark/copy_n_use_case_benchmark.cpp @@ -0,0 +1,63 @@ +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + + + +int format_output(const char* lib, const char* generator, int n, float time) { + return std::printf("| %s || %s || %d || %.4fM items/sec\n", lib, generator, n, time); +} + +typedef CGAL::Simple_cartesian R; +typedef R::Point_2 Point; +typedef CGAL::Creator_uniform_2 Creator; +typedef std::vector Vector; + +int main(int argc, char* argv[]) { + int n = 10000000; + int repeats = 10; + + if(argc > 1) + n = boost::lexical_cast(argv[1]); + + if(argc > 2) + repeats = boost::lexical_cast(argv[2]); + + Vector points(n, Point()); + + CGAL::Random_points_in_disc_2 g( 1000.0); + boost::timer timer; + const char* generator = "Random_points_in_disc_2"; + float time; + + std::cout << + "{| \n" + "! Library !! Generator !! #Elements !! items/sec \n" + "|- \n"; + + timer.restart(); + for (int i = 0; i < repeats; ++i) { CGAL::copy_n( g, n, points.begin()); } + time = (double)n*repeats/timer.elapsed()/1.0E6; + format_output("CGAL", generator , n, time); + std::cout << "|- \n"; + +#ifndef CGAL_CFG_NO_CPP0X_COPY_N + timer.restart(); + for (int i = 0; i < repeats; ++i) { std::copy_n( g, n, points.begin()); } + time = (double)n*repeats/timer.elapsed()/1.0E6; + format_output("stdlib", generator, n, time); +#endif + + //wiki markup footer + std::cout << "|}" << std::endl; +} diff --git a/STL_Extension/doc_tex/STL_Extension_ref/intro.tex b/STL_Extension/doc_tex/STL_Extension_ref/intro.tex index 5179ce8c71c..9a99c77d0d0 100644 --- a/STL_Extension/doc_tex/STL_Extension_ref/intro.tex +++ b/STL_Extension/doc_tex/STL_Extension_ref/intro.tex @@ -46,6 +46,7 @@ \subsection*{Generic Algorithms} +\ccRefIdfierPage{CGAL::cpp0x::copy_n}\\ \ccRefIdfierPage{CGAL::copy_n}\\ \ccRefIdfierPage{CGAL::min_max_element}\\ %% Michael: I commented these, as I think they should be replaced by combining diff --git a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex index 3d96951d2d7..c46294c73bd 100644 --- a/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex +++ b/STL_Extension/doc_tex/STL_Extension_ref/stl_extension.tex @@ -105,27 +105,45 @@ \end{ccRefFunction} %% +---------------------------------------------+ -\begin{ccRefFunction}{copy_n} - \label{sectionCopyN} + +\begin{ccRefFunction}{cpp0x::copy_n} + This provides an implementation of the standard function + \ccc{copy_n} from the C++0x standard. If \ccc{copy_n} is available + in the \ccc{std::} namespace a using declaration is used, otherwise + an alternative implementation from \cgal\ is used. \ccDefinition The function \ccRefName\ copies $n$ items from an - input iterator to an output iterator which is useful for possibly - infinite - sequences of random geometric objects.\footnote{% - The \stl\ release June 13, 1997, from SGI contains an equivalent - function, but it is not part of the ISO standard.} - + input iterator to an output iterator. Its exact behaviour is defined + in $\mathsection 25.3.1$ of the C++ standard draft + \href{http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf}{N3242}. + \ccInclude{CGAL/algorithm.h} +\end{ccRefFunction} + +\begin{ccRefFunction}{copy_n} + This function is deprecated, \ccc{CGAL::cpp0x::copy_n} should be used instead. + \begin{ccDeprecated} + \label{sectionCopyN} + + \ccDefinition The function \ccRefName\ copies $n$ items from an + input iterator to an output iterator which is useful for possibly + infinite + sequences of random geometric objects.\footnote{% + The \stl\ release June 13, 1997, from SGI contains an equivalent + function, but it is not part of the ISO standard.} - \ccThree{OutputIterator}{copy_n}{} - \ccFunction{template OutputIterator copy_n(InputIterator first, Size n, - OutputIterator result);}{copies the first $n$ items from - \ccc{first} to \ccc{result}. Returns the value of \ccc{result} - after inserting the $n$ items.} + \ccInclude{CGAL/algorithm.h} - \ccSeeAlso - \ccRefIdfierPage{CGAL::Counting_iterator} + \ccThree{OutputIterator}{copy_n}{} + \ccFunction{template OutputIterator copy_n(InputIterator first, Size n, + OutputIterator result);}{copies the first $n$ items from + \ccc{first} to \ccc{result}. Returns the value of \ccc{result} + after inserting the $n$ items.} + + \ccSeeAlso + \ccRefIdfierPage{CGAL::Counting_iterator} + \end{ccDeprecated} \end{ccRefFunction} %% +---------------------------------------------+ diff --git a/STL_Extension/dont_submit b/STL_Extension/dont_submit new file mode 100644 index 00000000000..d83a1b2ff5c --- /dev/null +++ b/STL_Extension/dont_submit @@ -0,0 +1 @@ +benchmark diff --git a/STL_Extension/include/CGAL/Handle_with_policy.h b/STL_Extension/include/CGAL/Handle_with_policy.h index 8f89a75a5e5..64492a07654 100644 --- a/STL_Extension/include/CGAL/Handle_with_policy.h +++ b/STL_Extension/include/CGAL/Handle_with_policy.h @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -364,7 +364,7 @@ namespace Intern { typedef typename T::Allocator Alloc; typedef ::CGAL::Reference_counted_hierarchy_with_union Reference_counted_hierarchy_with_union; - BOOST_STATIC_ASSERT(( + CGAL_static_assertion(( ::CGAL::is_same_or_derived< Reference_counted_hierarchy_with_union, T >::value )); } typedef T Rep; @@ -768,7 +768,7 @@ private: static Rep_allocator allocator; static Rep* new_rep( const Rep& rep) { - BOOST_STATIC_ASSERT( !( + CGAL_static_assertion( !( ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value )); Rep* p = allocator.allocate(1); allocator.construct(p, rep); @@ -863,7 +863,7 @@ protected: //! argument, and the single argument template constructor no other //! constructor will work for class hierarchies of representations. Handle_with_policy( Rep* p) : ptr_( p) { - BOOST_STATIC_ASSERT(( + CGAL_static_assertion(( ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value )); //Bind bind_; // trigger compile-time check //(void)bind_; @@ -877,7 +877,7 @@ protected: //! version of \c initialize_with is applicable in this case except //! the template version with one argument. void initialize_with( Rep* p) { - BOOST_STATIC_ASSERT(( + CGAL_static_assertion(( ::CGAL::is_same_or_derived< Reference_counted_hierarchy_base, Handled_type >::value )); //Bind bind_; // trigger compile-time check //(void)bind_; diff --git a/STL_Extension/include/CGAL/algorithm.h b/STL_Extension/include/CGAL/algorithm.h index 48742a5b3ca..e7420e8fc94 100644 --- a/STL_Extension/include/CGAL/algorithm.h +++ b/STL_Extension/include/CGAL/algorithm.h @@ -56,12 +56,14 @@ namespace cpp0x { } // copy_n is usually in the STL as well, but not in the official -// standard. We provide our own copy_n. It is planned for C++0x. +// standard. We provide our own copy_n. It is planned for C++0x. +// Our own version is declared deprecated, if std::copy_n is +// available. +#ifndef CGAL_CFG_NO_CPP0X_COPY_N +#ifndef CGAL_NO_DEPRECATED_CODE template -OutputIterator copy_n( InputIterator first, - Size n, - OutputIterator result) +CGAL_DEPRECATED OutputIterator copy_n( InputIterator first, Size n, OutputIterator result ) { // copies the first `n' items from `first' to `result'. Returns // the value of `result' after inserting the `n' items. @@ -72,7 +74,29 @@ OutputIterator copy_n( InputIterator first, } return result; } +#endif // CGAL_NO_DEPRECATED_CODE +#else +template +OutputIterator copy_n( InputIterator first, Size n, OutputIterator result ) +{ + // copies the first `n' items from `first' to `result'. Returns + // the value of `result' after inserting the `n' items. + while( n--) { + *result = *first; + first++; + result++; + } + return result; +} +#endif // CGAL_CFG_NO_CPP0X_COPY_N +namespace cpp0x { +#ifndef CGAL_CFG_NO_CPP0X_COPY_N + using std::copy_n; +#else + using CGAL::copy_n; +#endif +} // cpp0x // Not documented template inline diff --git a/STL_Extension/test/STL_Extension/test_Cache.cpp b/STL_Extension/test/STL_Extension/test_Cache.cpp index 61f1e209eb9..8b44a30cf1c 100644 --- a/STL_Extension/test/STL_Extension/test_Cache.cpp +++ b/STL_Extension/test/STL_Extension/test_Cache.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include struct Int_rep { @@ -57,14 +57,14 @@ struct Int_t : public CGAL::Handle_with_policy< Int_rep, Unify > { void test_typedefs(){ typedef CGAL::Cache Cache; - BOOST_STATIC_ASSERT(( ::boost::is_same< Cache::Input, int >::value )); - BOOST_STATIC_ASSERT(( ::boost::is_same< Cache::Output,double>::value )); + CGAL_static_assertion(( ::boost::is_same< Cache::Input, int >::value )); + CGAL_static_assertion(( ::boost::is_same< Cache::Output,double>::value )); typedef CGAL::Creator_1 Creator_double; - BOOST_STATIC_ASSERT(( ::boost::is_same::value )); + CGAL_static_assertion(( ::boost::is_same::value )); typedef CGAL::Creator_1 Creator_int; - BOOST_STATIC_ASSERT(( ::boost::is_same::value )); - BOOST_STATIC_ASSERT(( ::boost::is_same >::value )); - BOOST_STATIC_ASSERT(( ::boost::is_same >::value )); + CGAL_static_assertion(( ::boost::is_same::value )); + CGAL_static_assertion(( ::boost::is_same >::value )); + CGAL_static_assertion(( ::boost::is_same >::value )); } int main(){ { diff --git a/STL_Extension/test/STL_Extension/test_stl_extension.cpp b/STL_Extension/test/STL_Extension/test_stl_extension.cpp index d10711c91af..9acf6aa308c 100644 --- a/STL_Extension/test/STL_Extension/test_stl_extension.cpp +++ b/STL_Extension/test/STL_Extension/test_stl_extension.cpp @@ -8994,10 +8994,10 @@ void test_tuple(){ typedef CGAL::cpp0x::tuple T2; - BOOST_STATIC_ASSERT( CGAL::cpp0x::tuple_size::value == 0 ); - BOOST_STATIC_ASSERT( CGAL::cpp0x::tuple_size::value == 2 ); - BOOST_STATIC_ASSERT( CGAL::cpp0x::tuple_size::value == 4 ); - BOOST_STATIC_ASSERT( (boost::is_same::type,My_to_int>::value) ); + CGAL_static_assertion( CGAL::cpp0x::tuple_size::value == 0 ); + CGAL_static_assertion( CGAL::cpp0x::tuple_size::value == 2 ); + CGAL_static_assertion( CGAL::cpp0x::tuple_size::value == 4 ); + CGAL_static_assertion( (boost::is_same::type,My_to_int>::value) ); T1 t1=CGAL::cpp0x::make_tuple(1,2); int i1=-1,i2=-1; @@ -9016,6 +9016,16 @@ void test_prev_next() CGAL_assertion(cpp0x::next(cpp0x::next(V.begin())) == cpp0x::prev(V.end())); } +void test_copy_n() { + std::vector V; + for(int i = 0; i < 10; ++i) + V.push_back(i); + + std::vector V2(5); + cpp0x::copy_n(V.begin(), 5, V2.begin()); + + CGAL_assertion(std::equal(V2.begin(), V2.end(), V.begin())); +} int main() { init_global_data(); @@ -9038,6 +9048,7 @@ int main() { clean_global_data(); test_tuple(); test_prev_next(); + test_copy_n(); return 0; } // EOF // diff --git a/Spatial_searching/demo/Spatial_searching/Qt3/spatial_searching.cpp b/Spatial_searching/demo/Spatial_searching/Qt3/spatial_searching.cpp index d8a65d7fd64..1a8ea5add72 100644 --- a/Spatial_searching/demo/Spatial_searching/Qt3/spatial_searching.cpp +++ b/Spatial_searching/demo/Spatial_searching/Qt3/spatial_searching.cpp @@ -171,7 +171,7 @@ private slots: typedef CGAL::Kd_tree Tree; std::list l, res; - CGAL::copy_n(vector_of_points.begin(), vector_of_points.size(), + CGAL::cpp0x::copy_n(vector_of_points.begin(), vector_of_points.size(), std::back_inserter(l)); std::cout << "construct tree with " << l.size() << " points" << std::endl; Tree d(l.begin(), l.end()); @@ -195,7 +195,7 @@ private slots: typedef CGAL::Kd_tree Tree; std::list l, res; - CGAL::copy_n(vector_of_points.begin(), vector_of_points.size(), + CGAL::cpp0x::copy_n(vector_of_points.begin(), vector_of_points.size(), std::back_inserter(l)); Tree d(l.begin(), l.end()); d.search( std::back_inserter( res ), exact_range); @@ -269,7 +269,7 @@ private slots: typedef CGAL::Kd_tree Tree; std::list l; - CGAL::copy_n(vector_of_points.begin(), vector_of_points.size(), + CGAL::cpp0x::copy_n(vector_of_points.begin(), vector_of_points.size(), std::back_inserter(l)); // Tree d(vector_of_points.begin(), vector_of_points.end(), tr); Neighbour_search::Tree d(l.begin(), l.end()); @@ -277,7 +277,7 @@ private slots: const int query_point_number=30; CGAL::Random_points_in_square_2 h( 1.0); std::vector query_points; - CGAL::copy_n( h, query_point_number, std::back_inserter(query_points)); + CGAL::cpp0x::copy_n( h, query_point_number, std::back_inserter(query_points)); std::vector nearest_neighbour; diff --git a/Spatial_searching/doc_tex/Spatial_searching_ref/Point_container.tex b/Spatial_searching/doc_tex/Spatial_searching_ref/Point_container.tex new file mode 100644 index 00000000000..725b3b66e49 --- /dev/null +++ b/Spatial_searching/doc_tex/Spatial_searching_ref/Point_container.tex @@ -0,0 +1,210 @@ +% +------------------------------------------------------------------------+ +% | Reference manual page: Point_container.tex +% +------------------------------------------------------------------------+ +% | 1.07.2001 Johan W.H. Tangelder +% | Package: ASPAS +% | +\RCSdef{\RCSPointcontainerRev}{$Id$} +\RCSdefDate{\RCSPointcontainerDate}{$Date$} +% | +%%RefPage: end of header, begin of main body +% +------------------------------------------------------------------------+ + + +\begin{ccRefClass}{Point_container} + +%% \ccHtmlCrossLink{} %% add further rules for cross referencing links +%% \ccHtmlIndexC[class]{} %% add further index entries + + +\begin{ccAdvanced} + + +\ccDefinition +A custom container for points used to build a tree. Each point container +holds the points from a rectangle associated with a node of the tree. +In the remainder of this reference page this rectangle is called the +associated rectangle. +Provides a method to split a container and a number of methods +to support the implementation of splitting rules. + +\ccInclude{CGAL/Point_container.h} + +\ccParameters + +Expects for the template argument an implementation for +$d$-dimensional points of the concept \ccc{SearchTraits}, for example +\ccc{CGAL::Cartesian_d}. + +\ccTypes + +\ccTypedef{Traits::FT FT;}{Number type.} +\ccTypedef{Traits::Point_d Point_d;}{Point type.} +\ccNestedType{iterator}{An iterator with value type \ccc{Point_d*}.} + +%---------------------------------------- +\ccCreation +\ccCreationVariable{c} + +\ccConstructor{Point_container(int d);} +{ +Construct an empty container for storing \ccc{d}-dimensional points. +} + +\ccConstructor{ +template +Point_container(int d, InputIterator begin, InputIterator end);} +{ +Construct the container of $d$-dimensional points of type \ccc{Point_d} +given by the iterator sequence \ccc{[begin, end)}.} + + + +\ccOperations + +\ccMethod{template +void split(Point_container &c2, SpatialSeparator sep, bool sliding=false);} +{Given an empty container \ccc{c2} with the same dimension as \ccVar, splits \ccVar\ into +\ccVar and \ccc{c2} using the separator \ccc{sep}. If sliding is \ccc{true} after splitting +each container contains at least one point. Container \ccVar\ should contain at least two points.} + + +\ccMethod{void swap(Point_container &c2);} +{Swap the contents of \ccVar\ and \ccc{c2}} + + +\ccMethod{void recompute_tight_bounding_box();} +{Recompute the bounding box of the points in the container.} + + +\ccMethod{iterator begin();} +{ +Return an iterator pointing to the pointer to the first point. +} + +\ccMethod{iterator end();} +{ +Return the iterator to the corresponding past-the-end iterator. +} + +\ccMethod{int dimension() const;} +{ +Return the dimension. +} + +\ccMethod{int built_coordinate();} +{ +Return coordinate for which the pointer list is built. +} + +\ccMethod{int max_span_coord();} +{ +Return coordinate where the associated rectangle has maximal span. +} + +\ccMethod{int max_tight_span_coord();} +{ +Return coordinate where the point coordinates have maximal span. +} + +\ccMethod{FT max_span_lower();} +{ +Return lower value of the interval corresponding to +\ccc{max_span_coord()}. +} + + +\ccMethod{FT max_tight_span_lower();} +{ +Return lower value of the interval corresponding to +\ccc{max_tight_span_coord()}. That is, the smallest +\ccc{max_tight_span_coord()}-th coordinate of the points in +\ccVar. +} + + +\ccMethod{FT max_span_upper();} +{ +Return upper value of the interval corresponding to +\ccc{max_span_coord()}. +} + +\ccMethod{FT max_span_upper_without_dim(int d);} +{ +Return upper value of the interval over all dimensions +without taking dimension \ccc{d} into account. +} + +\ccMethod{FT max_tight_span_upper();} +{ +Return upper value of the interval corresponding to +\ccc{max_tight_span_coord()}. +} + +\ccMethod{FT max_spread();} +{ +Return the size of the interval corresponding to \ccc{max_span_coord()}. +} + +\ccMethod{FT max_tight_spread();} +{ +Return the size of the interval corresponding to \ccc{max_tight_span_coord()}. +} + +\ccMethod{FT median(int split_coord);} +{ +Return the median value of the points stored in the container for +dimension \ccc{split_coord}. +} + +\ccMethod{const Kd_tree_rectangle & bounding_box();} +{Return the associated rectangle.} + +\ccMethod{const Kd_tree_rectangle & tight_bounding_box();} +{Return the bounding box of the items in associated rectangle.} + +\ccMethod{int max_tight_span_coord_balanced(FT aspect_ratio);} +{Return the dimension with the maximal point spread, for which after fair splitting +the ratio of the length of the longest side and the smallest side of the bounding box of +the items in associated rectangle, +does not exceed \ccc{aspect_ratio}.} + +\ccMethod{FT balanced_fair(int d, FT aspect_ratio);} +{Return the splitting value for fair splitting.} + +\ccMethod{FT balanced_sliding_fair(int d, FT aspect_ratio);} +{Return the splitting value for sliding fair splitting.} + +\ccMethod{int size();} +{ +Return the number of points stored. +} + +\ccMethod{bool empty();} +{ +Return true if no points are present, false otherwise. +} + + + + +\ccHeading{Output Routines} + +\ccFunction{ template +std::ostream& operator<<(std::ostream& s, Point_container c);} +{Prints the point container \ccVar\ to the output stream \ccc{s} and returns \ccc{s}.} + + +\ccSeeAlso + +\ccc{SearchTraits}\\ +\ccc{SpatialSeparator} + +\end{ccAdvanced} +\end{ccRefClass} + +% +------------------------------------------------------------------------+ +%%RefPage: end of main body, begin of footer +% EOF +% +------------------------------------------------------------------------+ + diff --git a/Spatial_searching/doc_tex/Spatial_searching_ref/Search_traits_adapter.tex b/Spatial_searching/doc_tex/Spatial_searching_ref/Search_traits_adapter.tex index 9936fb63f87..ad397d7c07b 100644 --- a/Spatial_searching/doc_tex/Spatial_searching_ref/Search_traits_adapter.tex +++ b/Spatial_searching/doc_tex/Spatial_searching_ref/Search_traits_adapter.tex @@ -14,7 +14,6 @@ must be used as distance. \ccc{Key} is a type that is associated to a point of type \ccc{Base_distance::Point_d}.\\ \ccc{PointPropertyMap} is a model of \ccAnchor{http://www.boost.org/doc/libs/release/libs/property_map/doc/ReadablePropertyMap.html}{boost::ReadablePropertyMap} with \ccc{Key} as \ccc{key_type} and \ccc{Base_distance::Point_d} as \ccc{value_type}.\\ -In practice, the current implementation requires a class providing \ccc{BaseTraits::Point_d operator[] (const Key& point) const}.\\ \ccc{BaseTraits} is a model of either \ccc{SearchTraits} or \ccc{RangeSearchTraits}. \ccInheritsFrom diff --git a/Spatial_searching/doc_tex/Spatial_searching_ref/Splitter.tex b/Spatial_searching/doc_tex/Spatial_searching_ref/Splitter.tex index 76122930cd6..0ca645ca127 100644 --- a/Spatial_searching/doc_tex/Spatial_searching_ref/Splitter.tex +++ b/Spatial_searching/doc_tex/Spatial_searching_ref/Splitter.tex @@ -35,6 +35,7 @@ The concept \ccRefName\ defines the requirements for a function object class imp \ccNestedType{FT}{Number type.} \ccNestedType{Separator}{Separator.} +\ccNestedType{Container}{Typedef to an instantiation of \ccc{CGAL::Point_container}.} \ccCreationVariable{s} %% choose variable name @@ -49,8 +50,11 @@ of a cell allowed for fair splitting.} \ccMethod{unsigned int bucket_size();} {Returns the bucket size of the leaf nodes.} - - +\ccMethod{void operator()(Separator& sep, Container& c0, Container& c1) const;} +{ + Sets up \ccc{sep} and splits points of \ccc{c0} into \ccc{c0} and \ccc{c1} using \ccc{sep}. + Container \ccc{c0} should contain at least two points and \ccc{c1} must be empty. +} \end{ccAdvanced} diff --git a/Spatial_searching/doc_tex/Spatial_searching_ref/intro.tex b/Spatial_searching/doc_tex/Spatial_searching_ref/intro.tex index d567db95d27..9557c80bc93 100644 --- a/Spatial_searching/doc_tex/Spatial_searching_ref/intro.tex +++ b/Spatial_searching/doc_tex/Spatial_searching_ref/intro.tex @@ -83,7 +83,8 @@ classes that are described in the reference pages. \ccRefIdfierPage{CGAL::Kd_tree_node} \\ \ccRefIdfierPage{CGAL::Kd_tree_rectangle} \\ -\ccRefIdfierPage{CGAL::Plane_separator} +\ccRefIdfierPage{CGAL::Plane_separator} \\ +\ccRefIdfierPage{CGAL::Point_container} \ccHeading{Concepts} @@ -93,7 +94,8 @@ classes that are described in the reference pages. \ccRefConceptPage{SearchTraits} \\ \ccRefConceptPage{RangeSearchTraits} \\ \ccRefConceptPage{SpatialSeparator} \\ -\ccRefConceptPage{SpatialTree} +\ccRefConceptPage{SpatialTree}\\ +\ccRefConceptPage{Splitter} diff --git a/Spatial_searching/doc_tex/Spatial_searching_ref/main.tex b/Spatial_searching/doc_tex/Spatial_searching_ref/main.tex index aef7c3eee70..ea49759d2b7 100644 --- a/Spatial_searching/doc_tex/Spatial_searching_ref/main.tex +++ b/Spatial_searching/doc_tex/Spatial_searching_ref/main.tex @@ -28,6 +28,7 @@ \input{Spatial_searching_ref/Orthogonal_incremental_neighbor_search.tex} \input{Spatial_searching_ref/Orthogonal_k_neighbor_search.tex} \input{Spatial_searching_ref/Plane_separator.tex} +\input{Spatial_searching_ref/Point_container.tex} \input{Spatial_searching_ref/SearchTraits.tex} \input{Spatial_searching_ref/RangeSearchTraits.tex} diff --git a/Spatial_searching/test/Spatial_searching/Building_kd_tree_with_ddim_points.cpp b/Spatial_searching/test/Spatial_searching/Building_kd_tree_with_ddim_points.cpp index 48f3ee6a1eb..61d06222cef 100644 --- a/Spatial_searching/test/Spatial_searching/Building_kd_tree_with_ddim_points.cpp +++ b/Spatial_searching/test/Spatial_searching/Building_kd_tree_with_ddim_points.cpp @@ -43,6 +43,7 @@ void run(const std::vector& points,const Point& query) boost::make_transform_iterator(points.begin(),Create_point_with_info()), boost::make_transform_iterator(points.end(),Create_point_with_info()) ); + o_tree.statistics(std::cout); typename K_search::Tree tree( @@ -97,7 +98,7 @@ int main() { std::vector points; Point_generator g(3); - CGAL::copy_n( g, N, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, N, std::back_inserter(points)); g++; Point query = *g; diff --git a/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp b/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp index 10a1250f5fb..cc38a1e7632 100644 --- a/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp +++ b/Spatial_searching/test/Spatial_searching/Orthogonal_incremental_neighbor_search.cpp @@ -55,7 +55,7 @@ void run() // in a register with a distance in memory CGAL::Set_ieee_double_precision pfr; - CGAL::copy_n( g, 1000, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, 1000, std::back_inserter(points)); typename K_search::Tree t( boost::make_transform_iterator(points.begin(),Create_point_with_info()), diff --git a/Spatial_searching/test/Spatial_searching/Splitters.cpp b/Spatial_searching/test/Spatial_searching/Splitters.cpp index a27e35ebeea..56ccdb93fb6 100644 --- a/Spatial_searching/test/Spatial_searching/Splitters.cpp +++ b/Spatial_searching/test/Spatial_searching/Splitters.cpp @@ -91,7 +91,7 @@ main() { Vector points; Random_points g( 150.0); - CGAL::copy_n( g, 1000, std::back_inserter(points)); + CGAL::cpp0x::copy_n( g, 1000, std::back_inserter(points)); g++; Point query = *g; diff --git a/Surface_mesher/include/CGAL/Point_traits.h b/Surface_mesher/include/CGAL/Point_traits.h index 712dd2ae233..96879525193 100644 --- a/Surface_mesher/include/CGAL/Point_traits.h +++ b/Surface_mesher/include/CGAL/Point_traits.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include namespace CGAL { diff --git a/Surface_mesher/include/CGAL/Surface_mesher/Combining_oracle.h b/Surface_mesher/include/CGAL/Surface_mesher/Combining_oracle.h index 6d8e552cd21..81482e86483 100644 --- a/Surface_mesher/include/CGAL/Surface_mesher/Combining_oracle.h +++ b/Surface_mesher/include/CGAL/Surface_mesher/Combining_oracle.h @@ -26,7 +26,7 @@ #include -#include +#include #include namespace CGAL { @@ -53,7 +53,7 @@ namespace CGAL { typedef typename Oracle_a::Intersection_point Intersection_point; - BOOST_STATIC_ASSERT((::boost::is_same< + CGAL_static_assertion((::boost::is_same< Intersection_point, typename Oracle_b::Intersection_point>::value)); diff --git a/Surface_mesher/include/CGAL/Weighted_point_with_surface_index.h b/Surface_mesher/include/CGAL/Weighted_point_with_surface_index.h index 9dbfcc45c50..70269987ab5 100644 --- a/Surface_mesher/include/CGAL/Weighted_point_with_surface_index.h +++ b/Surface_mesher/include/CGAL/Weighted_point_with_surface_index.h @@ -21,7 +21,7 @@ #define CGAL_WEIGHTED_POINT_WITH_SURFACE_INDEX_H #include -#include +#include #include #include @@ -36,10 +36,10 @@ class Weighted_point_with_surface_index : public Weighted_point typedef typename Point_traits::Bare_point Bare_point; typedef typename Kernel_traits::Kernel::FT FT; - BOOST_STATIC_ASSERT((Is_weighted::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); + CGAL_static_assertion((::boost::is_same::value)); - BOOST_STATIC_ASSERT((::boost::is_same::value)); public: diff --git a/Triangulation_2/examples/Triangulation_2/hierarchy.cpp b/Triangulation_2/examples/Triangulation_2/hierarchy.cpp index 879fdb2cd73..677a7398240 100644 --- a/Triangulation_2/examples/Triangulation_2/hierarchy.cpp +++ b/Triangulation_2/examples/Triangulation_2/hierarchy.cpp @@ -21,7 +21,7 @@ int main( ) std::cout << "insertion of 1000 random points" << std::endl; Triangulation t; CGAL::Random_points_in_square_2 g(1.); - CGAL::copy_n( g, 1000, std::back_inserter(t)); + CGAL::cpp0x::copy_n( g, 1000, std::back_inserter(t)); //verbose mode of is_valid ; shows the number of vertices at each level std::cout << "The number of vertices at successive levels" << std::endl; diff --git a/Triangulation_2/include/CGAL/Triangulation_2.h b/Triangulation_2/include/CGAL/Triangulation_2.h index 8c37b6ce222..03b636dd79c 100644 --- a/Triangulation_2/include/CGAL/Triangulation_2.h +++ b/Triangulation_2/include/CGAL/Triangulation_2.h @@ -3328,11 +3328,11 @@ side_of_oriented_circle(const Point &p0, const Point &p1, const Point &p2, // We successively look whether the leading monomial, then 2nd monomial // of the determinant has non null coefficient. - // 2 iterations are enough (cf paper) + // 2 iterations are enough if p0p1p2 is positive (cf paper) for (int i=3; i>0; --i) { if (points[i] == &p) return ON_NEGATIVE_SIDE; // since p0 p1 p2 are non collinear - // and positively oriented + // and "conceptually" positively oriented Orientation o; if (points[i] == &p2 && (o = orientation(p0,p1,p)) != COLLINEAR ) return Oriented_side(o); @@ -3341,7 +3341,8 @@ side_of_oriented_circle(const Point &p0, const Point &p1, const Point &p2, if (points[i] == &p0 && (o = orientation(p,p1,p2)) != COLLINEAR ) return Oriented_side(o); } - CGAL_triangulation_assertion(false); + // CGAL_triangulation_assertion(false); + //no reason for such precondition and it invalidates fast removal in Delaunay return ON_NEGATIVE_SIDE; } diff --git a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_hierarchy_2.h b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_hierarchy_2.h index 0b1b5a8955e..7772ddfba27 100644 --- a/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_hierarchy_2.h +++ b/Triangulation_2/test/Triangulation_2/include/CGAL/_test_cls_delaunay_hierarchy_2.h @@ -40,7 +40,7 @@ _test_cls_delaunay_hierarchy_2( const Dh & ) std::cout << " insertion removal of 1000 points" << std::endl; Delaunay_hierarchy dh; CGAL::Random_points_in_square_2 g(1.); - CGAL::copy_n( g, 1000, std::back_inserter(dh)); + CGAL::cpp0x::copy_n( g, 1000, std::back_inserter(dh)); dh.locate(Point(0.,0.)); diff --git a/Triangulation_3/demo/Triangulation_3/Scene.cpp b/Triangulation_3/demo/Triangulation_3/Scene.cpp index 8dae8c1aa8d..fe49f5d1b70 100644 --- a/Triangulation_3/demo/Triangulation_3/Scene.cpp +++ b/Triangulation_3/demo/Triangulation_3/Scene.cpp @@ -27,7 +27,7 @@ void Scene::generatePoints(int num) /* Insert them into the point list: */ /* 1. use CGAL's copy function --tested */ list pts; - CGAL::copy_n( pts_generator, num, std::back_inserter(pts) ); + CGAL::cpp0x::copy_n( pts_generator, num, std::back_inserter(pts) ); /* 2. use STL's function */ //for (int i=0; im_dt.number_of_vertices() == 0 ) { CGAL::Random_points_in_cube_3 pts_generator(1.0); - CGAL::copy_n( pts_generator, 100, std::back_inserter(m_incrementalPts) ); + CGAL::cpp0x::copy_n( pts_generator, 100, std::back_inserter(m_incrementalPts) ); } else { for(QList::iterator vit = m_pScene->m_vhArray.begin(); vit < m_pScene->m_vhArray.end(); ++vit) {