From 848abdbe5a9e5ed6e8a54c232d1de558595f6c6c Mon Sep 17 00:00:00 2001 From: Michael Hoffmann Date: Fri, 6 Jul 2001 13:07:33 +0000 Subject: [PATCH] Use new functor adaptors. Worked over traits classes -> Kernel Traits. --- .../all_furthest_neighbors_2_demo.C | 21 +- .../Matrix_search/extremal_polygon_2_demo.C | 43 +- .../rectangular_p_center_2_demo.C | 77 +- .../all_furthest_neighbors_2_example_nohead.C | 4 - .../extremal_polygon_2_example_area.C | 7 +- .../extremal_polygon_2_example_perimeter.C | 7 +- .../rectangular_p_center_2_example_nohead.C | 19 +- .../sorted_matrix_search_example_nohead.C | 6 +- .../spec_all_furthest_neighbors.tex | 107 +-- .../spec_extremal_polygons.tex | 147 ++-- .../spec_rectangular_p_centers.tex | 193 +---- .../spec_sorted_matrix_search.tex | 10 +- .../all_furthest_neighbors_2_example_nohead.C | 4 - .../extremal_polygon_2_example_area.C | 7 +- .../extremal_polygon_2_example_perimeter.C | 7 +- .../rectangular_p_center_2_example_nohead.C | 19 +- .../sorted_matrix_search_example_nohead.C | 6 +- .../spec_all_furthest_neighbors.tex | 107 +-- .../spec_extremal_polygons.tex | 147 ++-- .../spec_rectangular_p_centers.tex | 193 +---- .../spec_sorted_matrix_search.tex | 10 +- .../all_furthest_neighbors_2_example.C | 1 - .../extremal_polygon_2_example.C | 7 +- .../rectangular_p_center_2_example.C | 16 +- .../sorted_matrix_search_example.C | 3 +- .../include/CGAL/Cartesian_matrix.h | 2 - .../include/CGAL/Extremal_polygon_traits_2.h | 207 ++--- .../CGAL/Rectangular_p_center_traits_2.h | 227 +----- .../include/CGAL/all_furthest_neighbors_2.h | 58 +- .../include/CGAL/extremal_polygon_2.h | 6 +- .../include/CGAL/pierce_rectangles_2.h | 107 ++- .../include/CGAL/rectangular_3_center_2.h | 742 +++++++++--------- .../CGAL/rectangular_3_center_2_msvc.h | 618 +++++++-------- .../include/CGAL/rectangular_p_center_2.h | 24 +- .../include/CGAL/sorted_matrix_search.h | 45 +- .../all_furthest_neighbors_2_test.C | 1 - .../Matrix_search/extremal_polygon_2_test.C | 18 +- .../rectangular_p_center_2_random1_test.C | 17 +- .../rectangular_p_center_2_random2_test.C | 17 +- .../Matrix_search/sorted_matrix_search_test.C | 5 +- Packages/Matrix_search/version | 2 +- 41 files changed, 1323 insertions(+), 1941 deletions(-) diff --git a/Packages/Matrix_search/demo/Matrix_search/all_furthest_neighbors_2_demo.C b/Packages/Matrix_search/demo/Matrix_search/all_furthest_neighbors_2_demo.C index b2c7cf4e8dc..fb5acd2f804 100644 --- a/Packages/Matrix_search/demo/Matrix_search/all_furthest_neighbors_2_demo.C +++ b/Packages/Matrix_search/demo/Matrix_search/all_furthest_neighbors_2_demo.C @@ -26,10 +26,11 @@ // ============================================================================ -#ifdef CGAL_USE_LEDA +#include + +#if (defined(CGAL_USE_LEDA) || defined(CGAL_USE_CGAL_WINDOW)) #include -#include #include #include #include @@ -54,7 +55,9 @@ using CGAL::all_furthest_neighbors_2; using CGAL::cgalize; using CGAL::RED; + typedef double FT; +typedef CGAL::Window_stream Window; typedef Cartesian< FT > R; typedef CGAL::Point_2< R > Point; typedef Polygon_traits_2< R > P_traits; @@ -64,19 +67,23 @@ typedef CGAL::Polygon_2< P_traits, Point_cont > Polygon; typedef Creator_uniform_2< FT, Point > Creator; typedef Random_points_in_square_2< Point, Creator > Point_generator; void -wait_for_button_release( leda_window& W) +wait_for_button_release( Window& W) { // wait until mouse button is released double x, y; int v; do {} +#ifdef CGAL_USE_LEDA while ( W.read_event( v, x, y) != button_release_event); +#else + while ( W.read_event( v, x, y) != CGAL::button_release_event); +#endif // CGAL_USE_LEDA } int main() { - leda_window W; + Window W; cgalize(W); W.init(-1.25, 1.25, -1.25); W.display(); @@ -104,8 +111,12 @@ main() p.vertices_end(), back_inserter( neighbors)); // output solution: + #ifdef CGAL_USE_LEDA W.set_mode(leda_xor_mode); - W.set_fg_color(leda_blue); + #else + W.set_mode(CGAL::xor_mode); + #endif // CGAL_USE_LEDA + W << CGAL::BLUE; // first click, no need to clear old query from screen: int last_button; int nearest = 0; diff --git a/Packages/Matrix_search/demo/Matrix_search/extremal_polygon_2_demo.C b/Packages/Matrix_search/demo/Matrix_search/extremal_polygon_2_demo.C index a202bb3cea4..7be4be527b4 100644 --- a/Packages/Matrix_search/demo/Matrix_search/extremal_polygon_2_demo.C +++ b/Packages/Matrix_search/demo/Matrix_search/extremal_polygon_2_demo.C @@ -26,7 +26,9 @@ // ============================================================================ -#ifdef CGAL_USE_LEDA +#include + +#if (defined(CGAL_USE_LEDA) || defined(CGAL_USE_CGAL_WINDOW)) #include #include @@ -37,7 +39,7 @@ #include #include #include -#include +#include #include #include #include @@ -47,9 +49,11 @@ using CGAL::cgalize; using CGAL::Timer; using CGAL::has_smaller_dist_to_point; using CGAL::RED; +using CGAL::BLUE; using std::back_inserter; using std::copy; using std::max; +typedef CGAL::Window_stream Window; using std::vector; using CGAL::Cartesian; @@ -63,14 +67,13 @@ using CGAL::Creator_uniform_2; using CGAL::random_convex_set_2; typedef double FT; -typedef Cartesian< FT > RepClass; -typedef CGAL::Point_2< RepClass > Point; -typedef CGAL::Segment_2< RepClass > Segment; +typedef Cartesian< FT > K; +typedef K::Point_2 Point; +typedef K::Segment_2 Segment; typedef vector< Point > PointCont; typedef PointCont::iterator PointIter; typedef vector< PointIter > PointIterCont; typedef PointIterCont::iterator PointIterIter; -typedef RepClass::FT FT; typedef PointCont Polygon; typedef PointCont::iterator Vertex_iterator; typedef Random_access_circulator_from_container< Polygon > @@ -81,19 +84,23 @@ typedef Vertex_iteratorCont::iterator Vertex_iteratorIter; void -wait_for_button_release( leda_window& W) +wait_for_button_release( Window& W) { // wait until mouse button is released double x, y; int v; do {} +#ifdef CGAL_USE_LEDA while ( W.read_event( v, x, y) != button_release_event); +#else + while ( W.read_event( v, x, y) != CGAL::button_release_event); +#endif // CGAL_USE_LEDA } int main() { - leda_window W( 650, 650); + Window W( 650, 650); int k( 3); W.int_item( "k", k, 2, 12, "#vertices of polygon to inscribe"); int n( 3); @@ -151,8 +158,7 @@ main() if ( !p.empty()) { Vertex_const_iterator i( p.begin()); for (;;) { - W << RED << *i; - W.set_fg_color( leda_blue); + W << RED << *i << BLUE; #ifndef _MSC_VER if ( (i+1) == p.end()) #else @@ -198,7 +204,7 @@ main() t.stop(); cout << "[time: " << t.time() << " msec]" << endl; #endif // EXTREMAL_POLYGON_MEASURE - W.set_fg_color(leda_green); + W << CGAL::GREEN; if ( !p.empty()) { PointIter i( k_gon.begin()); while ( ++i != k_gon.end()) @@ -231,7 +237,7 @@ main() t.stop(); cout << "[time: " << t.time() << " msec]" << endl; #endif // EXTREMAL_POLYGON_MEASURE - W.set_fg_color( leda_orange); + W << CGAL::ORANGE; if ( !p.empty()) { PointIter i( k_gon.begin()); while ( ++i != k_gon.end()) @@ -259,8 +265,13 @@ main() // test for snapping: if ( squared_distance( *nearest, Point( x, y)) < FT( 0.05)) { int v( 0); + #ifdef CGAL_USE_LEDA leda_drawing_mode old_drawing_mode( W.set_mode( leda_xor_mode)); leda_color old_color( W.set_color( leda_grey1)); + #else + CGAL::drawing_mode old_drawing_mode = W.set_mode( CGAL::xor_mode); + CGAL::color old_color = W.set_color( CGAL::grey1); + #endif // CGAL_USE_LEDA x = (*nearest).x(); y = (*nearest).y(); do { @@ -312,8 +323,12 @@ main() // set new point: *nearest = Point( x, y); - } while ( W.read_event( v, x, y) != button_release_event); - + } + #ifdef CGAL_USE_LEDA + while ( W.read_event( v, x, y) != button_release_event); + #else + while ( W.read_event( v, x, y) != CGAL::button_release_event); + #endif // CGAL_USE_LEDA // restore parameters of W: W.set_mode( old_drawing_mode); diff --git a/Packages/Matrix_search/demo/Matrix_search/rectangular_p_center_2_demo.C b/Packages/Matrix_search/demo/Matrix_search/rectangular_p_center_2_demo.C index 0b4b6aa23b7..2881f3cc88f 100644 --- a/Packages/Matrix_search/demo/Matrix_search/rectangular_p_center_2_demo.C +++ b/Packages/Matrix_search/demo/Matrix_search/rectangular_p_center_2_demo.C @@ -26,18 +26,21 @@ // ============================================================================ -#ifdef CGAL_USE_LEDA +#include + +#if (defined(CGAL_USE_LEDA) || defined(CGAL_USE_CGAL_WINDOW)) #include -#include -#include -#include #include #include -//#include -#include #include #include +#include +#include +#include +#ifdef CGAL_USE_LEDA +#include +#endif // CGAL_USE_LEDA #include #include #include @@ -53,7 +56,6 @@ using std::copy; using std::back_inserter; using std::ostream_iterator; using std::transform; -using std::bind2nd; using std::cin; using std::cout; using std::cerr; @@ -70,6 +72,7 @@ using CGAL::set_pretty_mode; using CGAL::set_ascii_mode; using CGAL::cgalize; using CGAL::Timer; +using CGAL::bind_2; using CGAL::BLUE; using CGAL::RED; using CGAL::ORANGE; @@ -155,26 +158,25 @@ private: #undef Base #endif // _MSC_VER -// typedefs -//typedef Filtered_exact< double, leda_real > FT; -//typedef double FT; -typedef leda_real FT; -typedef Cartesian< FT > R; -typedef CGAL::Point_2< R > Point; -typedef CGAL::Iso_rectangle_2< R > Square_2; -typedef vector< Point > Point_cont; -typedef Point_cont::iterator iterator; -typedef Random_points_in_square_2< Point > Point_generator_square; -typedef Random_points_in_disc_2< Point > Point_generator_disc; -typedef Random_p_clusters_2< Point > Point_generator_cluster; -typedef Ostream_iterator< Point, leda_window > - Window_stream_iterator_point; -typedef Ostream_iterator< Square_2, leda_window > - Window_stream_iterator_square; -typedef ostream_iterator< Point > Ostream_iterator_point; -typedef ostream_iterator< Square_2 > Ostream_iterator_square; -typedef Istream_iterator< Point, leda_window> - Istream_iterator_point; +#ifdef CGAL_USE_LEDA +typedef leda_real FT; +#else +typedef double FT; +#endif // CGAL_USE_LEDA +typedef CGAL::Window_stream Window; +typedef Cartesian< FT > K; +typedef K::Point_2 Point; +typedef K::Iso_rectangle_2 Square_2; +typedef vector< Point > Point_cont; +typedef Point_cont::iterator iterator; +typedef Random_points_in_square_2< Point > Point_generator_square; +typedef Random_points_in_disc_2< Point > Point_generator_disc; +typedef Random_p_clusters_2< Point > Point_generator_cluster; +typedef Ostream_iterator< Point, Window > Window_stream_iterator_point; +typedef Ostream_iterator< Square_2, Window > Window_stream_iterator_square; +typedef ostream_iterator< Point > Ostream_iterator_point; +typedef ostream_iterator< Square_2 > Ostream_iterator_square; +typedef Istream_iterator< Point, Window > Istream_iterator_point; @@ -184,6 +186,7 @@ template < class Point, class FT, class Box > struct Build_box : public CGAL_STD::binary_function< Point, FT, Box > { + typedef CGAL::Arity_tag< 2 > Arity; Box operator()(const Point& p, const FT& r) const { @@ -208,7 +211,7 @@ main(int argc, char* argv[]) #ifndef CGAL_PCENTER_NO_SHOW // init CGAL stuff: - leda_window W(730, 690); + Window W(730, 690); cgalize(W); W.set_node_width(2); W.init(-1.5, 1.5, -1.2); @@ -336,7 +339,7 @@ main(int argc, char* argv[]) << " and " << number_of_piercing_points << " points." << endl; #ifdef CGAL_PCENTER_CHECK - CGAL::Infinity_distance_2< R > dist; + CGAL::Infinity_distance_2< K > dist; for (iterator i = input_points.begin(); i != input_points.end(); ++i) { iterator j = centers.begin(); do { @@ -369,21 +372,21 @@ main(int argc, char* argv[]) transform(centers.begin(), centers.end(), wout_s, - bind2nd(Build_square(), result / FT(2))); + bind_2(Build_square(), result / FT(2))); #endif // CGAL_PCENTER_NO_SHOW #ifndef _MSC_VER transform(centers.begin(), centers.end(), cout_s, - bind2nd(Build_square(), result / FT(2))); + bind_2(Build_square(), result / FT(2))); cerr << endl; #endif // _MSC_VER #ifdef CGAL_PCENTER_CHECK // check that there is at least one square with two points // on opposite sides - CGAL::Signed_x_distance_2< R > xdist; - CGAL::Signed_y_distance_2< R > ydist; + CGAL::Signed_x_distance_2< K > xdist; + CGAL::Signed_y_distance_2< K > ydist; bool boundary = false; for (iterator i = centers.begin(); i != centers.end(); ++i) { int left = 0, right = 0, bottom = 0, top = 0; @@ -488,16 +491,16 @@ main(int argc, char* argv[]) } else if (input == ps_button) { iterator xmin = std::min_element(input_points.begin(), input_points.end(), - CGAL::Less_x_2< R >()); + K::Less_x_2()); iterator xmax = std::max_element(input_points.begin(), input_points.end(), - CGAL::Less_x_2< R >()); + K::Less_x_2()); iterator ymin = std::min_element(input_points.begin(), input_points.end(), - CGAL::Less_y_2< R >()); + K::Less_y_2()); iterator ymax = std::max_element(input_points.begin(), input_points.end(), - CGAL::Less_y_2< R >()); + K::Less_y_2()); FT scale; if (input_points.size() > 0) scale = std::max(xmax->x() - xmin->x(), ymax->y() - ymin->y()); diff --git a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/all_furthest_neighbors_2_example_nohead.C b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/all_furthest_neighbors_2_example_nohead.C index 7dd493bb2bb..9c9476267f1 100644 --- a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/all_furthest_neighbors_2_example_nohead.C +++ b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/all_furthest_neighbors_2_example_nohead.C @@ -1,7 +1,4 @@ -#line 1492 "mon_search.aw" -#line 775 "afn.awi" #include -#include #include #include #include @@ -41,4 +38,3 @@ main() return 0; } -#line 1493 "mon_search.aw" diff --git a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/extremal_polygon_2_example_area.C b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/extremal_polygon_2_example_area.C index 5a9e6c20c72..9b0b4030a2a 100644 --- a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/extremal_polygon_2_example_area.C +++ b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/extremal_polygon_2_example_area.C @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -12,9 +11,9 @@ using CGAL::random_convex_set_2; using CGAL::maximum_area_inscribed_k_gon_2; typedef double FT; -typedef CGAL::Cartesian< FT > R; -typedef CGAL::Point_2< R > Point; -typedef CGAL::Polygon_traits_2< R > P_traits; +typedef CGAL::Cartesian< FT > K; +typedef K::Point_2 Point; +typedef CGAL::Polygon_traits_2< K > P_traits; typedef vector< Point > Cont; typedef CGAL::Polygon_2< P_traits, Cont > Polygon; typedef CGAL::Creator_uniform_2< FT, Point > Creator; diff --git a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/extremal_polygon_2_example_perimeter.C b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/extremal_polygon_2_example_perimeter.C index 433cf6fceef..2f34a8a2a58 100644 --- a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/extremal_polygon_2_example_perimeter.C +++ b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/extremal_polygon_2_example_perimeter.C @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -12,9 +11,9 @@ using CGAL::random_convex_set_2; using CGAL::maximum_perimeter_inscribed_k_gon_2; typedef double FT; -typedef CGAL::Cartesian< FT > R; -typedef CGAL::Point_2< R > Point; -typedef CGAL::Polygon_traits_2< R > P_traits; +typedef CGAL::Cartesian< FT > K; +typedef K::Point_2 Point; +typedef CGAL::Polygon_traits_2< K > P_traits; typedef vector< Point > Cont; typedef CGAL::Polygon_2< P_traits, Cont > Polygon; typedef CGAL::Creator_uniform_2< FT, Point > Creator; diff --git a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/rectangular_p_center_2_example_nohead.C b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/rectangular_p_center_2_example_nohead.C index 6cff5a78730..511e47fb945 100644 --- a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/rectangular_p_center_2_example_nohead.C +++ b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/rectangular_p_center_2_example_nohead.C @@ -1,7 +1,4 @@ -#line 726 "pcenter.aw" -#line 599 "pc_testprog.awi" #include -#include #include #include #include @@ -14,14 +11,13 @@ using namespace std; using CGAL::set_pretty_mode; using CGAL::rectangular_p_center_2; -typedef double FT; -typedef CGAL::Cartesian< FT > R; -typedef CGAL::Point_2< R > Point; -typedef std::vector< Point > Cont; -typedef CGAL::Creator_uniform_2< FT, Point > Creator; -typedef CGAL::Random_points_in_square_2< Point, Creator > - Point_generator; -typedef CGAL::Ostream_iterator< Point, ostream > Ostream_iterator_point; +typedef double FT; +typedef CGAL::Cartesian< FT > K; +typedef K::Point_2 Point; +typedef std::vector< Point > Cont; +typedef CGAL::Creator_uniform_2< FT, Point > Creator; +typedef CGAL::Random_points_in_square_2< Point, Creator > Point_generator; +typedef CGAL::Ostream_iterator< Point, ostream > Ostream_iterator_point; int main() { @@ -52,4 +48,3 @@ int main() { return 0; } -#line 727 "pcenter.aw" diff --git a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/sorted_matrix_search_example_nohead.C b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/sorted_matrix_search_example_nohead.C index 589f442a79c..710b35cb24f 100644 --- a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/sorted_matrix_search_example_nohead.C +++ b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/sorted_matrix_search_example_nohead.C @@ -1,7 +1,4 @@ -#line 355 "fj_testprog.awi" -#line 293 "fj_testprog.awi" #include -#include #include #include #include @@ -43,11 +40,10 @@ int main() { &M, &M + 1, sorted_matrix_search_traits_adaptor( - bind2nd( greater_equal< Value >(), bound), + bind_2( greater_equal< Value >(), bound), M))); cout << "upper bound for " << bound << " is " << upper_bound << endl; return 0; } -#line 356 "fj_testprog.awi" diff --git a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex index 64d2028a9bd..b337f4ee9f1 100644 --- a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex +++ b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex @@ -22,10 +22,10 @@ \def\ccLongParamLayout{\ccTrue} - \ccGlobalFunction{ template < class RandomAccessIC, class + \ccGlobalFunction{ template < class RandomAccessIterator, class OutputIterator, class Traits > OutputIterator - all_furthest_neighbors_2( RandomAccessIC points_begin, - RandomAccessIC points_end, OutputIterator o, Traits t = + all_furthest_neighbors_2( RandomAccessIterator points_begin, + RandomAccessIterator points_end, OutputIterator o, Traits t = Default_traits);} computes all furthest neighbors for the vertices of the convex @@ -42,23 +42,22 @@ The geometric types and operations to be used for the computation are specified by the traits class parameter \ccc{t}. This parameter - can be omitted if \ccc{RandomAccessIC} refers to a point type from - the 2D-Kernel. In this case, a default traits class - (\ccc{All_furthest_neighbors_default_traits_2}) is used. + can be omitted if \ccc{RandomAccessIterator} refers to a point type + from a \ccc{Kernel}. In this case, the kernel is used as default + traits class. \ccRequire \begin{enumerate} \item If \ccc{t} is specified explicitly, \ccc{Traits} is a model for \ccc{AllFurthestNeighborsTraits_2}. - \item Value type of \ccc{RandomAccessIC} is \ccc{Traits::Point_2} or - -- if \ccc{t} is not specified explicitly -- \ccc{Point_2} for - some representation class \ccc{R}. + \item Value type of \ccc{RandomAccessIterator} is + \ccc{Traits::Point_2} or -- if \ccc{t} is not specified explicitly + -- \ccc{K::Point_2} where \ccc{K} is a model for \ccc{Kernel}. \item \ccc{OutputIterator} accepts \ccc{int} as value type. \end{enumerate} \ccSeeAlso \ccRefConceptPage{AllFurthestNeighborsTraits_2}\\ - \ccRefIdfierPage{CGAL::All_furthest_neighbors_default_traits_2}\\ \ccRefIdfierPage{CGAL::monotone_matrix_search} \ccImplementation The implementation uses monotone matrix @@ -76,49 +75,6 @@ \ccIncludeVerbatim{Optimisation_ref/all_furthest_neighbors_2_example_nohead.C} \end{ccRefFunction} -\begin{ccRefClass}{All_furthest_neighbors_default_traits_2} - \ccCreationVariable{t}\ccTagFullDeclarations - - \ccDefinition The class \ccClassName\ provides the types and - operations needed to compute all furthest neighbors for the vertices - of a convex polygon. - - \ccRequirements - The template parameter \ccc{R} is a model for \ccc{Kernel}. - - \ccIsModel - \ccRefConceptPage{AllFurthestNeighborsTraits_2} - - \ccTypes - - \ccNestedType{Point_2}{typedef to \ccc{R::Point_2}.} - - \ccNestedType{FT}{typedef to \ccc{R::FT}.} - - \ccNestedType{Distance}{AdaptableBinaryFunction class: \ccc{Point_2} - $\times$ \ccc{Point_2} $\rightarrow$ \ccc{FT} computing the - squared Euclidean distance between two points.} - - \ccOperations - - \ccMemberFunction{Distance distance_object();}{returns the - function object for computing distances.} - - \ccMemberFunction{template < class RandomAccessIC > bool is_convex( - RandomAccessIC points_begin, RandomAccessIC points_end) - const;}{returns true, iff the points [\ccc{points_begin}, - \ccc{points_end}) form a convex chain.} - - \ccSeeAlso - \ccRefIdfierPage{CGAL::all_furthest_neighbors_2} - - \ccHeading{Notes} - \begin{itemize} - \item \ccClassName\ccc{::is_convex} is used for precondition - checking only. - \end{itemize} -\end{ccRefClass} - \begin{ccRefConcept}{AllFurthestNeighborsTraits_2} \ccCreationVariable{t}\ccTagFullDeclarations @@ -128,36 +84,45 @@ \ccTypes - \ccNestedType{Point_2}{class used for representing the input - points.} + \ccNestedType{FT}{model for \ccRefConceptPage{FieldNumberType}.} - \ccNestedType{FT}{class used for doing computations on point - coordinates; it has to be a model for \ccc{FieldNumberType}.} + \ccNestedType{Point_2}{model for + \ccRefConceptPage{Kernel::Point_2}.} - \ccNestedType{Distance}{AdaptableBinaryFunction class: \ccc{Point_2} - $\times$ \ccc{Point_2} $\rightarrow$ \ccc{FT} computing the - squared Euclidean distance between two points.} - - \ccOperations + \ccNestedType{Compute_squared_distance_2}{model for + \ccRefConceptPage{Kernel::Compute_squared_distance_2}.} - \ccMemberFunction{Distance distance_object();}{returns the - function object for computing distances.} + \ccNestedType{Less_xy_2}{model for + \ccRefConceptPage{Kernel::Less_xy_2}.} - \ccMemberFunction{template < class RandomAccessIC > bool is_convex( - RandomAccessIC points_begin, RandomAccessIC points_end) - const;}{returns true, iff the points [\ccc{points_begin}, - \ccc{points_end}) form a convex chain.} + \ccNestedType{Orientation_2}{model for + \ccRefConceptPage{Kernel::Orientation_2}.} + + \ccOperations The following member functions return function objects + of the types listed above. + + \ccGlue\ccMemberFunction{Compute_squared_distance_2 + compute_squared_distance_2_object();}{} + + \ccGlue\ccMemberFunction{Less_xy_2 less_xy_2_object();}{} + + \ccGlue\ccMemberFunction{Orientation_2 orientation_2_object();}{} \ccHasModels - \ccRefIdfierPage{CGAL::All_furthest_neighbors_default_traits_2} + \ccRefIdfierPage{Cartesian}, + \ccRefIdfierPage{Homogeneous}, + \ccRefIdfierPage{Simple_cartesian}, + \ccRefIdfierPage{Simple_homogeneous}. \ccSeeAlso \ccRefIdfierPage{CGAL::all_furthest_neighbors_2} \ccHeading{Notes} \begin{itemize} - \item \ccClassName\ccc{::is_convex} is used for precondition - checking only. + \item \ccClassName\ccc{::Less_xy_2} and + \ccClassName\ccc{::Orientation_2} are used for (expensive) + precondition checking only. Therefore, they need not to be + specified, in case that precondition checking is disabled. \end{itemize} \end{ccRefConcept} diff --git a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_extremal_polygons.tex b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_extremal_polygons.tex index e79b9041910..920cb90793e 100644 --- a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_extremal_polygons.tex +++ b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_extremal_polygons.tex @@ -29,11 +29,11 @@ \def\ccLongParamLayout{\ccTrue} \ccGlobalFunction{ - template < class RandomAccessIC, class OutputIterator > + template < class RandomAccessIterator, class OutputIterator > OutputIterator maximum_area_inscribed_k_gon_2( - RandomAccessIC points_begin, - RandomAccessIC points_end, + RandomAccessIterator points_begin, + RandomAccessIterator points_end, int k, OutputIterator o);} @@ -52,17 +52,17 @@ \ccRequire \begin{enumerate} - \item Value type of \ccc{RandomAccessIC} is \ccc{Point_2} for - some representation class \ccc{R}. + \item Value type of \ccc{RandomAccessIterator} is \ccc{K::Point_2} + where \ccc{K} is a model for \ccc{Kernel}. \item \ccc{OutputIterator} accepts the value type of - \ccc{RandomAccessIC} as value type. + \ccc{RandomAccessIterator} as value type. \end{enumerate} \ccSeeAlso \ccRefIdfierPage{CGAL::maximum_perimeter_inscribed_k_gon_2}\\ \ccRefConceptPage{ExtremalPolygonTraits_2}\\ - \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ - \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2}\\ + \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ + \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2}\\ \ccRefIdfierPage{CGAL::extremal_polygon_2}\\ \ccRefIdfierPage{CGAL::monotone_matrix_search} @@ -78,7 +78,7 @@ \ccIncludeVerbatim{Optimisation_ref/extremal_polygon_2_example_area.C} \end{ccRefFunction} - + \begin{ccRefFunction}{maximum_perimeter_inscribed_k_gon_2} \ccIndexMainItem[t]{largest inscribed polygon} \ccIndexSubitem[t]{polygon}{largest inscribed} @@ -99,11 +99,11 @@ \def\ccLongParamLayout{\ccTrue} \ccGlobalFunction{ - template < class RandomAccessIC, class OutputIterator > + template < class RandomAccessIterator, class OutputIterator > OutputIterator maximum_perimeter_inscribed_k_gon_2( - RandomAccessIC points_begin, - RandomAccessIC points_end, + RandomAccessIterator points_begin, + RandomAccessIterator points_end, int k, OutputIterator o);} @@ -122,12 +122,12 @@ \ccRequire \begin{enumerate} - \item Value type of \ccc{RandomAccessIC} is \ccc{CGAL::Point_2} - for some representation class \ccc{R}. - \item There is a global function \ccc{R::FT CGAL::sqrt(R::FT)} + \item Value type of \ccc{RandomAccessIterator} is \ccc{K::Point_2} + where \ccc{K} is a model for \ccc{Kernel}. + \item There is a global function \ccc{K::FT CGAL::sqrt(K::FT)} defined that computes the squareroot of a number. \item \ccc{OutputIterator} accepts the value type of - \ccc{RandomAccessIC} as value type. + \ccc{RandomAccessIterator} as value type. \end{enumerate} \ccTagDefaults @@ -135,8 +135,8 @@ \ccSeeAlso \ccRefIdfierPage{CGAL::maximum_area_inscribed_k_gon_2}\\ \ccRefConceptPage{ExtremalPolygonTraits_2}\\ - \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ - \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2}\\ + \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ + \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2}\\ \ccRefIdfierPage{CGAL::extremal_polygon_2}\\ \ccRefIdfierPage{CGAL::monotone_matrix_search} @@ -155,7 +155,7 @@ \begin{ccRefFunction}{extremal_polygon_2} \begin{ccAdvanced} - + \ccDefinition The function \ccRefName\ computes a maximal $k$-gon that can be inscribed into a given convex polygon. The criterion for maximality and some basic operations have to be specified in @@ -166,11 +166,11 @@ \def\ccLongParamLayout{\ccTrue} \ccGlobalFunction{ - template < class RandomAccessIC, class OutputIterator, class Traits > + template < class RandomAccessIterator, class OutputIterator, class Traits > OutputIterator extremal_polygon_2( - RandomAccessIC points_begin, - RandomAccessIC points_end, + RandomAccessIterator points_begin, + RandomAccessIterator points_end, int k, OutputIterator o, const Traits& t);} @@ -191,7 +191,7 @@ \ccRequire \begin{enumerate} \item \ccc{Traits} is a model for \ccc{ExtremalPolygonTraits_2}. - \item Value type of \ccc{RandomAccessIC} is \ccc{Traits::Point_2}. + \item Value type of \ccc{RandomAccessIterator} is \ccc{Traits::Point_2}. \item \ccc{OutputIterator} accepts \ccc{Traits::Point_2} as value type. \end{enumerate} @@ -201,7 +201,7 @@ \ccRefIdfierPage{CGAL::maximum_perimeter_inscribed_k_gon_2}\\ \ccRefConceptPage{ExtremalPolygonTraits_2}\\ \ccRefIdfierPage{CGAL::monotone_matrix_search} - + \ccImplementation The implementation uses monotone matrix search \cite{akmsw-gamsa-87} and has a worst case running time of $O(k \cdot n + n \cdot \log n)$, where $n$ is the number of vertices in @@ -209,7 +209,7 @@ \end{ccAdvanced} \end{ccRefFunction} -\begin{ccRefClass}{Extremal_polygon_area_traits_2} +\begin{ccRefClass}{Extremal_polygon_area_traits_2} \begin{ccAdvanced} \ccCreationVariable{t}\ccTagFullDeclarations @@ -218,7 +218,7 @@ be inscribed into a given convex polygon $P$ using the function \ccc{extremal_polygon_2}. - \ccRequirements The template parameter \ccc{R} is a model for + \ccRequirements The template parameter \ccc{K} is a model for \ccc{Kernel}. \ccIsModel @@ -226,10 +226,14 @@ \ccTypes - \ccNestedType{Point_2}{typedef to \ccc{R::Point_2}.} - - \ccNestedType{FT}{typedef to \ccc{R::FT}.} - + \ccNestedType{FT}{typedef to \ccc{K::FT}.} + + \ccNestedType{Point_2}{typedef to \ccc{K::Point_2}.} + + \ccNestedType{Less_xy_2}{typedef to \ccc{K::Less_xy_2}.} + + \ccNestedType{Orientation_2}{typedef to \ccc{K::Orientation_2}.} + \ccNestedType{Operation}{AdaptableBinaryFunction class \ccc{op}: \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{FT}. For a fixed \ccc{Point_2} $root$, \ccc{op}$(p,\,q)$ returns @@ -246,30 +250,29 @@ const;}{returns \ccc{Operation} where \ccc{p} is the fixed $root$ point.} - \ccMemberFunction{template < class RandomAccessIC, class + \ccMemberFunction{template < class RandomAccessIterator, class OutputIterator > OutputIterator compute_min_k_gon( - RandomAccessIC points_begin, RandomAccessIC points_end, FT& + RandomAccessIterator points_begin, RandomAccessIterator points_end, FT& max_area, OutputIterator o) const;}{writes the vertices of [\ccc{points_begin}, \ccc{points_end}) forming a maximum area triangle rooted at \ccc{points_begin[0]} to o and returns the past-the-end iterator for that sequence (== \ccc{o + 3}).} - \ccMemberFunction{template < class RandomAccessIC > bool - is_convex( RandomAccessIC points_begin, RandomAccessIC - points_end) const;}{returns true, iff the points - [\ccc{points_begin}, \ccc{points_end}) form a convex chain.} + \ccMemberFunction{Less_xy_2 less_xy_2_object();}{} + + \ccGlue\ccMemberFunction{Orientation_2 orientation_2_object();}{} \ccSeeAlso \ccRefIdfierPage{CGAL::maximum_area_inscribed_k_gon_2}\\ \ccRefIdfierPage{CGAL::maximum_perimeter_inscribed_k_gon_2}\\ \ccRefIdfierPage{CGAL::extremal_polygon_2}\\ - \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2}\\ + \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2}\\ \ccRefConceptPage{ExtremalPolygonTraits_2} \end{ccAdvanced} \end{ccRefClass} -\begin{ccRefClass}{Extremal_polygon_perimeter_traits_2} +\begin{ccRefClass}{Extremal_polygon_perimeter_traits_2} \begin{ccAdvanced} \ccCreationVariable{t}\ccTagFullDeclarations @@ -278,7 +281,7 @@ that can be inscribed into a given convex polygon $P$ using the function \ccc{extremal_polygon_2}. - \ccRequirements The template parameter \ccc{R} is a model for + \ccRequirements The template parameter \ccc{K} is a model for \ccc{Kernel}. \ccIsModel @@ -286,10 +289,14 @@ \ccTypes - \ccNestedType{Point_2}{typedef to \ccc{R::Point_2}.} - - \ccNestedType{FT}{typedef to \ccc{R::FT}.} - + \ccNestedType{FT}{typedef to \ccc{K::FT}.} + + \ccNestedType{Point_2}{typedef to \ccc{K::Point_2}.} + + \ccNestedType{Less_xy_2}{typedef to \ccc{K::Less_xy_2}.} + + \ccNestedType{Orientation_2}{typedef to \ccc{K::Orientation_2}.} + \ccNestedType{Operation}{AdaptableBinaryFunction class \ccc{op}: \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{FT}. For a fixed \ccc{Point_2} $root$, \ccc{op}$(p,\,q)$ returns @@ -308,9 +315,9 @@ const;}{returns \ccc{Operation} where \ccc{p} is the fixed $root$ point.} - \ccMemberFunction{template < class RandomAccessIC, class + \ccMemberFunction{template < class RandomAccessIterator, class OutputIterator > OutputIterator compute_min_k_gon( - RandomAccessIC points_begin, RandomAccessIC points_end, FT& + RandomAccessIterator points_begin, RandomAccessIterator points_end, FT& max_area, OutputIterator o) const;}{writes the pair (\ccc{points_begin[0]}, \ccc{p}) where \ccc{p} is drawn from [\ccc{points_begin}, \ccc{points_end}) such that the Euclidean @@ -318,16 +325,15 @@ 2-gon rooted at \ccc{points_begin[0]}) to o and returns the past-the-end iterator for that sequence (== \ccc{o + 2}).} - \ccMemberFunction{template < class RandomAccessIC > bool - is_convex( RandomAccessIC points_begin, RandomAccessIC - points_end) const;}{returns true, iff the points - [\ccc{points_begin}, \ccc{points_end}) form a convex chain.} + \ccMemberFunction{Less_xy_2 less_xy_2_object();}{} + + \ccGlue\ccMemberFunction{Orientation_2 orientation_2_object();}{} \ccSeeAlso \ccRefIdfierPage{CGAL::maximum_area_inscribed_k_gon_2}\\ \ccRefIdfierPage{CGAL::maximum_perimeter_inscribed_k_gon_2}\\ \ccRefIdfierPage{CGAL::extremal_polygon_2}\\ - \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ + \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ \ccRefConceptPage{ExtremalPolygonTraits_2} \end{ccAdvanced} @@ -340,14 +346,19 @@ \ccDefinition The concept \ccRefName\ provides the types and operations needed to compute a maximal $k$-gon that can be inscribed into a given convex polygon. - + \ccTypes - \ccNestedType{Point_2}{class used for representing the input - points.} + \ccNestedType{FT}{model for \ccRefConceptPage{FieldNumberType}.} - \ccNestedType{FT}{class used for doing computations on point - coordinates; it has to be a model for \ccc{FieldNumberType}.} + \ccNestedType{Point_2}{model for + \ccRefConceptPage{Kernel::Point_2}.} + + \ccNestedType{Less_xy_2}{model for + \ccRefConceptPage{Kernel::Less_xy_2}.} + + \ccNestedType{Orientation_2}{model for + \ccRefConceptPage{Kernel::Orientation_2}.} \ccNestedType{Operation}{AdaptableBinaryFunction class \ccc{op}: \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{FT}. @@ -375,30 +386,30 @@ const;}{return \ccc{Operation} where \ccc{p} is the fixed $root$ point.} - \ccMemberFunction{template < class RandomAccessIC, class + \ccMemberFunction{template < class RandomAccessIterator, class OutputIterator > OutputIterator compute_min_k_gon( - RandomAccessIC points_begin, RandomAccessIC points_end, FT& - max_area, OutputIterator o) const;}{writes the points of - [\ccc{points_begin}, \ccc{points_end}) forming a + RandomAccessIterator points_begin, RandomAccessIterator + points_end, FT& max_area, OutputIterator o) const;}{writes the + points of [\ccc{points_begin}, \ccc{points_end}) forming a \ccc{min_k()}-gon rooted at \ccc{points_begin[0]} of maximal value to o and returns the past-the-end iterator for that sequence (== \ccc{o + min_k()}).} - \ccMemberFunction{template < class RandomAccessIC > bool - is_convex( RandomAccessIC points_begin, RandomAccessIC - points_end) const;}{returns true, iff the points - [\ccc{points_begin}, \ccc{points_end}) form a convex chain.} + \ccMemberFunction{Less_xy_2 less_xy_2_object();}{} + + \ccGlue\ccMemberFunction{Orientation_2 orientation_2_object();}{} \ccHeading{Notes} \begin{itemize} - \item \ccClassName\ccc{::is_convex} is only used for precondition - checking. Therefore it needs not to be specified, in case that - precondition checking is disabled. + \item \ccClassName\ccc{::Less_xy_2} and + \ccClassName\ccc{::Orientation_2} are used for (expensive) + precondition checking only. Therefore, they need not to be + specified, in case that precondition checking is disabled. \end{itemize} \ccHasModels - \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ - \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2} + \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ + \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2} \ccSeeAlso \ccRefIdfierPage{CGAL::maximum_area_inscribed_k_gon_2}\\ diff --git a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex index 0760a418369..efccc2fb5e3 100644 --- a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex +++ b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex @@ -125,26 +125,16 @@ \ccNestedType{Iso_rectangle_2}{typedef to \ccc{R::Iso_rectangle_2}.} - \ccNestedType{Less_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has smaller x-coordinate than - the second.} + \ccNestedType{Less_x_2}{typedef to \ccc{R::Less_x_2}.} + + \ccNestedType{Less_y_2}{typedef to \ccc{R::Less_y_2}.} - \ccNestedType{Less_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has smaller y-coordinate than - the second.} - - \ccNestedType{Greater_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has greater x-coordinate than - the second.} - - \ccNestedType{Greater_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has greater y-coordinate than - the second.} + \ccNestedType{Construct_vertex_2}{typedef to + \ccc{R::Construct_vertex_2}.} + \ccNestedType{Construct_iso_rectangle_2}{typedef to + \ccc{R::Construct_iso_rectangle_2}.} + \ccNestedType{Signed_x_distance_2}{adaptable binary function class: \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{FT} returns the signed distance of two points' @@ -165,31 +155,6 @@ $\rightarrow$ \ccc{FT} returns the signed $||\cdot||_{\infty}$ distance of two points.} - \ccNestedType{Construct_min_point_2}{adaptable unary function - class: \ccc{Iso_rectangle_2} $\rightarrow$ \ccc{Point_2} returns - the lower-left corner of a rectangle.} - - \ccNestedType{Construct_max_point_2}{adaptable unary function class: - \ccc{Iso_rectangle_2} $\rightarrow$ \ccc{Point_2} returns the - upper-right corner of a rectangle.} - - \ccNestedType{Construct_corner_2}{adaptable binary function class: - \ccc{Iso_rectangle_2} $\times$ \ccc{unsigned int} $\rightarrow$ - \ccc{Point_2} returns the i-th (starting from lower-left and then - counterclockwise) corner of a rectangle.} - - \ccNestedType{Construct_projection_onto_horizontal_implicit_line_2}{ - adaptable binary function class: \ccc{Point_2} $\times$ - \ccc{Point_2} $\rightarrow$ \ccc{Point_2} returns the - (orthogonal) projection of the first point onto the horizontal - line through the second point.} - - \ccNestedType{Construct_iso_rectangle_2}{4-argument function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\times$ \ccc{Point_2} - $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Iso_rectangle_2} returns - the rectangle with point $i$ on the left, bottom, right, top resp. - side.} - \ccNestedType{Construct_point_2_below_left_implicit_point_2}{ 3-argument function class: \ccc{Point_2} $\times$ \ccc{Point_2} $\times$ \ccc{FT} $\rightarrow$ \ccc{Point_2}. For arguments @@ -222,24 +187,6 @@ intersection of the vertical line through $p$ and the horizontal line through $q$.} - \ccHeading{These can be derived from \ccc{Less} and \ccc{Greater}:} - - \ccNestedType{Min_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with smaller x-coordinate.} - - \ccNestedType{Max_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with greater x-coordinate.} - - \ccNestedType{Min_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with smaller y-coordinate.} - - \ccNestedType{Max_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with greater y-coordinate.} - \ccOperations For every function class listed above there is a member function @@ -249,22 +196,12 @@ \ccGlue\ccMemberFunction{Signed_inf_distance_2 signed_inf_distance_2_object() const;}{} - \ccGlue\ccMemberFunction{Construct_min_point_2 - construct_min_point_2_object() const;}{} - - \ccGlue\ccMemberFunction{Construct_max_point_2 - construct_max_point_2_object() const;}{} - - \ccGlue\ccMemberFunction{Construct_corner_2 construct_corner_2_object() - const;}{} + \ccGlue\ccMemberFunction{Construct_vertex_2 + construct_vertex_2_object() const;}{} \ccGlue\ccMemberFunction{Construct_iso_rectangle_2 construct_iso_rectangle_2_object() const;}{} - \ccGlue\ccMemberFunction{Construct_projection_onto_horizontal_implicit_line_2 - construct_projection_onto_horizontal_implicit_line_2_object() - const;}{} - \ccGlue\ccMemberFunction{Construct_iso_rectangle_2_below_left_point_2 construct_iso_rectangle_2_below_left_point_2_object() const;}{} @@ -277,14 +214,6 @@ \ccGlue\ccMemberFunction{Construct_iso_rectangle_2_above_right_point_2 construct_iso_rectangle_2_above_right_point_2_object() const;}{} - \ccGlue\ccMemberFunction{Min_x_2 min_x_2_object() const;}{} - - \ccGlue\ccMemberFunction{Max_x_2 max_x_2_object() const;}{} - - \ccGlue\ccMemberFunction{Min_y_2 min_y_2_object() const;}{} - - \ccGlue\ccMemberFunction{Max_y_2 max_y_2_object() const;}{} - \ccSeeAlso \ccRefIdfierPage{CGAL::rectangular_p_center_2} @@ -299,35 +228,26 @@ \ccTypes - \ccNestedType{FT}{class used for doing computations on point - coordinates; it has to be a model for \ccc{FieldNumberType}.} + \ccNestedType{FT}{model for \ccRefConceptPage{FieldNumberType}.} - \ccNestedType{Point_2}{class used for representing the input - points.} + \ccNestedType{Point_2}{model for + \ccRefConceptPage{Kernel::Point_2}.} - \ccNestedType{Iso_rectangle_2}{class used for representing - axis-parallel rectangles.} + \ccNestedType{Iso_rectangle_2}{model for + \ccRefConceptPage{Kernel::Iso_rectangle_2}.} - \ccNestedType{Less_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has smaller x-coordinate than - the second.} + \ccNestedType{Less_x_2}{model for + \ccRefConceptPage{Kernel::Less_x_2}.} - \ccNestedType{Less_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has smaller y-coordinate than - the second.} + \ccNestedType{Less_y_2}{model for + \ccRefConceptPage{Kernel::Less_y_2}.} - \ccNestedType{Greater_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has greater x-coordinate than - the second.} - - \ccNestedType{Greater_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has greater y-coordinate than - the second.} + \ccNestedType{Construct_vertex_2}{model for + \ccRefConceptPage{Kernel::Construct_vertex_2}.} + \ccNestedType{Construct_iso_rectangle_2}{model for + \ccRefConceptPage{Kernel::Construct_iso_rectangle_2}.} + \ccNestedType{Signed_x_distance_2}{adaptable binary function class: \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{FT} returns the signed distance of two points' @@ -348,31 +268,6 @@ $\rightarrow$ \ccc{FT} returns the signed $||\cdot||_{\infty}$ distance of two points.} - \ccNestedType{Construct_min_point_2}{adaptable unary function - class: \ccc{Iso_rectangle_2} $\rightarrow$ \ccc{Point_2} returns - the lower-left corner of a rectangle.} - - \ccNestedType{Construct_max_point_2}{adaptable unary function class: - \ccc{Iso_rectangle_2} $\rightarrow$ \ccc{Point_2} returns the - upper-right corner of a rectangle.} - - \ccNestedType{Construct_corner_2}{adaptable binary function class: - \ccc{Iso_rectangle_2} $\times$ \ccc{unsigned int} $\rightarrow$ - \ccc{Point_2} returns the i-th (starting from lower-left and then - counterclockwise) corner of a rectangle.} - - \ccNestedType{Construct_projection_onto_horizontal_implicit_line_2}{ - adaptable binary function class: \ccc{Point_2} $\times$ - \ccc{Point_2} $\rightarrow$ \ccc{Point_2} returns the - (orthogonal) projection of the first point onto the horizontal - line through the second point.} - - \ccNestedType{Construct_iso_rectangle_2}{4-argument function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\times$ \ccc{Point_2} - $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Iso_rectangle_2} returns - the rectangle with point $i$ on the left, bottom, right, top resp. - side.} - \ccNestedType{Construct_point_2_below_left_implicit_point_2}{ 3-argument function class: \ccc{Point_2} $\times$ \ccc{Point_2} $\times$ \ccc{FT} $\rightarrow$ \ccc{Point_2}. For arguments @@ -405,24 +300,6 @@ intersection of the vertical line through $p$ and the horizontal line through $q$.} - \ccHeading{These can be derived from \ccc{Less} and \ccc{Greater}:} - - \ccNestedType{Min_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with smaller x-coordinate.} - - \ccNestedType{Max_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with greater x-coordinate.} - - \ccNestedType{Min_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with smaller y-coordinate.} - - \ccNestedType{Max_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with greater y-coordinate.} - \ccOperations For every function class listed above there is a member function @@ -432,22 +309,12 @@ \ccGlue\ccMemberFunction{Signed_inf_distance_2 signed_inf_distance_2_object() const;}{} - \ccGlue\ccMemberFunction{Construct_min_point_2 - construct_min_point_2_object() const;}{} - - \ccGlue\ccMemberFunction{Construct_max_point_2 - construct_max_point_2_object() const;}{} - - \ccGlue\ccMemberFunction{Construct_corner_2 construct_corner_2_object() - const;}{} + \ccGlue\ccMemberFunction{Construct_vertex_2 + construct_vertex_2_object() const;}{} \ccGlue\ccMemberFunction{Construct_iso_rectangle_2 construct_iso_rectangle_2_object() const;}{} - \ccGlue\ccMemberFunction{Construct_projection_onto_horizontal_implicit_line_2 - construct_projection_onto_horizontal_implicit_line_2_object() - const;}{} - \ccGlue\ccMemberFunction{Construct_iso_rectangle_2_below_left_point_2 construct_iso_rectangle_2_below_left_point_2_object() const;}{} @@ -460,14 +327,6 @@ \ccGlue\ccMemberFunction{Construct_iso_rectangle_2_above_right_point_2 construct_iso_rectangle_2_above_right_point_2_object() const;}{} - \ccGlue\ccMemberFunction{Min_x_2 min_x_2_object() const;}{} - - \ccGlue\ccMemberFunction{Max_x_2 max_x_2_object() const;}{} - - \ccGlue\ccMemberFunction{Min_y_2 min_y_2_object() const;}{} - - \ccGlue\ccMemberFunction{Max_y_2 max_y_2_object() const;}{} - \ccHasModels \ccRefIdfierPage{CGAL::Rectangular_p_center_default_traits_2} diff --git a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex index 67659770ec0..6ff9bb48466 100644 --- a/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex +++ b/Packages/Matrix_search/doc_tex/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex @@ -58,9 +58,10 @@ \def\ccLongParamLayout{\ccTrue} - \ccGlobalFunction{template < class RandomAccessIC, class Traits > - Traits::Value sorted_matrix_search( RandomAccessIC f, - RandomAccessIC l, const Traits& t);} + \ccGlobalFunction{template < class RandomAccessIterator, class + Traits > Traits::Value sorted_matrix_search( + RandomAccessIterator f, RandomAccessIterator l, const Traits& + t);} returns the element \ccc{x} in one of the sorted matrices from the range $\left[ f,\, l \right)$, for which \ccc{t.is_feasible( x)} @@ -81,7 +82,8 @@ \begin{enumerate} \item \ccc{Traits} is a model for \ccc{SortedMatrixSearchTraits}. - \item Value type of \ccc{RandomAccessIC} is \ccc{Traits::Matrix}. + \item Value type of \ccc{RandomAccessIterator} is + \ccc{Traits::Matrix}. \end{enumerate} \ccSeeAlso diff --git a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/all_furthest_neighbors_2_example_nohead.C b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/all_furthest_neighbors_2_example_nohead.C index 7dd493bb2bb..9c9476267f1 100644 --- a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/all_furthest_neighbors_2_example_nohead.C +++ b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/all_furthest_neighbors_2_example_nohead.C @@ -1,7 +1,4 @@ -#line 1492 "mon_search.aw" -#line 775 "afn.awi" #include -#include #include #include #include @@ -41,4 +38,3 @@ main() return 0; } -#line 1493 "mon_search.aw" diff --git a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/extremal_polygon_2_example_area.C b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/extremal_polygon_2_example_area.C index 5a9e6c20c72..9b0b4030a2a 100644 --- a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/extremal_polygon_2_example_area.C +++ b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/extremal_polygon_2_example_area.C @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -12,9 +11,9 @@ using CGAL::random_convex_set_2; using CGAL::maximum_area_inscribed_k_gon_2; typedef double FT; -typedef CGAL::Cartesian< FT > R; -typedef CGAL::Point_2< R > Point; -typedef CGAL::Polygon_traits_2< R > P_traits; +typedef CGAL::Cartesian< FT > K; +typedef K::Point_2 Point; +typedef CGAL::Polygon_traits_2< K > P_traits; typedef vector< Point > Cont; typedef CGAL::Polygon_2< P_traits, Cont > Polygon; typedef CGAL::Creator_uniform_2< FT, Point > Creator; diff --git a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/extremal_polygon_2_example_perimeter.C b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/extremal_polygon_2_example_perimeter.C index 433cf6fceef..2f34a8a2a58 100644 --- a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/extremal_polygon_2_example_perimeter.C +++ b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/extremal_polygon_2_example_perimeter.C @@ -1,5 +1,4 @@ #include -#include #include #include #include @@ -12,9 +11,9 @@ using CGAL::random_convex_set_2; using CGAL::maximum_perimeter_inscribed_k_gon_2; typedef double FT; -typedef CGAL::Cartesian< FT > R; -typedef CGAL::Point_2< R > Point; -typedef CGAL::Polygon_traits_2< R > P_traits; +typedef CGAL::Cartesian< FT > K; +typedef K::Point_2 Point; +typedef CGAL::Polygon_traits_2< K > P_traits; typedef vector< Point > Cont; typedef CGAL::Polygon_2< P_traits, Cont > Polygon; typedef CGAL::Creator_uniform_2< FT, Point > Creator; diff --git a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/rectangular_p_center_2_example_nohead.C b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/rectangular_p_center_2_example_nohead.C index 6cff5a78730..511e47fb945 100644 --- a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/rectangular_p_center_2_example_nohead.C +++ b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/rectangular_p_center_2_example_nohead.C @@ -1,7 +1,4 @@ -#line 726 "pcenter.aw" -#line 599 "pc_testprog.awi" #include -#include #include #include #include @@ -14,14 +11,13 @@ using namespace std; using CGAL::set_pretty_mode; using CGAL::rectangular_p_center_2; -typedef double FT; -typedef CGAL::Cartesian< FT > R; -typedef CGAL::Point_2< R > Point; -typedef std::vector< Point > Cont; -typedef CGAL::Creator_uniform_2< FT, Point > Creator; -typedef CGAL::Random_points_in_square_2< Point, Creator > - Point_generator; -typedef CGAL::Ostream_iterator< Point, ostream > Ostream_iterator_point; +typedef double FT; +typedef CGAL::Cartesian< FT > K; +typedef K::Point_2 Point; +typedef std::vector< Point > Cont; +typedef CGAL::Creator_uniform_2< FT, Point > Creator; +typedef CGAL::Random_points_in_square_2< Point, Creator > Point_generator; +typedef CGAL::Ostream_iterator< Point, ostream > Ostream_iterator_point; int main() { @@ -52,4 +48,3 @@ int main() { return 0; } -#line 727 "pcenter.aw" diff --git a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/sorted_matrix_search_example_nohead.C b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/sorted_matrix_search_example_nohead.C index 589f442a79c..710b35cb24f 100644 --- a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/sorted_matrix_search_example_nohead.C +++ b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/sorted_matrix_search_example_nohead.C @@ -1,7 +1,4 @@ -#line 355 "fj_testprog.awi" -#line 293 "fj_testprog.awi" #include -#include #include #include #include @@ -43,11 +40,10 @@ int main() { &M, &M + 1, sorted_matrix_search_traits_adaptor( - bind2nd( greater_equal< Value >(), bound), + bind_2( greater_equal< Value >(), bound), M))); cout << "upper bound for " << bound << " is " << upper_bound << endl; return 0; } -#line 356 "fj_testprog.awi" diff --git a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex index 64d2028a9bd..b337f4ee9f1 100644 --- a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex +++ b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_all_furthest_neighbors.tex @@ -22,10 +22,10 @@ \def\ccLongParamLayout{\ccTrue} - \ccGlobalFunction{ template < class RandomAccessIC, class + \ccGlobalFunction{ template < class RandomAccessIterator, class OutputIterator, class Traits > OutputIterator - all_furthest_neighbors_2( RandomAccessIC points_begin, - RandomAccessIC points_end, OutputIterator o, Traits t = + all_furthest_neighbors_2( RandomAccessIterator points_begin, + RandomAccessIterator points_end, OutputIterator o, Traits t = Default_traits);} computes all furthest neighbors for the vertices of the convex @@ -42,23 +42,22 @@ The geometric types and operations to be used for the computation are specified by the traits class parameter \ccc{t}. This parameter - can be omitted if \ccc{RandomAccessIC} refers to a point type from - the 2D-Kernel. In this case, a default traits class - (\ccc{All_furthest_neighbors_default_traits_2}) is used. + can be omitted if \ccc{RandomAccessIterator} refers to a point type + from a \ccc{Kernel}. In this case, the kernel is used as default + traits class. \ccRequire \begin{enumerate} \item If \ccc{t} is specified explicitly, \ccc{Traits} is a model for \ccc{AllFurthestNeighborsTraits_2}. - \item Value type of \ccc{RandomAccessIC} is \ccc{Traits::Point_2} or - -- if \ccc{t} is not specified explicitly -- \ccc{Point_2} for - some representation class \ccc{R}. + \item Value type of \ccc{RandomAccessIterator} is + \ccc{Traits::Point_2} or -- if \ccc{t} is not specified explicitly + -- \ccc{K::Point_2} where \ccc{K} is a model for \ccc{Kernel}. \item \ccc{OutputIterator} accepts \ccc{int} as value type. \end{enumerate} \ccSeeAlso \ccRefConceptPage{AllFurthestNeighborsTraits_2}\\ - \ccRefIdfierPage{CGAL::All_furthest_neighbors_default_traits_2}\\ \ccRefIdfierPage{CGAL::monotone_matrix_search} \ccImplementation The implementation uses monotone matrix @@ -76,49 +75,6 @@ \ccIncludeVerbatim{Optimisation_ref/all_furthest_neighbors_2_example_nohead.C} \end{ccRefFunction} -\begin{ccRefClass}{All_furthest_neighbors_default_traits_2} - \ccCreationVariable{t}\ccTagFullDeclarations - - \ccDefinition The class \ccClassName\ provides the types and - operations needed to compute all furthest neighbors for the vertices - of a convex polygon. - - \ccRequirements - The template parameter \ccc{R} is a model for \ccc{Kernel}. - - \ccIsModel - \ccRefConceptPage{AllFurthestNeighborsTraits_2} - - \ccTypes - - \ccNestedType{Point_2}{typedef to \ccc{R::Point_2}.} - - \ccNestedType{FT}{typedef to \ccc{R::FT}.} - - \ccNestedType{Distance}{AdaptableBinaryFunction class: \ccc{Point_2} - $\times$ \ccc{Point_2} $\rightarrow$ \ccc{FT} computing the - squared Euclidean distance between two points.} - - \ccOperations - - \ccMemberFunction{Distance distance_object();}{returns the - function object for computing distances.} - - \ccMemberFunction{template < class RandomAccessIC > bool is_convex( - RandomAccessIC points_begin, RandomAccessIC points_end) - const;}{returns true, iff the points [\ccc{points_begin}, - \ccc{points_end}) form a convex chain.} - - \ccSeeAlso - \ccRefIdfierPage{CGAL::all_furthest_neighbors_2} - - \ccHeading{Notes} - \begin{itemize} - \item \ccClassName\ccc{::is_convex} is used for precondition - checking only. - \end{itemize} -\end{ccRefClass} - \begin{ccRefConcept}{AllFurthestNeighborsTraits_2} \ccCreationVariable{t}\ccTagFullDeclarations @@ -128,36 +84,45 @@ \ccTypes - \ccNestedType{Point_2}{class used for representing the input - points.} + \ccNestedType{FT}{model for \ccRefConceptPage{FieldNumberType}.} - \ccNestedType{FT}{class used for doing computations on point - coordinates; it has to be a model for \ccc{FieldNumberType}.} + \ccNestedType{Point_2}{model for + \ccRefConceptPage{Kernel::Point_2}.} - \ccNestedType{Distance}{AdaptableBinaryFunction class: \ccc{Point_2} - $\times$ \ccc{Point_2} $\rightarrow$ \ccc{FT} computing the - squared Euclidean distance between two points.} - - \ccOperations + \ccNestedType{Compute_squared_distance_2}{model for + \ccRefConceptPage{Kernel::Compute_squared_distance_2}.} - \ccMemberFunction{Distance distance_object();}{returns the - function object for computing distances.} + \ccNestedType{Less_xy_2}{model for + \ccRefConceptPage{Kernel::Less_xy_2}.} - \ccMemberFunction{template < class RandomAccessIC > bool is_convex( - RandomAccessIC points_begin, RandomAccessIC points_end) - const;}{returns true, iff the points [\ccc{points_begin}, - \ccc{points_end}) form a convex chain.} + \ccNestedType{Orientation_2}{model for + \ccRefConceptPage{Kernel::Orientation_2}.} + + \ccOperations The following member functions return function objects + of the types listed above. + + \ccGlue\ccMemberFunction{Compute_squared_distance_2 + compute_squared_distance_2_object();}{} + + \ccGlue\ccMemberFunction{Less_xy_2 less_xy_2_object();}{} + + \ccGlue\ccMemberFunction{Orientation_2 orientation_2_object();}{} \ccHasModels - \ccRefIdfierPage{CGAL::All_furthest_neighbors_default_traits_2} + \ccRefIdfierPage{Cartesian}, + \ccRefIdfierPage{Homogeneous}, + \ccRefIdfierPage{Simple_cartesian}, + \ccRefIdfierPage{Simple_homogeneous}. \ccSeeAlso \ccRefIdfierPage{CGAL::all_furthest_neighbors_2} \ccHeading{Notes} \begin{itemize} - \item \ccClassName\ccc{::is_convex} is used for precondition - checking only. + \item \ccClassName\ccc{::Less_xy_2} and + \ccClassName\ccc{::Orientation_2} are used for (expensive) + precondition checking only. Therefore, they need not to be + specified, in case that precondition checking is disabled. \end{itemize} \end{ccRefConcept} diff --git a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_extremal_polygons.tex b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_extremal_polygons.tex index e79b9041910..920cb90793e 100644 --- a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_extremal_polygons.tex +++ b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_extremal_polygons.tex @@ -29,11 +29,11 @@ \def\ccLongParamLayout{\ccTrue} \ccGlobalFunction{ - template < class RandomAccessIC, class OutputIterator > + template < class RandomAccessIterator, class OutputIterator > OutputIterator maximum_area_inscribed_k_gon_2( - RandomAccessIC points_begin, - RandomAccessIC points_end, + RandomAccessIterator points_begin, + RandomAccessIterator points_end, int k, OutputIterator o);} @@ -52,17 +52,17 @@ \ccRequire \begin{enumerate} - \item Value type of \ccc{RandomAccessIC} is \ccc{Point_2} for - some representation class \ccc{R}. + \item Value type of \ccc{RandomAccessIterator} is \ccc{K::Point_2} + where \ccc{K} is a model for \ccc{Kernel}. \item \ccc{OutputIterator} accepts the value type of - \ccc{RandomAccessIC} as value type. + \ccc{RandomAccessIterator} as value type. \end{enumerate} \ccSeeAlso \ccRefIdfierPage{CGAL::maximum_perimeter_inscribed_k_gon_2}\\ \ccRefConceptPage{ExtremalPolygonTraits_2}\\ - \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ - \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2}\\ + \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ + \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2}\\ \ccRefIdfierPage{CGAL::extremal_polygon_2}\\ \ccRefIdfierPage{CGAL::monotone_matrix_search} @@ -78,7 +78,7 @@ \ccIncludeVerbatim{Optimisation_ref/extremal_polygon_2_example_area.C} \end{ccRefFunction} - + \begin{ccRefFunction}{maximum_perimeter_inscribed_k_gon_2} \ccIndexMainItem[t]{largest inscribed polygon} \ccIndexSubitem[t]{polygon}{largest inscribed} @@ -99,11 +99,11 @@ \def\ccLongParamLayout{\ccTrue} \ccGlobalFunction{ - template < class RandomAccessIC, class OutputIterator > + template < class RandomAccessIterator, class OutputIterator > OutputIterator maximum_perimeter_inscribed_k_gon_2( - RandomAccessIC points_begin, - RandomAccessIC points_end, + RandomAccessIterator points_begin, + RandomAccessIterator points_end, int k, OutputIterator o);} @@ -122,12 +122,12 @@ \ccRequire \begin{enumerate} - \item Value type of \ccc{RandomAccessIC} is \ccc{CGAL::Point_2} - for some representation class \ccc{R}. - \item There is a global function \ccc{R::FT CGAL::sqrt(R::FT)} + \item Value type of \ccc{RandomAccessIterator} is \ccc{K::Point_2} + where \ccc{K} is a model for \ccc{Kernel}. + \item There is a global function \ccc{K::FT CGAL::sqrt(K::FT)} defined that computes the squareroot of a number. \item \ccc{OutputIterator} accepts the value type of - \ccc{RandomAccessIC} as value type. + \ccc{RandomAccessIterator} as value type. \end{enumerate} \ccTagDefaults @@ -135,8 +135,8 @@ \ccSeeAlso \ccRefIdfierPage{CGAL::maximum_area_inscribed_k_gon_2}\\ \ccRefConceptPage{ExtremalPolygonTraits_2}\\ - \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ - \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2}\\ + \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ + \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2}\\ \ccRefIdfierPage{CGAL::extremal_polygon_2}\\ \ccRefIdfierPage{CGAL::monotone_matrix_search} @@ -155,7 +155,7 @@ \begin{ccRefFunction}{extremal_polygon_2} \begin{ccAdvanced} - + \ccDefinition The function \ccRefName\ computes a maximal $k$-gon that can be inscribed into a given convex polygon. The criterion for maximality and some basic operations have to be specified in @@ -166,11 +166,11 @@ \def\ccLongParamLayout{\ccTrue} \ccGlobalFunction{ - template < class RandomAccessIC, class OutputIterator, class Traits > + template < class RandomAccessIterator, class OutputIterator, class Traits > OutputIterator extremal_polygon_2( - RandomAccessIC points_begin, - RandomAccessIC points_end, + RandomAccessIterator points_begin, + RandomAccessIterator points_end, int k, OutputIterator o, const Traits& t);} @@ -191,7 +191,7 @@ \ccRequire \begin{enumerate} \item \ccc{Traits} is a model for \ccc{ExtremalPolygonTraits_2}. - \item Value type of \ccc{RandomAccessIC} is \ccc{Traits::Point_2}. + \item Value type of \ccc{RandomAccessIterator} is \ccc{Traits::Point_2}. \item \ccc{OutputIterator} accepts \ccc{Traits::Point_2} as value type. \end{enumerate} @@ -201,7 +201,7 @@ \ccRefIdfierPage{CGAL::maximum_perimeter_inscribed_k_gon_2}\\ \ccRefConceptPage{ExtremalPolygonTraits_2}\\ \ccRefIdfierPage{CGAL::monotone_matrix_search} - + \ccImplementation The implementation uses monotone matrix search \cite{akmsw-gamsa-87} and has a worst case running time of $O(k \cdot n + n \cdot \log n)$, where $n$ is the number of vertices in @@ -209,7 +209,7 @@ \end{ccAdvanced} \end{ccRefFunction} -\begin{ccRefClass}{Extremal_polygon_area_traits_2} +\begin{ccRefClass}{Extremal_polygon_area_traits_2} \begin{ccAdvanced} \ccCreationVariable{t}\ccTagFullDeclarations @@ -218,7 +218,7 @@ be inscribed into a given convex polygon $P$ using the function \ccc{extremal_polygon_2}. - \ccRequirements The template parameter \ccc{R} is a model for + \ccRequirements The template parameter \ccc{K} is a model for \ccc{Kernel}. \ccIsModel @@ -226,10 +226,14 @@ \ccTypes - \ccNestedType{Point_2}{typedef to \ccc{R::Point_2}.} - - \ccNestedType{FT}{typedef to \ccc{R::FT}.} - + \ccNestedType{FT}{typedef to \ccc{K::FT}.} + + \ccNestedType{Point_2}{typedef to \ccc{K::Point_2}.} + + \ccNestedType{Less_xy_2}{typedef to \ccc{K::Less_xy_2}.} + + \ccNestedType{Orientation_2}{typedef to \ccc{K::Orientation_2}.} + \ccNestedType{Operation}{AdaptableBinaryFunction class \ccc{op}: \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{FT}. For a fixed \ccc{Point_2} $root$, \ccc{op}$(p,\,q)$ returns @@ -246,30 +250,29 @@ const;}{returns \ccc{Operation} where \ccc{p} is the fixed $root$ point.} - \ccMemberFunction{template < class RandomAccessIC, class + \ccMemberFunction{template < class RandomAccessIterator, class OutputIterator > OutputIterator compute_min_k_gon( - RandomAccessIC points_begin, RandomAccessIC points_end, FT& + RandomAccessIterator points_begin, RandomAccessIterator points_end, FT& max_area, OutputIterator o) const;}{writes the vertices of [\ccc{points_begin}, \ccc{points_end}) forming a maximum area triangle rooted at \ccc{points_begin[0]} to o and returns the past-the-end iterator for that sequence (== \ccc{o + 3}).} - \ccMemberFunction{template < class RandomAccessIC > bool - is_convex( RandomAccessIC points_begin, RandomAccessIC - points_end) const;}{returns true, iff the points - [\ccc{points_begin}, \ccc{points_end}) form a convex chain.} + \ccMemberFunction{Less_xy_2 less_xy_2_object();}{} + + \ccGlue\ccMemberFunction{Orientation_2 orientation_2_object();}{} \ccSeeAlso \ccRefIdfierPage{CGAL::maximum_area_inscribed_k_gon_2}\\ \ccRefIdfierPage{CGAL::maximum_perimeter_inscribed_k_gon_2}\\ \ccRefIdfierPage{CGAL::extremal_polygon_2}\\ - \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2}\\ + \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2}\\ \ccRefConceptPage{ExtremalPolygonTraits_2} \end{ccAdvanced} \end{ccRefClass} -\begin{ccRefClass}{Extremal_polygon_perimeter_traits_2} +\begin{ccRefClass}{Extremal_polygon_perimeter_traits_2} \begin{ccAdvanced} \ccCreationVariable{t}\ccTagFullDeclarations @@ -278,7 +281,7 @@ that can be inscribed into a given convex polygon $P$ using the function \ccc{extremal_polygon_2}. - \ccRequirements The template parameter \ccc{R} is a model for + \ccRequirements The template parameter \ccc{K} is a model for \ccc{Kernel}. \ccIsModel @@ -286,10 +289,14 @@ \ccTypes - \ccNestedType{Point_2}{typedef to \ccc{R::Point_2}.} - - \ccNestedType{FT}{typedef to \ccc{R::FT}.} - + \ccNestedType{FT}{typedef to \ccc{K::FT}.} + + \ccNestedType{Point_2}{typedef to \ccc{K::Point_2}.} + + \ccNestedType{Less_xy_2}{typedef to \ccc{K::Less_xy_2}.} + + \ccNestedType{Orientation_2}{typedef to \ccc{K::Orientation_2}.} + \ccNestedType{Operation}{AdaptableBinaryFunction class \ccc{op}: \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{FT}. For a fixed \ccc{Point_2} $root$, \ccc{op}$(p,\,q)$ returns @@ -308,9 +315,9 @@ const;}{returns \ccc{Operation} where \ccc{p} is the fixed $root$ point.} - \ccMemberFunction{template < class RandomAccessIC, class + \ccMemberFunction{template < class RandomAccessIterator, class OutputIterator > OutputIterator compute_min_k_gon( - RandomAccessIC points_begin, RandomAccessIC points_end, FT& + RandomAccessIterator points_begin, RandomAccessIterator points_end, FT& max_area, OutputIterator o) const;}{writes the pair (\ccc{points_begin[0]}, \ccc{p}) where \ccc{p} is drawn from [\ccc{points_begin}, \ccc{points_end}) such that the Euclidean @@ -318,16 +325,15 @@ 2-gon rooted at \ccc{points_begin[0]}) to o and returns the past-the-end iterator for that sequence (== \ccc{o + 2}).} - \ccMemberFunction{template < class RandomAccessIC > bool - is_convex( RandomAccessIC points_begin, RandomAccessIC - points_end) const;}{returns true, iff the points - [\ccc{points_begin}, \ccc{points_end}) form a convex chain.} + \ccMemberFunction{Less_xy_2 less_xy_2_object();}{} + + \ccGlue\ccMemberFunction{Orientation_2 orientation_2_object();}{} \ccSeeAlso \ccRefIdfierPage{CGAL::maximum_area_inscribed_k_gon_2}\\ \ccRefIdfierPage{CGAL::maximum_perimeter_inscribed_k_gon_2}\\ \ccRefIdfierPage{CGAL::extremal_polygon_2}\\ - \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ + \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ \ccRefConceptPage{ExtremalPolygonTraits_2} \end{ccAdvanced} @@ -340,14 +346,19 @@ \ccDefinition The concept \ccRefName\ provides the types and operations needed to compute a maximal $k$-gon that can be inscribed into a given convex polygon. - + \ccTypes - \ccNestedType{Point_2}{class used for representing the input - points.} + \ccNestedType{FT}{model for \ccRefConceptPage{FieldNumberType}.} - \ccNestedType{FT}{class used for doing computations on point - coordinates; it has to be a model for \ccc{FieldNumberType}.} + \ccNestedType{Point_2}{model for + \ccRefConceptPage{Kernel::Point_2}.} + + \ccNestedType{Less_xy_2}{model for + \ccRefConceptPage{Kernel::Less_xy_2}.} + + \ccNestedType{Orientation_2}{model for + \ccRefConceptPage{Kernel::Orientation_2}.} \ccNestedType{Operation}{AdaptableBinaryFunction class \ccc{op}: \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{FT}. @@ -375,30 +386,30 @@ const;}{return \ccc{Operation} where \ccc{p} is the fixed $root$ point.} - \ccMemberFunction{template < class RandomAccessIC, class + \ccMemberFunction{template < class RandomAccessIterator, class OutputIterator > OutputIterator compute_min_k_gon( - RandomAccessIC points_begin, RandomAccessIC points_end, FT& - max_area, OutputIterator o) const;}{writes the points of - [\ccc{points_begin}, \ccc{points_end}) forming a + RandomAccessIterator points_begin, RandomAccessIterator + points_end, FT& max_area, OutputIterator o) const;}{writes the + points of [\ccc{points_begin}, \ccc{points_end}) forming a \ccc{min_k()}-gon rooted at \ccc{points_begin[0]} of maximal value to o and returns the past-the-end iterator for that sequence (== \ccc{o + min_k()}).} - \ccMemberFunction{template < class RandomAccessIC > bool - is_convex( RandomAccessIC points_begin, RandomAccessIC - points_end) const;}{returns true, iff the points - [\ccc{points_begin}, \ccc{points_end}) form a convex chain.} + \ccMemberFunction{Less_xy_2 less_xy_2_object();}{} + + \ccGlue\ccMemberFunction{Orientation_2 orientation_2_object();}{} \ccHeading{Notes} \begin{itemize} - \item \ccClassName\ccc{::is_convex} is only used for precondition - checking. Therefore it needs not to be specified, in case that - precondition checking is disabled. + \item \ccClassName\ccc{::Less_xy_2} and + \ccClassName\ccc{::Orientation_2} are used for (expensive) + precondition checking only. Therefore, they need not to be + specified, in case that precondition checking is disabled. \end{itemize} \ccHasModels - \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ - \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2} + \ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2}\\ + \ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2} \ccSeeAlso \ccRefIdfierPage{CGAL::maximum_area_inscribed_k_gon_2}\\ diff --git a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex index 0760a418369..efccc2fb5e3 100644 --- a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex +++ b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_rectangular_p_centers.tex @@ -125,26 +125,16 @@ \ccNestedType{Iso_rectangle_2}{typedef to \ccc{R::Iso_rectangle_2}.} - \ccNestedType{Less_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has smaller x-coordinate than - the second.} + \ccNestedType{Less_x_2}{typedef to \ccc{R::Less_x_2}.} + + \ccNestedType{Less_y_2}{typedef to \ccc{R::Less_y_2}.} - \ccNestedType{Less_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has smaller y-coordinate than - the second.} - - \ccNestedType{Greater_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has greater x-coordinate than - the second.} - - \ccNestedType{Greater_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has greater y-coordinate than - the second.} + \ccNestedType{Construct_vertex_2}{typedef to + \ccc{R::Construct_vertex_2}.} + \ccNestedType{Construct_iso_rectangle_2}{typedef to + \ccc{R::Construct_iso_rectangle_2}.} + \ccNestedType{Signed_x_distance_2}{adaptable binary function class: \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{FT} returns the signed distance of two points' @@ -165,31 +155,6 @@ $\rightarrow$ \ccc{FT} returns the signed $||\cdot||_{\infty}$ distance of two points.} - \ccNestedType{Construct_min_point_2}{adaptable unary function - class: \ccc{Iso_rectangle_2} $\rightarrow$ \ccc{Point_2} returns - the lower-left corner of a rectangle.} - - \ccNestedType{Construct_max_point_2}{adaptable unary function class: - \ccc{Iso_rectangle_2} $\rightarrow$ \ccc{Point_2} returns the - upper-right corner of a rectangle.} - - \ccNestedType{Construct_corner_2}{adaptable binary function class: - \ccc{Iso_rectangle_2} $\times$ \ccc{unsigned int} $\rightarrow$ - \ccc{Point_2} returns the i-th (starting from lower-left and then - counterclockwise) corner of a rectangle.} - - \ccNestedType{Construct_projection_onto_horizontal_implicit_line_2}{ - adaptable binary function class: \ccc{Point_2} $\times$ - \ccc{Point_2} $\rightarrow$ \ccc{Point_2} returns the - (orthogonal) projection of the first point onto the horizontal - line through the second point.} - - \ccNestedType{Construct_iso_rectangle_2}{4-argument function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\times$ \ccc{Point_2} - $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Iso_rectangle_2} returns - the rectangle with point $i$ on the left, bottom, right, top resp. - side.} - \ccNestedType{Construct_point_2_below_left_implicit_point_2}{ 3-argument function class: \ccc{Point_2} $\times$ \ccc{Point_2} $\times$ \ccc{FT} $\rightarrow$ \ccc{Point_2}. For arguments @@ -222,24 +187,6 @@ intersection of the vertical line through $p$ and the horizontal line through $q$.} - \ccHeading{These can be derived from \ccc{Less} and \ccc{Greater}:} - - \ccNestedType{Min_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with smaller x-coordinate.} - - \ccNestedType{Max_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with greater x-coordinate.} - - \ccNestedType{Min_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with smaller y-coordinate.} - - \ccNestedType{Max_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with greater y-coordinate.} - \ccOperations For every function class listed above there is a member function @@ -249,22 +196,12 @@ \ccGlue\ccMemberFunction{Signed_inf_distance_2 signed_inf_distance_2_object() const;}{} - \ccGlue\ccMemberFunction{Construct_min_point_2 - construct_min_point_2_object() const;}{} - - \ccGlue\ccMemberFunction{Construct_max_point_2 - construct_max_point_2_object() const;}{} - - \ccGlue\ccMemberFunction{Construct_corner_2 construct_corner_2_object() - const;}{} + \ccGlue\ccMemberFunction{Construct_vertex_2 + construct_vertex_2_object() const;}{} \ccGlue\ccMemberFunction{Construct_iso_rectangle_2 construct_iso_rectangle_2_object() const;}{} - \ccGlue\ccMemberFunction{Construct_projection_onto_horizontal_implicit_line_2 - construct_projection_onto_horizontal_implicit_line_2_object() - const;}{} - \ccGlue\ccMemberFunction{Construct_iso_rectangle_2_below_left_point_2 construct_iso_rectangle_2_below_left_point_2_object() const;}{} @@ -277,14 +214,6 @@ \ccGlue\ccMemberFunction{Construct_iso_rectangle_2_above_right_point_2 construct_iso_rectangle_2_above_right_point_2_object() const;}{} - \ccGlue\ccMemberFunction{Min_x_2 min_x_2_object() const;}{} - - \ccGlue\ccMemberFunction{Max_x_2 max_x_2_object() const;}{} - - \ccGlue\ccMemberFunction{Min_y_2 min_y_2_object() const;}{} - - \ccGlue\ccMemberFunction{Max_y_2 max_y_2_object() const;}{} - \ccSeeAlso \ccRefIdfierPage{CGAL::rectangular_p_center_2} @@ -299,35 +228,26 @@ \ccTypes - \ccNestedType{FT}{class used for doing computations on point - coordinates; it has to be a model for \ccc{FieldNumberType}.} + \ccNestedType{FT}{model for \ccRefConceptPage{FieldNumberType}.} - \ccNestedType{Point_2}{class used for representing the input - points.} + \ccNestedType{Point_2}{model for + \ccRefConceptPage{Kernel::Point_2}.} - \ccNestedType{Iso_rectangle_2}{class used for representing - axis-parallel rectangles.} + \ccNestedType{Iso_rectangle_2}{model for + \ccRefConceptPage{Kernel::Iso_rectangle_2}.} - \ccNestedType{Less_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has smaller x-coordinate than - the second.} + \ccNestedType{Less_x_2}{model for + \ccRefConceptPage{Kernel::Less_x_2}.} - \ccNestedType{Less_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has smaller y-coordinate than - the second.} + \ccNestedType{Less_y_2}{model for + \ccRefConceptPage{Kernel::Less_y_2}.} - \ccNestedType{Greater_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has greater x-coordinate than - the second.} - - \ccNestedType{Greater_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{bool} - returns true, iff the first point has greater y-coordinate than - the second.} + \ccNestedType{Construct_vertex_2}{model for + \ccRefConceptPage{Kernel::Construct_vertex_2}.} + \ccNestedType{Construct_iso_rectangle_2}{model for + \ccRefConceptPage{Kernel::Construct_iso_rectangle_2}.} + \ccNestedType{Signed_x_distance_2}{adaptable binary function class: \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{FT} returns the signed distance of two points' @@ -348,31 +268,6 @@ $\rightarrow$ \ccc{FT} returns the signed $||\cdot||_{\infty}$ distance of two points.} - \ccNestedType{Construct_min_point_2}{adaptable unary function - class: \ccc{Iso_rectangle_2} $\rightarrow$ \ccc{Point_2} returns - the lower-left corner of a rectangle.} - - \ccNestedType{Construct_max_point_2}{adaptable unary function class: - \ccc{Iso_rectangle_2} $\rightarrow$ \ccc{Point_2} returns the - upper-right corner of a rectangle.} - - \ccNestedType{Construct_corner_2}{adaptable binary function class: - \ccc{Iso_rectangle_2} $\times$ \ccc{unsigned int} $\rightarrow$ - \ccc{Point_2} returns the i-th (starting from lower-left and then - counterclockwise) corner of a rectangle.} - - \ccNestedType{Construct_projection_onto_horizontal_implicit_line_2}{ - adaptable binary function class: \ccc{Point_2} $\times$ - \ccc{Point_2} $\rightarrow$ \ccc{Point_2} returns the - (orthogonal) projection of the first point onto the horizontal - line through the second point.} - - \ccNestedType{Construct_iso_rectangle_2}{4-argument function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\times$ \ccc{Point_2} - $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Iso_rectangle_2} returns - the rectangle with point $i$ on the left, bottom, right, top resp. - side.} - \ccNestedType{Construct_point_2_below_left_implicit_point_2}{ 3-argument function class: \ccc{Point_2} $\times$ \ccc{Point_2} $\times$ \ccc{FT} $\rightarrow$ \ccc{Point_2}. For arguments @@ -405,24 +300,6 @@ intersection of the vertical line through $p$ and the horizontal line through $q$.} - \ccHeading{These can be derived from \ccc{Less} and \ccc{Greater}:} - - \ccNestedType{Min_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with smaller x-coordinate.} - - \ccNestedType{Max_x_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with greater x-coordinate.} - - \ccNestedType{Min_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with smaller y-coordinate.} - - \ccNestedType{Max_y_2}{adaptable binary function class: - \ccc{Point_2} $\times$ \ccc{Point_2} $\rightarrow$ \ccc{Point_2} - returns the point with greater y-coordinate.} - \ccOperations For every function class listed above there is a member function @@ -432,22 +309,12 @@ \ccGlue\ccMemberFunction{Signed_inf_distance_2 signed_inf_distance_2_object() const;}{} - \ccGlue\ccMemberFunction{Construct_min_point_2 - construct_min_point_2_object() const;}{} - - \ccGlue\ccMemberFunction{Construct_max_point_2 - construct_max_point_2_object() const;}{} - - \ccGlue\ccMemberFunction{Construct_corner_2 construct_corner_2_object() - const;}{} + \ccGlue\ccMemberFunction{Construct_vertex_2 + construct_vertex_2_object() const;}{} \ccGlue\ccMemberFunction{Construct_iso_rectangle_2 construct_iso_rectangle_2_object() const;}{} - \ccGlue\ccMemberFunction{Construct_projection_onto_horizontal_implicit_line_2 - construct_projection_onto_horizontal_implicit_line_2_object() - const;}{} - \ccGlue\ccMemberFunction{Construct_iso_rectangle_2_below_left_point_2 construct_iso_rectangle_2_below_left_point_2_object() const;}{} @@ -460,14 +327,6 @@ \ccGlue\ccMemberFunction{Construct_iso_rectangle_2_above_right_point_2 construct_iso_rectangle_2_above_right_point_2_object() const;}{} - \ccGlue\ccMemberFunction{Min_x_2 min_x_2_object() const;}{} - - \ccGlue\ccMemberFunction{Max_x_2 max_x_2_object() const;}{} - - \ccGlue\ccMemberFunction{Min_y_2 min_y_2_object() const;}{} - - \ccGlue\ccMemberFunction{Max_y_2 max_y_2_object() const;}{} - \ccHasModels \ccRefIdfierPage{CGAL::Rectangular_p_center_default_traits_2} diff --git a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex index 67659770ec0..6ff9bb48466 100644 --- a/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex +++ b/Packages/Matrix_search/doc_tex/basic/Optimisation/Optimisation_ref/spec_sorted_matrix_search.tex @@ -58,9 +58,10 @@ \def\ccLongParamLayout{\ccTrue} - \ccGlobalFunction{template < class RandomAccessIC, class Traits > - Traits::Value sorted_matrix_search( RandomAccessIC f, - RandomAccessIC l, const Traits& t);} + \ccGlobalFunction{template < class RandomAccessIterator, class + Traits > Traits::Value sorted_matrix_search( + RandomAccessIterator f, RandomAccessIterator l, const Traits& + t);} returns the element \ccc{x} in one of the sorted matrices from the range $\left[ f,\, l \right)$, for which \ccc{t.is_feasible( x)} @@ -81,7 +82,8 @@ \begin{enumerate} \item \ccc{Traits} is a model for \ccc{SortedMatrixSearchTraits}. - \item Value type of \ccc{RandomAccessIC} is \ccc{Traits::Matrix}. + \item Value type of \ccc{RandomAccessIterator} is + \ccc{Traits::Matrix}. \end{enumerate} \ccSeeAlso diff --git a/Packages/Matrix_search/examples/Matrix_search/all_furthest_neighbors_2_example.C b/Packages/Matrix_search/examples/Matrix_search/all_furthest_neighbors_2_example.C index e736a3621a5..6b7127f3d24 100644 --- a/Packages/Matrix_search/examples/Matrix_search/all_furthest_neighbors_2_example.C +++ b/Packages/Matrix_search/examples/Matrix_search/all_furthest_neighbors_2_example.C @@ -26,7 +26,6 @@ // ============================================================================ #include -#include #include #include #include diff --git a/Packages/Matrix_search/examples/Matrix_search/extremal_polygon_2_example.C b/Packages/Matrix_search/examples/Matrix_search/extremal_polygon_2_example.C index 71017005017..960de4230a5 100644 --- a/Packages/Matrix_search/examples/Matrix_search/extremal_polygon_2_example.C +++ b/Packages/Matrix_search/examples/Matrix_search/extremal_polygon_2_example.C @@ -26,7 +26,6 @@ // ============================================================================ #include -#include #include #include #include @@ -39,9 +38,9 @@ using CGAL::random_convex_set_2; using CGAL::maximum_area_inscribed_k_gon_2; typedef double FT; -typedef CGAL::Cartesian< FT > R; -typedef CGAL::Point_2< R > Point; -typedef CGAL::Polygon_traits_2< R > P_traits; +typedef CGAL::Cartesian< FT > K; +typedef K::Point_2 Point; +typedef CGAL::Polygon_traits_2< K > P_traits; typedef vector< Point > Cont; typedef CGAL::Polygon_2< P_traits, Cont > Polygon; typedef CGAL::Creator_uniform_2< FT, Point > Creator; diff --git a/Packages/Matrix_search/examples/Matrix_search/rectangular_p_center_2_example.C b/Packages/Matrix_search/examples/Matrix_search/rectangular_p_center_2_example.C index 11bf49b7895..b75749396ad 100644 --- a/Packages/Matrix_search/examples/Matrix_search/rectangular_p_center_2_example.C +++ b/Packages/Matrix_search/examples/Matrix_search/rectangular_p_center_2_example.C @@ -26,7 +26,6 @@ // ============================================================================ #include -#include #include #include #include @@ -39,14 +38,13 @@ using namespace std; using CGAL::set_pretty_mode; using CGAL::rectangular_p_center_2; -typedef double FT; -typedef CGAL::Cartesian< FT > R; -typedef CGAL::Point_2< R > Point; -typedef std::vector< Point > Cont; -typedef CGAL::Creator_uniform_2< FT, Point > Creator; -typedef CGAL::Random_points_in_square_2< Point, Creator > - Point_generator; -typedef CGAL::Ostream_iterator< Point, ostream > Ostream_iterator_point; +typedef double FT; +typedef CGAL::Cartesian< FT > K; +typedef K::Point_2 Point; +typedef std::vector< Point > Cont; +typedef CGAL::Creator_uniform_2< FT, Point > Creator; +typedef CGAL::Random_points_in_square_2< Point, Creator > Point_generator; +typedef CGAL::Ostream_iterator< Point, ostream > Ostream_iterator_point; int main() { diff --git a/Packages/Matrix_search/examples/Matrix_search/sorted_matrix_search_example.C b/Packages/Matrix_search/examples/Matrix_search/sorted_matrix_search_example.C index cff0221a9d3..cd609f802f8 100644 --- a/Packages/Matrix_search/examples/Matrix_search/sorted_matrix_search_example.C +++ b/Packages/Matrix_search/examples/Matrix_search/sorted_matrix_search_example.C @@ -26,7 +26,6 @@ // ============================================================================ #include -#include #include #include #include @@ -68,7 +67,7 @@ int main() { &M, &M + 1, sorted_matrix_search_traits_adaptor( - bind2nd( greater_equal< Value >(), bound), + bind_2( greater_equal< Value >(), bound), M))); cout << "upper bound for " << bound << " is " << upper_bound << endl; diff --git a/Packages/Matrix_search/include/CGAL/Cartesian_matrix.h b/Packages/Matrix_search/include/CGAL/Cartesian_matrix.h index 6a6ec673f5e..39e9bd133dd 100644 --- a/Packages/Matrix_search/include/CGAL/Cartesian_matrix.h +++ b/Packages/Matrix_search/include/CGAL/Cartesian_matrix.h @@ -39,8 +39,6 @@ template < class Operation, class Cartesian_matrix { public: typedef typename Operation::result_type Value; - typedef typename Operation::first_argument_type RowValue; - typedef typename Operation::second_argument_type ColumnValue; Cartesian_matrix(RandomAccessIC_row r_f, RandomAccessIC_row r_l, diff --git a/Packages/Matrix_search/include/CGAL/Extremal_polygon_traits_2.h b/Packages/Matrix_search/include/CGAL/Extremal_polygon_traits_2.h index d56d9ebcfa8..10bf88945d0 100644 --- a/Packages/Matrix_search/include/CGAL/Extremal_polygon_traits_2.h +++ b/Packages/Matrix_search/include/CGAL/Extremal_polygon_traits_2.h @@ -31,61 +31,40 @@ #include #include #include -#include +#include CGAL_BEGIN_NAMESPACE -template < class R > inline -#ifndef CGAL_CFG_RETURN_TYPE_BUG_1 -typename R::FT -#else -R_FT_return(R) -#endif -Kgon_triangle_area( const Point_2< R >& p, - const Point_2< R >& q, - const Point_2< R >& r) -{ - return CGAL_NTS abs( p.x() * ( q.y() - r.y()) + - q.x() * ( r.y() - p.y()) + - r.x() * ( p.y() - q.y())); -} +template < class K_ > +struct Extremal_polygon_area_traits_2 { + typedef K_ K; + typedef typename K::FT FT; + typedef typename K::Point_2 Point_2; +#ifdef CGAL_OPTIMISATION_EXPENSIVE_PRECONDITION_TAG + typedef typename K::Less_xy_2 Less_xy_2; + typedef typename K::Orientation_2 Orientation_2; +#endif // CGAL_OPTIMISATION_EXPENSIVE_PRECONDITION_TAG -template < class R_ > -class Kgon_area_operator -: public CGAL_STD::binary_function< Point_2< R_ >, - Point_2< R_ >, - typename R_::FT > -{ -public: - typedef R_ R; - typedef Point_2< R > Point_2; - typedef typename R::FT FT; + struct Kgon_triangle_area { + typedef Arity_tag< 3 > Arity; + typedef FT result_type; + + Kgon_triangle_area(const K& k_) : k(k_) {} + + result_type + operator()(const Point_2& p, const Point_2& q, const Point_2& r) const + { return CGAL_NTS abs(k.compute_area_2_object()( + k.construct_triangle_2_object()(p, q, r))); } + protected: + K k; + }; - Kgon_area_operator( const Point_2& p) - : root( p) - {} + typedef Kgon_triangle_area Baseop; + typedef typename Bind< Baseop, Point_2, 3 >::Type Operation; - FT - operator()( const Point_2& p, const Point_2& q) const - { return Kgon_triangle_area( p, q, root); } + Extremal_polygon_area_traits_2() {} + Extremal_polygon_area_traits_2(const K& k_) : k(k_) {} -private: - const Point_2& root; -}; - - - -template < class R_ > -class Extremal_polygon_area_traits_2 -{ -public: - typedef R_ R; - typedef Point_2< R > Point_2; - typedef typename R::FT FT; - typedef Kgon_area_operator< R > Operation; - - int - min_k() const - { return 3; } + int min_k() const { return 3; } FT init( const Point_2&, const Point_2&) const @@ -93,7 +72,7 @@ public: Operation operation( const Point_2& p) const - { return Operation( p); } + { return bind_3(Baseop(k), p); } #ifndef CGAL_CFG_NO_MEMBER_TEMPLATES template < class RandomAccessIC, class OutputIterator > @@ -164,24 +143,15 @@ public: return o; } // compute_min_k_gon( ... ) - #ifndef CGAL_CFG_NO_MEMBER_TEMPLATES - template < class RandomAccessIC > - #endif - bool - is_convex( RandomAccessIC points_begin, - RandomAccessIC points_end) const - // PRE: value_type of RandomAccessIC is Point_2 - // POST: return true, iff the points [ points_begin, points_end) - // form a convex chain. - { - typedef Polygon_traits_2< R > P_traits; - typedef std::vector< Point_2 > Cont; - typedef Polygon_2< P_traits, Cont > Polygon_2; - - Polygon_2 p( points_begin, points_end); - return p.is_convex(); - } // is_convex( points_begin, points_end) +#ifdef CGAL_OPTIMISATION_EXPENSIVE_PRECONDITION_TAG + Less_xy_2 less_xy_2_object() const { return k.less_xy_2_object(); } + Orientation_2 orientation_2_object() const + { return k.orientation_2_object(); } +#endif // CGAL_OPTIMISATION_EXPENSIVE_PRECONDITION_TAG + +protected: + K k; }; CGAL_END_NAMESPACE @@ -195,50 +165,45 @@ CGAL_BEGIN_NAMESPACE template < class FT_ > struct Sqrt : public CGAL_STD::binary_function< FT_, FT_, FT_ > { + typedef Arity_tag< 1 > Arity; typedef FT_ FT; FT operator()(const FT& x) const { return CGAL_NTS sqrt(x); } }; -template < class R_ > -class Kgon_perimeter_operator -: public CGAL_STD::binary_function< Point_2< R_ >, - Point_2< R_ >, - typename R_::FT > -{ -public: - typedef R_ R; - typedef Point_2< R > Point_2; - typedef typename R::FT FT; +template < class K_ > +struct Extremal_polygon_perimeter_traits_2 { + typedef K_ K; + typedef typename K::FT FT; + typedef typename K::Point_2 Point_2; +#ifdef CGAL_OPTIMISATION_EXPENSIVE_PRECONDITION_TAG + typedef typename K::Less_xy_2 Less_xy_2; + typedef typename K::Orientation_2 Orientation_2; +#endif // CGAL_OPTIMISATION_EXPENSIVE_PRECONDITION_TAG - Kgon_perimeter_operator( const Point_2& p) - : root( p) - {} + struct Kgon_triangle_perimeter { + typedef Arity_tag< 3 > Arity; + typedef FT result_type; + + Kgon_triangle_perimeter(const K& k_): k(k_) {} + + result_type + operator()(const Point_2& p, const Point_2& q, const Point_2& r) const + { return dist(p, r) + dist(p, q) - dist(q, r); } + + private: + result_type dist(const Point_2& p, const Point_2& q) const + { return CGAL_NTS sqrt(k.compute_squared_distance_2_object()(p, q)); } + + protected: + K k; + }; - FT - operator()( const Point_2& p, const Point_2& q) const - { return dist( p, root) + dist( p, q) - dist( q, root); } + typedef Kgon_triangle_perimeter Baseop; + typedef typename Bind< Baseop, Point_2, 3 >::Type Operation; -private: - static - FT - dist( const Point_2& p, const Point_2& q) - { return CGAL_NTS sqrt( squared_distance( p, q)); } + Extremal_polygon_perimeter_traits_2() {} + Extremal_polygon_perimeter_traits_2(const K& k_) : k(k_) {} - const Point_2& root; -}; - - -template < class R_ > -class Extremal_polygon_perimeter_traits_2 -{ -public: - typedef R_ R; - typedef Point_2< R > Point_2; - typedef typename R::FT FT; - typedef Kgon_perimeter_operator< R > Operation; - - int - min_k() const - { return 2; } + int min_k() const { return 2; } FT init( const Point_2& p, const Point_2& r) const @@ -246,7 +211,7 @@ public: Operation operation( const Point_2& p) const - { return Operation( p); } + { return bind_3( Baseop(k), p); } #ifndef CGAL_CFG_NO_MEMBER_TEMPLATES template < class RandomAccessIC, class OutputIterator > @@ -276,7 +241,6 @@ public: // for the range (== o + min_k()). { #ifndef CGAL_CFG_NO_NAMESPACE - using std::bind2nd; using std::less; using std::max_element; #endif @@ -292,10 +256,10 @@ public: max_element( points_begin + 1, points_end, - compose2_2( + compose( less< FT >(), - bind2nd(operation(points_begin[0]), points_begin[0]), - bind2nd(operation(points_begin[0]), points_begin[0])))); + bind_2(operation(points_begin[0]), points_begin[0]), + bind_2(operation(points_begin[0]), points_begin[0])))); // give result: max_perimeter = operation(*points_begin)(*maxi, *points_begin); @@ -305,24 +269,15 @@ public: return o; } // compute_min_k_gon( ... ) - #ifndef CGAL_CFG_NO_MEMBER_TEMPLATES - template < class RandomAccessIC > - #endif - bool - is_convex( RandomAccessIC points_begin, - RandomAccessIC points_end) const - // PRE: value_type of RandomAccessIC is Point_2 - // POST: return true, iff the points [ points_begin, points_end) - // form a convex chain. - { - typedef Polygon_traits_2< R > P_traits; - typedef std::vector< Point_2 > Cont; - typedef Polygon_2< P_traits, Cont > Polygon_2; - - Polygon_2 p( points_begin, points_end); - return p.is_convex(); - } // is_convex( points_begin, points_end) +#ifdef CGAL_OPTIMISATION_EXPENSIVE_PRECONDITION_TAG + Less_xy_2 less_xy_2_object() const { return k.less_xy_2_object(); } + Orientation_2 orientation_2_object() const + { return k.orientation_2_object(); } +#endif // CGAL_OPTIMISATION_EXPENSIVE_PRECONDITION_TAG + +protected: + K k; }; diff --git a/Packages/Matrix_search/include/CGAL/Rectangular_p_center_traits_2.h b/Packages/Matrix_search/include/CGAL/Rectangular_p_center_traits_2.h index 6ae9296bbf1..092224b7c24 100644 --- a/Packages/Matrix_search/include/CGAL/Rectangular_p_center_traits_2.h +++ b/Packages/Matrix_search/include/CGAL/Rectangular_p_center_traits_2.h @@ -36,84 +36,26 @@ CGAL_BEGIN_NAMESPACE -template < class R > -struct Less_x_2 -: public CGAL_STD::binary_function< Point_2< R >, Point_2< R >, bool > -{ - - bool operator()(const Point_2< R >& p, - const Point_2< R >& q) const - { return p.x() < q.x(); } -}; - -template < class R > -struct Less_y_2 -: public CGAL_STD::binary_function< Point_2< R >, Point_2< R >, bool > -{ - bool operator()(const Point_2< R >& p, - const Point_2< R >& q) const - { return p.y() < q.y(); } -}; - -/* -template < class R > -struct Greater_x_2 -: public CGAL_STD::binary_function< Point_2< R >, Point_2< R >, bool > -{ - bool operator()(const Point_2< R >& p, - const Point_2< R >& q) const - { return p.x() > q.x(); } -}; - -template < class R > -struct Greater_y_2 -: public CGAL_STD::binary_function< Point_2< R >, Point_2< R >, bool > -{ - bool operator()(const Point_2< R >& p, - const Point_2< R >& q) const - { return p.y() > q.y(); } -}; -template < class R > -struct Construct_min_point_2 -: public CGAL_STD::unary_function< Iso_rectangle_2< R >, Point_2< R > > -{ - Point_2< R > operator()(const Iso_rectangle_2< R >& r) const - { return r.min(); } -}; - -template < class R > -struct Construct_max_point_2 -: public CGAL_STD::unary_function< Iso_rectangle_2< R >, Point_2< R > > -{ - Point_2< R > operator()(const Iso_rectangle_2< R >& r) const - { return r.max(); } -}; -*/ template < class A, class S > struct Select : public CGAL_STD::binary_function< A, A, A > { + typedef Arity_tag< 2 > Arity; + Select() {} Select(const S& s) : s_(s) {} A operator()(const A& a, const A& b) const { return s_(a, b) ? a : b; } A operator()(const A& a, const A& b) { return s_(a, b) ? a : b; } -private: +protected: S s_; }; -/* -template < class R > -struct Construct_iso_rectangle_2 { - Iso_rectangle_2< R > - operator()(const Point_2< R >& min, const Point_2< R >& max) const - { return Iso_rectangle_2< R >(min, max); } -}; -*/ template < class R > struct Signed_x_distance_2 : public CGAL_STD::binary_function< Point_2< R >, Point_2< R >, typename R::FT > { + typedef Arity_tag< 2 > Arity; typename R::FT operator()(const Point_2< R >& q1, const Point_2< R >& q2) const { return q1.x() - q2.x(); } @@ -123,6 +65,7 @@ struct Signed_y_distance_2 : public CGAL_STD::binary_function< Point_2< R >, Point_2< R >, typename R::FT > { + typedef Arity_tag< 2 > Arity; typename R::FT operator()(const Point_2< R >& q1, const Point_2< R >& q2) const { return q1.y() - q2.y(); } @@ -132,6 +75,7 @@ struct Infinity_distance_2 : public CGAL_STD::binary_function< Point_2< R >, Point_2< R >, typename R::FT > { + typedef Arity_tag< 2 > Arity; typename R::FT operator()(const Point_2< R >& q1, const Point_2< R >& q2) const { return max(CGAL_NTS abs(q1.x() - q2.x()), @@ -143,20 +87,12 @@ struct Signed_infinity_distance_2 : public CGAL_STD::binary_function< Point_2< R >, Point_2< R >, typename R::FT > { + typedef Arity_tag< 2 > Arity; typename R::FT operator()(const Point_2< R >& q1, const Point_2< R >& q2) const { return max(q1.x() - q2.x(), q1.y() - q2.y()); } }; template < class R > -struct Construct_corner_2 -: public CGAL_STD::binary_function< - Iso_rectangle_2< R >, unsigned int, Point_2< R > > -{ - Point_2< R > - operator()(const Iso_rectangle_2< R >& q, unsigned int i) const - { return q[i]; } -}; -template < class R > struct Construct_point_2_above_right_implicit_point_2 { // (p, q, r) |--> (p.x() + r, q.y() + r) typedef typename R::FT FT; @@ -199,18 +135,6 @@ struct Construct_point_2_below_right_implicit_point_2 { operator()(const P& p, const P& q, FT r) const { return P(p.x() + r, q.y() - r); } }; -// Point_2 x Point_2 --> Point_2 -// (p, q) |-> projection of p onto the horizontal line through q -template < class R > -struct Construct_projection_onto_horizontal_implicit_line_2 -: public CGAL_STD::binary_function< Point_2< R >, - Point_2< R >, - Point_2< R > > -{ - typedef CGAL::Point_2< R > Point_2; - Point_2 operator()(const Point_2& p, const Point_2& q) const - { return Point_2(p.x(), q.y()); } -}; template < class R > @@ -220,74 +144,30 @@ struct Rectangular_p_center_default_traits_2 : public R // types: // typedef typename R::FT FT; - typedef CGAL::Point_2< R > Point_2; - typedef CGAL::Iso_rectangle_2< R > Iso_rectangle_2; + typedef typename R::Point_2 Point_2; + typedef typename R::Iso_rectangle_2 Iso_rectangle_2; // ----------------------------------------------------------------- // predicates: // - // from the kernel - //typedef typename R::Less_x_2 Less_x_2; - //typedef typename R::Less_y_2 Less_y_2; - typedef CGAL::Less_x_2< R > Less_x_2; - typedef CGAL::Less_y_2< R > Less_y_2; - Less_x_2 less_x_2_object() const { return Less_x_2(); } - Less_y_2 less_y_2_object() const { return Less_y_2(); } - - // additions - struct Greater_x_2 : public std::binary_function< Point_2, Point_2, bool > - { - Greater_x_2(const Less_x_2& l) : lessx2(l) {} - - bool operator()(const Point_2& p, const Point_2& q) const - { return lessx2(q, p); } - private: - Less_x_2 lessx2; - }; - struct Greater_y_2 : public std::binary_function< Point_2, Point_2, bool > - { - Greater_y_2(const Less_y_2& l) : lessy2(l) {} - - bool operator()(const Point_2& p, const Point_2& q) const - { return lessy2(q, p); } - private: - Less_y_2 lessy2; - }; - - // object methods: - Greater_x_2 greater_x_2_object() const - { return Greater_x_2(less_x_2_object()); } - Greater_y_2 greater_y_2_object() const - { return Greater_y_2(less_y_2_object()); } + typedef typename R::Less_x_2 Less_x_2; + typedef typename R::Less_y_2 Less_y_2; // ----------------------------------------------------------------- // constructions: // // from the kernel - typedef typename R::Construct_min_point_2 Construct_min_point_2; - typedef typename R::Construct_max_point_2 Construct_max_point_2; typedef typename R::Construct_iso_rectangle_2 Construct_iso_rectangle_2; + typedef typename R::Construct_vertex_2 Construct_vertex_2; // additions - /* - Now from the Kernel (hopefully :) - typedef Construct_iso_rectangle_2< R > Construct_iso_rectangle_2; - Construct_iso_rectangle_2 - construct_iso_rectangle_2_object() const - { return Construct_iso_rectangle_2(); } - */ - typedef Signed_x_distance_2< R > Signed_x_distance_2; typedef Signed_y_distance_2< R > Signed_y_distance_2; typedef Infinity_distance_2< R > Infinity_distance_2; typedef Signed_infinity_distance_2< R > Signed_infinity_distance_2; - typedef Construct_corner_2< R > Construct_corner_2; - - typedef Construct_projection_onto_horizontal_implicit_line_2< R > - Construct_projection_onto_horizontal_implicit_line_2; typedef Construct_point_2_above_right_implicit_point_2< R > Construct_point_2_above_right_implicit_point_2; @@ -311,12 +191,6 @@ struct Rectangular_p_center_default_traits_2 : public R Signed_infinity_distance_2 signed_infinity_distance_2_object() const { return Signed_infinity_distance_2(); } - Construct_corner_2 - construct_corner_2_object() const - { return Construct_corner_2(); } - Construct_projection_onto_horizontal_implicit_line_2 - construct_projection_onto_horizontal_implicit_line_2_object() const - { return Construct_projection_onto_horizontal_implicit_line_2(); } Construct_point_2_above_right_implicit_point_2 construct_point_2_above_right_implicit_point_2_object() const { return Construct_point_2_above_right_implicit_point_2(); } @@ -330,33 +204,7 @@ struct Rectangular_p_center_default_traits_2 : public R construct_point_2_below_right_implicit_point_2_object() const { return Construct_point_2_below_right_implicit_point_2(); } - //!!! this shouldn't be here as it can be written in terms - // of known stuff - struct Min_x_2 : public Select< Point_2, Less_x_2 > { - Min_x_2(const Less_x_2& l) : Select< Point_2, Less_x_2 >(l) {} - }; - - struct Min_y_2 : public Select< Point_2, Less_y_2 > { - Min_y_2(const Less_y_2& l) : Select< Point_2, Less_y_2 >(l) {} - }; - - struct Max_x_2 : public Select< Point_2, Greater_x_2 > { - Max_x_2(const Greater_x_2& l) : Select< Point_2, Greater_x_2 >(l) {} - }; - - struct Max_y_2 : public Select< Point_2, Greater_y_2 > { - Max_y_2(const Greater_y_2& l) : Select< Point_2, Greater_y_2 >(l) {} - }; - - Min_x_2 min_x_2_object() const - { return Min_x_2(less_x_2_object()); } - Max_x_2 max_x_2_object() const - { return Max_x_2(greater_x_2_object()); } - Min_y_2 min_y_2_object() const - { return Min_y_2(less_y_2_object()); } - Max_y_2 max_y_2_object() const - { return Max_y_2(greater_y_2_object()); } -}; +}; // Rectangular_p_center_default_traits_2 template < class Traits_, class PiercingFunction_ > struct Rectangular_p_center_matrix_search_traits_2 { @@ -399,7 +247,7 @@ struct Rectangular_p_center_matrix_search_traits_2 { return n; //pf(ld, o, ok); } -private: +protected: // data members: LD ld; PiercingFunction pf; @@ -419,20 +267,15 @@ bounding_box_2(ForwardIterator f, ForwardIterator l, const Traits& t) // PRE: f != l. { CGAL_precondition(f != l); - //typedef typename R::Less_x_2 Less_x_2; - //typedef typename R::Less_y_2 Less_y_2; typedef typename Traits::Less_x_2 Less_x_2; typedef typename Traits::Less_y_2 Less_y_2; typedef typename Traits::Construct_iso_rectangle_2 Rect; - typedef typename - Traits::Construct_projection_onto_horizontal_implicit_line_2 - Pohil; + typedef typename Traits::Construct_vertex_2 CVertex; Less_x_2 lessx = t.less_x_2_object(); Less_y_2 lessy = t.less_y_2_object(); - Rect rect = t.construct_iso_rectangle_2_object(); - Pohil pohil = - t.construct_projection_onto_horizontal_implicit_line_2_object(); + Rect rect = t.construct_iso_rectangle_2_object(); + CVertex v = t.construct_vertex_2_object(); ForwardIterator xmin = f; ForwardIterator xmax = f; @@ -446,7 +289,7 @@ bounding_box_2(ForwardIterator f, ForwardIterator l, const Traits& t) if (lessy(*ymax, *f)) ymax = f; } - return rect(pohil(*xmin, *ymin), pohil(*xmax, *ymax)); + return rect(v(rect(*xmin, *ymin), 0), v(rect(*xmax, *ymax), 2)); } // bounding_box_2(f, l, t) template < class ForwardIterator > inline typename @@ -469,39 +312,31 @@ construct_bounding_box_union_2(const Rectangle& r1, const Rectangle& r2, const Traits& t) { - //typedef typename R::Construct_iso_rectangle_2 Rect; - //typedef typename R::Less_x_2 Less_x_2; - //typedef typename R::Less_y_2 Less_y_2; typedef typename Traits::Construct_iso_rectangle_2 Rect; - typedef typename Traits::Construct_min_point_2 Minpt; - typedef typename Traits::Construct_max_point_2 Maxpt; + typedef typename Traits::Construct_vertex_2 CVertex; typedef typename Traits::Less_x_2 Less_x_2; typedef typename Traits::Less_y_2 Less_y_2; - typedef typename - Traits::Construct_projection_onto_horizontal_implicit_line_2 - Pohil; Less_x_2 lessx = t.less_x_2_object(); Less_y_2 lessy = t.less_y_2_object(); Rect rect = t.construct_iso_rectangle_2_object(); - Minpt minpt = t.construct_min_point_2_object(); - Maxpt maxpt = t.construct_max_point_2_object(); - Pohil pohil = - t.construct_projection_onto_horizontal_implicit_line_2_object(); + CVertex v = t.construct_vertex_2_object(); #ifdef __BORLANDC__ typedef typename Traits::Point_2 Point_2; - Point_2 bpt1 = lessx(minpt(r1), r2.min()) ? minpt(r1) : minpt(r2); - Point_2 bpt2 = lessy(minpt(r1), r2.min()) ? minpt(r1) : minpt(r2); - Point_2 bpt3 = lessx(maxpt(r2), maxpt(r1)) ? maxpt(r1) : maxpt(r2); - Point_2 bpt4 = lessy(maxpt(r2), maxpt(r1)) ? maxpt(r1) : maxpt(r2); - return rect(pohil(bpt1, bpt2), pohil(bpt3, bpt4)); + Point_2 bpt1 = lessx(v(r1, 0), v(r2, 0)) ? v(r1, 0) : v(r2, 0); + Point_2 bpt2 = lessy(v(r1, 0), v(r2, 0)) ? v(r1, 0) : v(r2, 0); + Point_2 bpt3 = lessx(v(r2, 2), v(r1, 2)) ? v(r1, 2) : v(r2, 2); + Point_2 bpt4 = lessy(v(r2, 2), v(r1, 2)) ? v(r1, 2) : v(r2, 2); + return rect(v(rect(bpt1, bpt2), 0), v(rect(bpt3, bpt4), 2)); #else return rect( - pohil(lessx(minpt(r1), r2.min()) ? minpt(r1) : minpt(r2), - lessy(minpt(r1), r2.min()) ? minpt(r1) : minpt(r2)), - pohil(lessx(maxpt(r2), maxpt(r1)) ? maxpt(r1) : maxpt(r2), - lessy(maxpt(r2), maxpt(r1)) ? maxpt(r1) : maxpt(r2))); + v(rect(lessx(v(r1, 0), v(r2, 0)) ? v(r1, 0) : v(r2, 0), + lessy(v(r1, 0), v(r2, 0)) ? v(r1, 0) : v(r2, 0)), + 0), + v(rect(lessx(v(r2, 2), v(r1, 2)) ? v(r1, 2) : v(r2, 2), + lessy(v(r2, 2), v(r1, 2)) ? v(r1, 2) : v(r2, 2)), + 2)); #endif } // construct_bounding_box_union_2(r1, r2, t) template < class Rectangle > diff --git a/Packages/Matrix_search/include/CGAL/all_furthest_neighbors_2.h b/Packages/Matrix_search/include/CGAL/all_furthest_neighbors_2.h index 7f1017ddf95..8939c087bd3 100644 --- a/Packages/Matrix_search/include/CGAL/all_furthest_neighbors_2.h +++ b/Packages/Matrix_search/include/CGAL/all_furthest_neighbors_2.h @@ -29,15 +29,11 @@ #define CGAL_ALL_FURTHEST_NEIGHBORS_2_H 1 #include - -#ifdef CGAL_REP_CLASS_DEFINED -#include -#endif // CGAL_REP_CLASS_DEFINED - #include #include #include -#include +#include +#include #include CGAL_BEGIN_NAMESPACE @@ -122,16 +118,16 @@ all_furthest_neighbors_2( RandomAccessIC points_begin, #ifndef CGAL_CFG_NO_NAMESPACE using std::vector; using std::transform; - using std::bind2nd; using std::modulus; #endif #ifndef CGAL_CFG_TYPENAME_BUG - typedef All_furthest_neighbor_matrix< typename Traits::Distance, - RandomAccessIC > + typedef All_furthest_neighbor_matrix< + typename Traits::Compute_squared_distance_2, RandomAccessIC > Afn_matrix; #else - typedef All_furthest_neighbor_matrix< Traits::Distance, RandomAccessIC > + typedef All_furthest_neighbor_matrix< + Traits::Compute_squared_distance_2, RandomAccessIC > Afn_matrix; #endif // CGAL_CFG_TYPENAME_BUG @@ -140,10 +136,9 @@ all_furthest_neighbors_2( RandomAccessIC points_begin, iterator_distance( points_begin, points_end)); CGAL_optimisation_precondition( number_of_points > 0); CGAL_optimisation_expensive_precondition( - t.is_convex( points_begin, points_end)); + is_convex_2( points_begin, points_end, t)); // prepare random access container: - //vector< int > v( number_of_points, 0); vector< int > v; v.reserve( number_of_points); for (int i = 0; i < number_of_points; ++i) @@ -152,22 +147,22 @@ all_furthest_neighbors_2( RandomAccessIC points_begin, // compute maxima: monotone_matrix_search( dynamic_matrix( - Afn_matrix(points_begin, points_end, t.distance_object())), + Afn_matrix(points_begin, + points_end, + t.compute_squared_distance_2_object())), v.begin()); // output result: return transform( v.begin(), v.end(), o, - bind2nd( modulus< int >(), number_of_points)); + bind_2( modulus< int >(), number_of_points)); } // all_furthest_neighbors_2( ... ) #if !defined(CGAL_CFG_NO_ITERATOR_TRAITS) && \ !defined(CGAL_CFG_MATCHING_BUG_2) -template < class RandomAccessIC, - class OutputIterator, - class Traits > +template < class RandomAccessIC, class OutputIterator, class Traits > OutputIterator all_furthest_neighbors_2( RandomAccessIC points_begin, RandomAccessIC points_end, @@ -177,11 +172,12 @@ all_furthest_neighbors_2( RandomAccessIC points_begin, std::random_access_iterator_tag) { #ifndef CGAL_CFG_TYPENAME_BUG - typedef All_furthest_neighbor_matrix< typename Traits::Distance, - RandomAccessIC > + typedef All_furthest_neighbor_matrix< + typename Traits::Compute_squared_distance_2, RandomAccessIC > Afn_matrix; #else - typedef All_furthest_neighbor_matrix< Traits::Distance, RandomAccessIC > + typedef All_furthest_neighbor_matrix< + Traits::Compute_squared_distance_2, RandomAccessIC > Afn_matrix; #endif // CGAL_CFG_TYPENAME_BUG @@ -190,7 +186,7 @@ all_furthest_neighbors_2( RandomAccessIC points_begin, iterator_distance( points_begin, points_end)); CGAL_optimisation_precondition( number_of_points > 0); CGAL_optimisation_expensive_precondition( - t.is_convex( points_begin, points_end)); + is_convex_2( points_begin, points_end, t)); // compute maxima: monotone_matrix_search( @@ -219,6 +215,26 @@ all_furthest_neighbors_2( RandomAccessIC points_begin, #endif // !CGAL_CFG_NO_ITERATOR_TRAITS && !CGAL_CFG_MATCHING_BUG_2 +template < class RandomAccessIC, class OutputIterator > +inline +OutputIterator +all_furthest_neighbors_2( RandomAccessIC points_begin, + RandomAccessIC points_end, + OutputIterator o) +{ + typedef typename std::iterator_traits< RandomAccessIC >::value_type::R R; + return all_furthest_neighbors_2( points_begin, points_end, o, R()); +} // all_furthest_neighbors_2( ... ) + +// backwards compatibility +template < class RandomAccessIC, class OutputIterator > +inline +OutputIterator +all_furthest_neighbors( RandomAccessIC points_begin, + RandomAccessIC points_end, + OutputIterator o) +{ return all_furthest_neighbors_2( points_begin, points_end, o); } + CGAL_END_NAMESPACE #endif // ! (CGAL_ALL_FURTHEST_NEIGHBORS_2_H) diff --git a/Packages/Matrix_search/include/CGAL/extremal_polygon_2.h b/Packages/Matrix_search/include/CGAL/extremal_polygon_2.h index cc0d2d96c15..6eb94d528ff 100644 --- a/Packages/Matrix_search/include/CGAL/extremal_polygon_2.h +++ b/Packages/Matrix_search/include/CGAL/extremal_polygon_2.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -45,7 +46,8 @@ template < class Array, class Index, class Element > struct Index_operator : public CGAL_STD::binary_function< Array, Index, Element > { -public: + typedef Arity_tag< 2 > Arity; + Element& operator()( Array& a, const Index& i) const { return a[i]; } @@ -517,7 +519,7 @@ extremal_polygon_2( iterator_distance( points_begin, points_end));) CGAL_optimisation_precondition( number_of_points >= t.min_k()); CGAL_optimisation_expensive_precondition( - t.is_convex( points_begin, points_end)); + is_convex_2( points_begin, points_end, t)); typedef typename Traits::Point_2 Point_2; return CGAL_maximum_inscribed_k_gon_2( diff --git a/Packages/Matrix_search/include/CGAL/pierce_rectangles_2.h b/Packages/Matrix_search/include/CGAL/pierce_rectangles_2.h index 0aec5b236d5..2c1ed31879e 100644 --- a/Packages/Matrix_search/include/CGAL/pierce_rectangles_2.h +++ b/Packages/Matrix_search/include/CGAL/pierce_rectangles_2.h @@ -30,7 +30,7 @@ #include #include -#include +#include #include #include #include @@ -231,8 +231,6 @@ struct Staircases : public Loc_domain< Traits_ > { #ifndef CGAL_CFG_NO_NAMESPACE using std::sort; using std::find_if; - using std::bind1st; - using std::bind2nd; #endif // ! CGAL_CFG_NO_NAMESPACE Container& xsort = xgy ? sorted : pts; @@ -245,14 +243,14 @@ struct Staircases : public Loc_domain< Traits_ > { do { brstc.push_back(*i++); i = find_if(i, ysort.end(), - bind1st(traits.less_x_2_object(), brstc.back())); + bind_1(traits.less_x_2_object(), brstc.back())); } while (i != ysort.end()); // top-left Riterator j = ysort.rbegin(); do { tlstc.push_back(*j++); j = find_if(j, ysort.rend(), - bind2nd(traits.less_x_2_object(), tlstc.back())); + bind_2(traits.less_x_2_object(), tlstc.back())); } while (j != ysort.rend()); // build left-bottom and right-top staircases @@ -262,14 +260,14 @@ struct Staircases : public Loc_domain< Traits_ > { do { lbstc.push_back(*i++); i = find_if(i, xsort.end(), - bind2nd(traits.less_y_2_object(), lbstc.back())); + bind_2(traits.less_y_2_object(), lbstc.back())); } while (i != xsort.end()); // right-top j = xsort.rbegin(); do { rtstc.push_back(*j++); j = find_if(j, xsort.rend(), - bind1st(traits.less_y_2_object(), rtstc.back())); + bind_1(traits.less_y_2_object(), rtstc.back())); } while (j != xsort.rend()); } // Staircases(b, e, t) @@ -309,16 +307,16 @@ struct Staircases : public Loc_domain< Traits_ > { min_element_if( pts.begin(), pts.end(), traits.less_x_2_object(), - compose2_1(std::logical_and< bool >(), - std::bind1st(traits.less_x_2_object(), p), - std::bind1st(traits.less_y_2_object(), p))); + compose_shared(std::logical_and< bool >(), + bind_1(traits.less_x_2_object(), p), + bind_1(traits.less_y_2_object(), p))); Citerator j = max_element_if( pts.begin(), pts.end(), traits.less_x_2_object(), - compose2_1(std::logical_and< bool >(), - std::bind2nd(traits.less_x_2_object(), q), - std::bind1st(traits.less_y_2_object(), q))); + compose_shared(std::logical_and< bool >(), + bind_2(traits.less_x_2_object(), q), + bind_1(traits.less_y_2_object(), q))); return Intervall(i == pts.end() ? maxx : *i, j == pts.end() ? minx : *j); } // top_intervall() @@ -335,16 +333,16 @@ struct Staircases : public Loc_domain< Traits_ > { min_element_if( pts.begin(), pts.end(), traits.less_x_2_object(), - compose2_1(std::logical_and< bool >(), - std::bind1st(traits.less_x_2_object(), p), - std::bind2nd(traits.less_y_2_object(), p))); + compose_shared(std::logical_and< bool >(), + bind_1(traits.less_x_2_object(), p), + bind_2(traits.less_y_2_object(), p))); Citerator j = max_element_if( pts.begin(), pts.end(), traits.less_x_2_object(), - compose2_1(std::logical_and< bool >(), - std::bind2nd(traits.less_x_2_object(), q), - std::bind2nd(traits.less_y_2_object(), q))); + compose_shared(std::logical_and< bool >(), + bind_2(traits.less_x_2_object(), q), + bind_2(traits.less_y_2_object(), q))); return Intervall(i == pts.end() ? maxx : *i, j == pts.end() ? minx : *j); } // bottom_intervall() @@ -361,16 +359,16 @@ struct Staircases : public Loc_domain< Traits_ > { min_element_if( pts.begin(), pts.end(), traits.less_y_2_object(), - compose2_1(std::logical_and< bool >(), - std::bind2nd(traits.less_x_2_object(), p), - std::bind1st(traits.less_y_2_object(), p))); + compose_shared(std::logical_and< bool >(), + bind_2(traits.less_x_2_object(), p), + bind_1(traits.less_y_2_object(), p))); Citerator j = max_element_if( pts.begin(), pts.end(), traits.less_y_2_object(), - compose2_1(std::logical_and< bool >(), - std::bind2nd(traits.less_x_2_object(), q), - std::bind2nd(traits.less_y_2_object(), q))); + compose_shared(std::logical_and< bool >(), + bind_2(traits.less_x_2_object(), q), + bind_2(traits.less_y_2_object(), q))); return Intervall(i == pts.end() ? maxy : *i, j == pts.end() ? miny : *j); } // left_intervall() @@ -387,16 +385,16 @@ struct Staircases : public Loc_domain< Traits_ > { min_element_if( pts.begin(), pts.end(), traits.less_y_2_object(), - compose2_1(std::logical_and< bool >(), - std::bind1st(traits.less_x_2_object(), p), - std::bind1st(traits.less_y_2_object(), p))); + compose_shared(std::logical_and< bool >(), + bind_1(traits.less_x_2_object(), p), + bind_1(traits.less_y_2_object(), p))); Citerator j = max_element_if( pts.begin(), pts.end(), traits.less_y_2_object(), - compose2_1(std::logical_and< bool >(), - std::bind1st(traits.less_x_2_object(), q), - std::bind2nd(traits.less_y_2_object(), q))); + compose_shared(std::logical_and< bool >(), + bind_1(traits.less_x_2_object(), q), + bind_2(traits.less_y_2_object(), q))); return Intervall(i == pts.end() ? maxy : *i, j == pts.end() ? miny : *j); } // right_intervall() @@ -495,9 +493,6 @@ two_cover_points( bool& ok) { #ifndef CGAL_CFG_NO_NAMESPACE - using CGAL::compose1_1; - using CGAL::compose2_1; - using std::bind1st; using std::find_if; using std::less; #endif @@ -524,10 +519,10 @@ two_cover_points( if (d.end() == find_if(d.begin(), d.end(), - compose1_1( - bind1st(lessft, d.r), - compose2_1( - minft, bind1st(dist, d[0]), bind1st(dist, d[2]))))) + compose( + bind_1(lessft, d.r), + compose_shared( + minft, bind_1(dist, d[0]), bind_1(dist, d[2]))))) { *o++ = d[0]; *o++ = d[2]; @@ -539,10 +534,10 @@ two_cover_points( if (d.end() == find_if(d.begin(), d.end(), - compose1_1( - bind1st(lessft, d.r), - compose2_1( - minft, bind1st(dist, d[1]), bind1st(dist, d[3]))))) + compose( + bind_1(lessft, d.r), + compose_shared( + minft, bind_1(dist, d[1]), bind_1(dist, d[3]))))) { *o++ = d[1]; *o++ = d[3]; @@ -563,8 +558,6 @@ three_cover_points( { #ifndef CGAL_CFG_NO_NAMESPACE using std::find_if; - using std::bind1st; - using CGAL::compose1_1; using std::less; using std::iter_swap; #endif @@ -586,8 +579,7 @@ three_cover_points( // find first point not covered by the rectangle at d[k] Iterator i = find_if(d.begin(), d.end(), - compose1_1(bind1st(lessft, d.r), - bind1st(dist, corner))); + compose(bind_1(lessft, d.r), bind_1(dist, corner))); // are all points already covered? if (i == d.end()) { @@ -630,12 +622,11 @@ three_cover_points( CGAL_optimisation_expensive_assertion( save_end == find_if(d.end(), save_end, - compose1_1(bind1st(lessft, d.r), - bind1st(dist, corner)))); + compose(bind_1(lessft, d.r), bind_1(dist, corner)))); CGAL_optimisation_expensive_assertion( d.end() == find_if(d.begin(), d.end(), - compose1_1(bind1st(std::greater_equal(), d.r), - bind1st(dist, corner)))); + compose(bind_1(std::greater_equal(), d.r), + bind_1(dist, corner)))); two_cover_points(d, o, ok); @@ -672,9 +663,6 @@ four_cover_points(Staircases< Traits >& d, OutputIterator o, bool& ok) using std::less; using std::iter_swap; using std::find_if; - using std::bind1st; - using std::bind2nd; - using CGAL::compose1_1; using std::back_inserter; #endif @@ -697,9 +685,6 @@ four_cover_points(Staircases< Traits >& d, OutputIterator o, bool& ok) Signed_x_distance_2 sdistx = d.traits.signed_x_distance_2_object(); Signed_y_distance_2 sdisty = d.traits.signed_y_distance_2_object(); - typename Traits::Construct_projection_onto_horizontal_implicit_line_2 - cpohil = - d.traits.construct_projection_onto_horizontal_implicit_line_2_object(); typename Traits::Construct_point_2_above_right_implicit_point_2 cparip = d.traits.construct_point_2_above_right_implicit_point_2_object(); @@ -733,8 +718,7 @@ four_cover_points(Staircases< Traits >& d, OutputIterator o, bool& ok) // find first point not covered by the rectangle at d[k] Iterator i = find_if(d.begin(), d.end(), - compose1_1(bind1st(lessft, d.r), - bind1st(dist, corner))); + compose(bind_1(lessft, d.r), bind_1(dist, corner))); // are all points already covered? if (i == d.end()) { @@ -777,12 +761,11 @@ four_cover_points(Staircases< Traits >& d, OutputIterator o, bool& ok) CGAL_optimisation_expensive_assertion( save_end == find_if(d.end(), save_end, - compose1_1(bind1st(lessft, d.r), - bind1st(dist, corner)))); + compose(bind_1(lessft, d.r), bind_1(dist, corner)))); CGAL_optimisation_expensive_assertion( d.end() == find_if(d.begin(), d.end(), - compose1_1(bind1st(std::greater_equal(), d.r), - bind1st(dist, corner)))); + compose(bind_1(std::greater_equal(), d.r), + bind_1(dist, corner)))); three_cover_points(d, o, ok); diff --git a/Packages/Matrix_search/include/CGAL/rectangular_3_center_2.h b/Packages/Matrix_search/include/CGAL/rectangular_3_center_2.h index 8b016a57929..39be1bac89f 100644 --- a/Packages/Matrix_search/include/CGAL/rectangular_3_center_2.h +++ b/Packages/Matrix_search/include/CGAL/rectangular_3_center_2.h @@ -30,14 +30,13 @@ #include #include -#include +#include #include #ifdef CGAL_REP_CLASS_DEFINED #include #endif // CGAL_REP_CLASS_DEFINED #include #include -#include #ifdef _MSC_VER // that compiler cannot even distinguish between global @@ -46,21 +45,6 @@ #endif // _MSC_VER CGAL_BEGIN_NAMESPACE -/* -struct Wastebasket -: public CGAL_STD::iterator< std::output_iterator_tag, void > -{ - typedef Wastebasket< T > iterator; - - template < class T > - iterator operator=( const T&) { return *this; } - - iterator operator*() { return *this; } - iterator operator++() { return *this; } - iterator operator++(int) { return *this; } -}; -*/ - template < class ForwardIterator, class OutputIterator, class FT, class Traits > @@ -76,16 +60,11 @@ rectangular_2_center_2( using std::pair; using std::greater; using std::less; - using std::bind1st; - using std::binder1st; - using CGAL::Binary_compose_1; #endif typedef typename Traits::Iso_rectangle_2 Rectangle; typedef typename Traits::Point_2 Point; typedef typename Traits::Infinity_distance_2 Dist; - typedef typename Traits::Construct_min_point_2 Min_pt; - typedef typename Traits::Construct_max_point_2 Max_pt; - typedef typename Traits::Construct_corner_2 Corner; + typedef typename Traits::Construct_vertex_2 CVertex; typedef typename Traits::Construct_point_2_above_right_implicit_point_2 P_above_right; typedef typename Traits::Construct_point_2_above_left_implicit_point_2 @@ -94,13 +73,11 @@ rectangular_2_center_2( P_below_right; typedef typename Traits::Construct_point_2_below_left_implicit_point_2 P_below_left; - typedef Binary_compose_1< Min< FT >, binder1st< Dist >, binder1st< Dist > > - Gamma; + typedef typename Bind< Dist, Point, 1 >::Type BDist; + typedef typename Compose_shared< Min< FT >, BDist, BDist >::Type Gamma; // fetch function objects from traits class - Min_pt minpt = t.construct_min_point_2_object(); - Max_pt maxpt = t.construct_max_point_2_object(); - Corner corner = t.construct_corner_2_object(); + CVertex v = t.construct_vertex_2_object(); Dist dist = t.infinity_distance_2_object(); P_above_left pt_a_l = t.construct_point_2_above_left_implicit_point_2_object(); @@ -116,25 +93,25 @@ rectangular_2_center_2( // two cases: top-left & bottom-right or top-right & bottom-left Min< FT > minft; - Gamma gamma1(minft, bind1st(dist, minpt(bb)), - bind1st(dist, maxpt(bb))); - Gamma gamma2(minft, bind1st(dist, corner(bb, 1)), - bind1st(dist, corner(bb, 3))); + Gamma gamma1 = + compose_shared(minft, bind_1(dist, v(bb, 0)), bind_1(dist, v(bb, 2))); + Gamma gamma2 = + compose_shared(minft, bind_1(dist, v(bb, 1)), bind_1(dist, v(bb, 3))); pair< ForwardIterator, ForwardIterator > cand = min_max_element(f, l, - compose2_2(greater< FT >(), gamma1, gamma1), - compose2_2(less< FT >(), gamma2, gamma2)); + compose(greater< FT >(), gamma1, gamma1), + compose(less< FT >(), gamma2, gamma2)); // return the result if (gamma1(*cand.first) < gamma2(*cand.second)) { r = gamma1(*cand.first); - *o++ = pt_a_r(minpt(bb), minpt(bb), r / FT(2)); - *o++ = pt_b_l(maxpt(bb), maxpt(bb), r / FT(2)); + *o++ = pt_a_r(v(bb, 0), v(bb, 0), r / FT(2)); + *o++ = pt_b_l(v(bb, 2), v(bb, 2), r / FT(2)); } else { r = gamma2(*cand.second); - *o++ = pt_a_l(maxpt(bb), minpt(bb), r / FT(2)); - *o++ = pt_b_r(minpt(bb), maxpt(bb), r / FT(2)); + *o++ = pt_a_l(v(bb, 2), v(bb, 0), r / FT(2)); + *o++ = pt_b_r(v(bb, 0), v(bb, 2), r / FT(2)); } return o; } @@ -154,9 +131,6 @@ rectangular_3_center_2_type1( using std::max; using std::less; using std::nth_element; - using std::bind1st; - using std::binder1st; - using CGAL::Binary_compose_1; #endif typedef typename Traits::FT FT; typedef typename Traits::Iso_rectangle_2 Rectangle; @@ -164,9 +138,7 @@ rectangular_3_center_2_type1( typedef typename Traits::Infinity_distance_2 Dist; typedef typename Traits::Signed_infinity_distance_2 Sdist; typedef typename Traits::Construct_iso_rectangle_2 Rect; - typedef typename Traits::Construct_min_point_2 Min_pt; - typedef typename Traits::Construct_max_point_2 Max_pt; - typedef typename Traits::Construct_corner_2 Corner; + typedef typename Traits::Construct_vertex_2 CVertex; typedef typename Traits::Construct_point_2_above_right_implicit_point_2 P_above_right; typedef typename Traits::Construct_point_2_above_left_implicit_point_2 @@ -175,14 +147,12 @@ rectangular_3_center_2_type1( P_below_right; typedef typename Traits::Construct_point_2_below_left_implicit_point_2 P_below_left; - typedef Binary_compose_1< Min< FT >, binder1st< Dist >, binder1st< Dist > > - Gamma; + typedef typename Bind< Dist, Point, 1 >::Type BDist; + typedef typename Compose_shared< Min< FT >, BDist, BDist >::Type Gamma; // fetch function objects from traits class Rect rect = t.construct_iso_rectangle_2_object(); - Min_pt minpt = t.construct_min_point_2_object(); - Max_pt maxpt = t.construct_max_point_2_object(); - Corner corner = t.construct_corner_2_object(); + CVertex v = t.construct_vertex_2_object(); Dist dist = t.infinity_distance_2_object(); Sdist sdist = t.signed_infinity_distance_2_object(); P_above_left pt_a_l = @@ -195,7 +165,7 @@ rectangular_3_center_2_type1( t.construct_point_2_below_right_implicit_point_2_object(); // initialize best radius so far - rad = sdist(maxpt(r), minpt(r)); + rad = sdist(v(r, 2), v(r, 0)); // init to prevent default constructor requirement Point bestpoint = *f; // (initialisation avoids warning) @@ -212,14 +182,15 @@ rectangular_3_center_2_type1( RandomAccessIterator e = l; bool b_empty = true; Min< FT > minft; - Gamma gamma(minft, - bind1st(dist, corner(r, i)), - bind1st(dist, corner(r, 2 + i))); + Gamma gamma = + compose_shared(minft, + bind_1(dist, v(r, i)), + bind_1(dist, v(r, 2 + i))); while (e - s > 1) { // step (a) RandomAccessIterator m = s + (e - s - 1) / 2; - nth_element(s, m, e, compose2_2(less< FT >(), gamma, gamma)); + nth_element(s, m, e, compose(less< FT >(), gamma, gamma)); // step (b) Rectangle b_prime = bounding_box_2(m + 1, e, t); @@ -227,7 +198,7 @@ rectangular_3_center_2_type1( b_prime = construct_bounding_box_union_2(b, b_prime, t); // step (c) / (d) - if (sdist(maxpt(b_prime), minpt(b_prime)) > gamma(*m)) + if (sdist(v(b_prime, 2), v(b_prime, 0)) > gamma(*m)) s = m + 1; else { e = m + 1; @@ -239,16 +210,16 @@ rectangular_3_center_2_type1( // check whether s or (s-1) is the solution Rectangle b_prime = b_empty ? rect(*s, *s) : construct_bounding_box_union_2(b, rect(*s, *s), t); - FT b_prime_size = sdist(maxpt(b_prime), minpt(b_prime)); + FT b_prime_size = sdist(v(b_prime, 2), v(b_prime, 0)); if (b_prime_size < gamma(*s)) { if (b_prime_size < rad) { rad = b_prime_size; - bestpoint = midpoint(minpt(b_prime), maxpt(b_prime)); + bestpoint = midpoint(v(b_prime, 0), v(b_prime, 2)); bestrun = i; } } else if (gamma(*s) < rad) { rad = gamma(*s); - bestpoint = midpoint(minpt(b), maxpt(b)); + bestpoint = midpoint(v(b, 0), v(b, 2)); bestrun = i; } } @@ -256,11 +227,11 @@ rectangular_3_center_2_type1( // return the result *o++ = bestpoint; if (bestrun == 1) { - *o++ = pt_a_l(maxpt(r), minpt(r), rad / FT(2)); - *o++ = pt_b_r(minpt(r), maxpt(r), rad / FT(2)); + *o++ = pt_a_l(v(r, 2), v(r, 0), rad / FT(2)); + *o++ = pt_b_r(v(r, 0), v(r, 2), rad / FT(2)); } else { - *o++ = pt_a_r(minpt(r), minpt(r), rad / FT(2)); - *o++ = pt_b_l(maxpt(r), maxpt(r), rad / FT(2)); + *o++ = pt_a_r(v(r, 0), v(r, 0), rad / FT(2)); + *o++ = pt_b_l(v(r, 2), v(r, 2), rad / FT(2)); } return o; } @@ -275,14 +246,14 @@ struct Rectangular_3_center_2_type2_operations_base { typedef typename R::Infinity_distance_2 Infinity_distance_2; typedef typename R::Less_x_2 Less_x_2; typedef typename R::Less_y_2 Less_y_2; - typedef typename R::Greater_x_2 Greater_x_2; - typedef typename R::Greater_y_2 Greater_y_2; - typedef typename R::Construct_min_point_2 Construct_min_point_2; - typedef typename R::Construct_max_point_2 Construct_max_point_2; - typedef typename R::Construct_corner_2 Construct_corner_2; + typedef typename Swap< Less_x_2 >::Type Greater_x_2; + typedef typename Swap< Less_y_2 >::Type Greater_y_2; + typedef Min< Point_2, Less_x_2 > Min_x_2; + typedef Max< Point_2, Less_x_2 > Max_x_2; + typedef Min< Point_2, Less_y_2 > Min_y_2; + typedef Max< Point_2, Less_y_2 > Max_y_2; + typedef typename R::Construct_vertex_2 Construct_vertex_2; typedef typename R::Construct_iso_rectangle_2 Construct_iso_rectangle_2; - typedef typename R::Construct_projection_onto_horizontal_implicit_line_2 - Construct_projection_onto_horizontal_implicit_line_2; typedef typename R::Construct_point_2_above_right_implicit_point_2 Construct_point_2_above_right_implicit_point_2; typedef typename R::Construct_point_2_above_left_implicit_point_2 @@ -291,21 +262,19 @@ struct Rectangular_3_center_2_type2_operations_base { Construct_point_2_below_right_implicit_point_2; typedef typename R::Construct_point_2_below_left_implicit_point_2 Construct_point_2_below_left_implicit_point_2; - typedef std::binder1st< Infinity_distance_2 > Delta; + typedef typename Bind< Infinity_distance_2, Point_2, 1 >::Type Delta; Delta delta() const { return delta_; } Less_x_2 less_x_2_object() const { return r_.less_x_2_object(); } Less_y_2 less_y_2_object() const { return r_.less_y_2_object(); } - Greater_x_2 greater_x_2_object() const { return r_.greater_x_2_object(); } - Greater_y_2 greater_y_2_object() const { return r_.greater_y_2_object(); } + Greater_x_2 greater_x_2_object() const + { return swap_1(less_x_2_object()); } + Greater_y_2 greater_y_2_object() const + { return swap_1(less_y_2_object()); } Infinity_distance_2 distance() const { return r_.infinity_distance_2_object(); } - Construct_min_point_2 construct_min_point_2_object() const - { return r_.construct_min_point_2_object(); } - Construct_max_point_2 construct_max_point_2_object() const - { return r_.construct_max_point_2_object(); } - Construct_corner_2 corner() const - { return r_.construct_corner_2_object(); } + Construct_vertex_2 construct_vertex_2_object() const + { return r_.construct_vertex_2_object(); } Construct_iso_rectangle_2 construct_iso_rectangle_2_object() const { return r_.construct_iso_rectangle_2_object(); } @@ -322,18 +291,10 @@ struct Rectangular_3_center_2_type2_operations_base { pt_a_r() const { return r_.construct_point_2_above_right_implicit_point_2_object(); } - typedef typename R::Min_x_2 Min_x_2; - Min_x_2 minx() const { return r_.min_x_2_object(); } - typedef typename R::Min_y_2 Min_y_2; - Min_y_2 miny() const { return r_.min_y_2_object(); } - typedef typename R::Max_x_2 Max_x_2; - Max_x_2 maxx() const { return r_.max_x_2_object(); } - typedef typename R::Max_y_2 Max_y_2; - Max_y_2 maxy() const { return r_.max_y_2_object(); } - - Construct_projection_onto_horizontal_implicit_line_2 - construct_projection_onto_horizontal_implicit_line_2_object() const - { return r_.construct_projection_onto_horizontal_implicit_line_2_object(); } + Min_x_2 minx() const { return Min_x_2(less_x_2_object()); } + Min_y_2 miny() const { return Min_y_2(less_y_2_object()); } + Max_x_2 maxx() const { return Max_x_2(less_x_2_object()); } + Max_y_2 maxy() const { return Max_y_2(less_y_2_object()); } private: R& r_; @@ -342,7 +303,7 @@ struct Rectangular_3_center_2_type2_operations_base { public: Rectangular_3_center_2_type2_operations_base(R& r, const Point_2& p) - : r_(r), delta_(std::bind1st(r.infinity_distance_2_object(), p)) + : r_(r), delta_(bind_1(r.infinity_distance_2_object(), p)) {} }; @@ -371,16 +332,17 @@ struct Rectangular_3_center_2_type2_operations0 const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - minx()(first_uncovered, construct_min_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_max_point_2_object()(bbox)); + minx()(first_uncovered, v(constraint, 0)); + return v(rect(bpt, v(bbox, 2)), 3); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? first_uncovered : - minx()(first_uncovered, construct_min_point_2_object()(constraint)), - construct_max_point_2_object()(bbox)); + return v(rect(constraint_empty ? first_uncovered : + minx()(first_uncovered, v(constraint, 0)), + v(bbox, 2)), + 3); #endif } @@ -388,17 +350,15 @@ struct Rectangular_3_center_2_type2_operations0 const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_max_point_2_object()(bbox)); + Point bpt = constraint_empty ? v(bbox, 2) : v(constraint, 0); + return v(rect(bpt, v(bbox, 2)), 3); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? - construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint), - construct_max_point_2_object()(bbox)); + return v(rect(constraint_empty ? v(bbox, 2) : v(constraint, 0), + v(bbox, 2)), + 3); #endif } @@ -406,11 +366,11 @@ struct Rectangular_3_center_2_type2_operations0 const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - minx()( - pt_b_l()(construct_max_point_2_object()(bbox), - construct_max_point_2_object()(bbox), radius), so_far), - so_far); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(minx()(pt_b_l()(v(bbox, 2), v(bbox, 2), radius), so_far), + so_far), + 3); } Point place_y_square(bool constraint_empty, @@ -418,16 +378,17 @@ struct Rectangular_3_center_2_type2_operations0 const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - miny()(first_uncovered, construct_min_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), bpt); + miny()(first_uncovered, v(constraint, 0)); + return v(rect(v(bbox, 2), bpt), 1); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), - constraint_empty ? first_uncovered : - miny()(first_uncovered, construct_min_point_2_object()(constraint))); + return v(rect(v(bbox, 2), + constraint_empty ? first_uncovered : + miny()(first_uncovered, v(constraint, 0))), + 1); #endif } @@ -435,17 +396,15 @@ struct Rectangular_3_center_2_type2_operations0 const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), bpt); + Point bpt = constraint_empty ? v(bbox, 2) : v(constraint, 0); + return v(rect(v(bbox, 2), bpt), 1); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), - constraint_empty ? - construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint)); + return v(rect(v(bbox, 2), + constraint_empty ? v(bbox, 2) : v(constraint, 0)), + 1); #endif } @@ -453,32 +412,40 @@ struct Rectangular_3_center_2_type2_operations0 const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - so_far, - miny()(pt_b_l()(construct_max_point_2_object()(bbox), - construct_max_point_2_object()(bbox), radius), - so_far)); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(so_far, + miny()(pt_b_l()(v(bbox, 2), v(bbox, 2), radius), + so_far)), + 1); } Point update_x_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - minx()(s, newp), s); } + { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); - Point update_y_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - s, miny()(s, newp)); } + return v(rect(minx()(s, newp), s), 3); + } + + Point update_y_square(const Point& s, const Point& newp) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + + return v(rect(s, miny()(s, newp)), 1); + } FT compute_x_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 1)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 1)); } FT compute_y_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 3)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 3)); } Point construct_corner_square(const Rectangle& bbox, FT r) const - { return pt_a_r()(construct_min_point_2_object()(bbox), - construct_min_point_2_object()(bbox), r); } + { return pt_a_r()(construct_vertex_2_object()(bbox, 0), + construct_vertex_2_object()(bbox, 0), r); } Point construct_x_square(const Point& p, FT r) const { return pt_b_r()(p, p, r); } @@ -510,16 +477,17 @@ struct Rectangular_3_center_2_type2_operations1 const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - maxx()(first_uncovered, construct_max_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_max_point_2_object()(bbox)); + maxx()(first_uncovered, v(constraint, 2)); + return v(rect(bpt, v(bbox, 3)), 2); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? first_uncovered : - maxx()(first_uncovered, construct_max_point_2_object()(constraint)), - construct_max_point_2_object()(bbox)); + return v(rect(constraint_empty ? first_uncovered : + maxx()(first_uncovered, v(constraint, 2)), + v(bbox, 3)), + 2); #endif } @@ -527,17 +495,15 @@ struct Rectangular_3_center_2_type2_operations1 const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_max_point_2_object()(bbox)); + Point bpt = constraint_empty ? v(bbox, 0) : v(constraint, 2); + return v(rect(bpt, v(bbox, 3)), 2); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? - construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint), - construct_max_point_2_object()(bbox)); + return v(rect(constraint_empty ? v(bbox, 0) : v(constraint, 2), + v(bbox, 3)), + 2); #endif } @@ -545,10 +511,12 @@ struct Rectangular_3_center_2_type2_operations1 const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - maxx()(so_far, pt_a_r()(construct_min_point_2_object()(bbox), - construct_min_point_2_object()(bbox), radius)), - so_far); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(maxx()(so_far, pt_a_r()(v(bbox, 0), + v(bbox, 0), radius)), + so_far), + 2); } Point place_y_square(bool constraint_empty, @@ -556,16 +524,17 @@ struct Rectangular_3_center_2_type2_operations1 const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - miny()(first_uncovered, construct_min_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), bpt); + miny()(first_uncovered, v(constraint, 0)); + return v(rect(v(bbox, 3), bpt), 0); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), - constraint_empty ? first_uncovered : - miny()(first_uncovered, construct_min_point_2_object()(constraint))); + return v(rect(v(bbox, 3), + constraint_empty ? first_uncovered : + miny()(first_uncovered, v(constraint, 0))), + 0); #endif } @@ -573,17 +542,15 @@ struct Rectangular_3_center_2_type2_operations1 const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), bpt); + Point bpt = constraint_empty ? v(bbox, 2) : v(constraint, 0); + return v(rect(v(bbox, 3), bpt), 0); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), - constraint_empty ? - construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint)); + return v(rect(v(bbox, 3), + constraint_empty ? v(bbox, 2) : v(constraint, 0)), + 0); #endif } @@ -591,31 +558,37 @@ struct Rectangular_3_center_2_type2_operations1 const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - so_far, - miny()(so_far, pt_b_l()(construct_max_point_2_object()(bbox), - construct_max_point_2_object()(bbox), radius))); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(so_far, + miny()(so_far, pt_b_l()(v(bbox, 2), + v(bbox, 2), radius))), + 0); } - Point update_x_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - maxx()(s, newp), s); } + Point update_x_square(const Point& s, const Point& newp) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(maxx()(s, newp), s), 2); + } - Point update_y_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - s, miny()(s, newp)); } + Point update_y_square(const Point& s, const Point& newp) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(s, miny()(s, newp)), 0); + } FT compute_x_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 0)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 0)); } FT compute_y_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 2)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 2)); } Point construct_corner_square(const Rectangle& bbox, FT r) const - { return pt_a_l()(construct_max_point_2_object()(bbox), - construct_min_point_2_object()(bbox), r); } + { return pt_a_l()(construct_vertex_2_object()(bbox, 2), + construct_vertex_2_object()(bbox, 0), r); } Point construct_x_square(const Point& p, FT r) const { return pt_b_l()(p, p, r); } @@ -647,16 +620,17 @@ struct Rectangular_3_center_2_type2_operations2 const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - maxx()(first_uncovered, construct_max_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_min_point_2_object()(bbox)); + maxx()(first_uncovered, v(constraint, 2)); + return v(rect(bpt, v(bbox, 0)), 1); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? first_uncovered : - maxx()(first_uncovered, construct_max_point_2_object()(constraint)), - construct_min_point_2_object()(bbox)); + return v(rect(constraint_empty ? first_uncovered : + maxx()(first_uncovered, v(constraint, 2)), + v(bbox, 0)), + 1); #endif } @@ -664,17 +638,15 @@ struct Rectangular_3_center_2_type2_operations2 const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_min_point_2_object()(bbox)); + Point bpt = constraint_empty ? v(bbox, 0) : v(constraint, 2); + return v(rect(bpt, v(bbox, 0)), 1); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? - construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint), - construct_min_point_2_object()(bbox)); + return v(rect(constraint_empty ? v(bbox, 0) : v(constraint, 2), + v(bbox, 0)), + 1); #endif } @@ -682,10 +654,12 @@ struct Rectangular_3_center_2_type2_operations2 const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - maxx()(so_far, pt_a_r()(construct_min_point_2_object()(bbox), - construct_min_point_2_object()(bbox), radius)), - so_far); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(maxx()(so_far, pt_a_r()(v(bbox, 0), + v(bbox, 0), radius)), + so_far), + 1); } Point place_y_square(bool constraint_empty, @@ -693,16 +667,17 @@ struct Rectangular_3_center_2_type2_operations2 const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - maxy()(first_uncovered, construct_max_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), bpt); + maxy()(first_uncovered, v(constraint, 2)); + return v(rect(v(bbox, 0), bpt), 3); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), - constraint_empty ? first_uncovered : - maxy()(first_uncovered, construct_max_point_2_object()(constraint))); + return v(rect(v(bbox, 0), + constraint_empty ? first_uncovered : + maxy()(first_uncovered, v(constraint, 2))), + 3); #endif } @@ -710,17 +685,15 @@ struct Rectangular_3_center_2_type2_operations2 const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), bpt); + Point bpt = constraint_empty ? v(bbox, 0) : v(constraint, 2); + return v(rect(v(bbox, 0), bpt), 3); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), - constraint_empty ? - construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint)); + return v(rect(v(bbox, 0), + constraint_empty ? v(bbox, 0) : v(constraint, 2)), + 3); #endif } @@ -728,31 +701,37 @@ struct Rectangular_3_center_2_type2_operations2 const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - so_far, - maxy()(pt_a_r()(construct_min_point_2_object()(bbox), - construct_min_point_2_object()(bbox), radius), so_far)); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(so_far, + maxy()(pt_a_r()(v(bbox, 0), + v(bbox, 0), radius), so_far)), + 3); } - Point update_x_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - maxx()(s, newp), s); } + Point update_x_square(const Point& s, const Point& newp) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(maxx()(s, newp), s), 1); + } - Point update_y_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - s, maxy()(s, newp)); } + Point update_y_square(const Point& s, const Point& newp) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(s, maxy()(s, newp)), 3); + } FT compute_x_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 3)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 3)); } FT compute_y_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 1)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 1)); } Point construct_corner_square(const Rectangle& bbox, FT r) const - { return pt_b_l()(construct_max_point_2_object()(bbox), - construct_max_point_2_object()(bbox), r); } + { return pt_b_l()(construct_vertex_2_object()(bbox, 2), + construct_vertex_2_object()(bbox, 2), r); } Point construct_x_square(const Point& p, FT r) const { return pt_a_l()(p, p, r); } @@ -784,16 +763,17 @@ struct Rectangular_3_center_2_type2_operations3 const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - minx()(first_uncovered, construct_min_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_min_point_2_object()(bbox)); + minx()(first_uncovered, v(constraint, 0)); + return v(rect(bpt, v(bbox, 1)), 0); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? first_uncovered : - minx()(first_uncovered, construct_min_point_2_object()(constraint)), - construct_min_point_2_object()(bbox)); + return v(rect(constraint_empty ? first_uncovered : + minx()(first_uncovered, v(constraint, 0)), + v(bbox, 1)), + 0); #endif } @@ -801,17 +781,15 @@ struct Rectangular_3_center_2_type2_operations3 const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_min_point_2_object()(bbox)); + Point bpt = constraint_empty ? v(bbox, 2) : v(constraint, 0); + return v(rect(bpt, v(bbox, 1)), 0); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? - construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint), - construct_min_point_2_object()(bbox)); + return v(rect(constraint_empty ? v(bbox, 2) : v(constraint, 0), + v(bbox, 1)), + 0); #endif } @@ -819,10 +797,12 @@ struct Rectangular_3_center_2_type2_operations3 const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - minx()(pt_b_l()(construct_max_point_2_object()(bbox), - construct_max_point_2_object()(bbox), radius), so_far), - so_far); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(minx()(pt_b_l()(v(bbox, 2), + v(bbox, 2), radius), so_far), + so_far), + 0); } Point place_y_square(bool constraint_empty, @@ -830,16 +810,17 @@ struct Rectangular_3_center_2_type2_operations3 const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - maxy()(first_uncovered, construct_max_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), bpt); + maxy()(first_uncovered, v(constraint, 2)); + return v(rect(v(bbox, 1), bpt), 2); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), - constraint_empty ? first_uncovered : - maxy()(first_uncovered, construct_max_point_2_object()(constraint))); + return v(rect(v(bbox, 1), + constraint_empty ? first_uncovered : + maxy()(first_uncovered, v(constraint, 2))), + 2); #endif } @@ -847,17 +828,15 @@ struct Rectangular_3_center_2_type2_operations3 const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), bpt); + Point bpt = constraint_empty ? v(bbox, 0) : v(constraint, 2); + return v(rect(v(bbox, 1), bpt), 2); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), - constraint_empty ? - construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint)); + return v(rect(v(bbox, 1), + constraint_empty ? v(bbox, 0) : v(constraint, 2)), + 2); #endif } @@ -865,31 +844,37 @@ struct Rectangular_3_center_2_type2_operations3 const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - so_far, - maxy()(pt_a_r()(construct_min_point_2_object()(bbox), - construct_min_point_2_object()(bbox), radius), so_far)); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(so_far, + maxy()(pt_a_r()(v(bbox, 0), + v(bbox, 0), radius), so_far)), + 2); } - Point update_x_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - minx()(s, newp), s); } + Point update_x_square(const Point& s, const Point& newp) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(minx()(s, newp), s), 0); + } - Point update_y_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - s, maxy()(s, newp)); } + Point update_y_square(const Point& s, const Point& newp) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(s, maxy()(s, newp)), 2); + } FT compute_x_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 2)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 2)); } FT compute_y_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 0)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 0)); } Point construct_corner_square(const Rectangle& bbox, FT r) const - { return pt_b_r()(construct_min_point_2_object()(bbox), - construct_max_point_2_object()(bbox), r); } + { return pt_b_r()(construct_vertex_2_object()(bbox, 0), + construct_vertex_2_object()(bbox, 2), r); } Point construct_x_square(const Point& p, FT r) const { return pt_a_r()(p, p, r); } @@ -930,11 +915,6 @@ rectangular_3_center_2_type2( using std::sort; using std::partition; using std::pair; - using std::binder1st; - using std::bind1st; - using CGAL::compose1_1; - using CGAL::compose2_1; - using CGAL::Binary_compose_1; #endif typedef typename Operations::Point Point; @@ -943,8 +923,9 @@ rectangular_3_center_2_type2( typename Operations::Construct_iso_rectangle_2 rect = op.construct_iso_rectangle_2_object(); - typename Operations::Construct_projection_onto_horizontal_implicit_line_2 - pohil = op.construct_projection_onto_horizontal_implicit_line_2_object(); + + typename Operations::Construct_vertex_2 + v = op.construct_vertex_2_object(); // constant fraction to be excluded on every iteration (1/.) const unsigned int fraction = 7; @@ -970,7 +951,7 @@ rectangular_3_center_2_type2( { // First try whether the best radius so far can be reached at all RandomAccessIterator m = - partition(f, l, compose1_1(bind1st(greater< FT >(), rad), op.delta())); + partition(f, l, compose(bind_1(greater< FT >(), rad), op.delta())); IP pos = min_max_element(m, l, op.compare_x(), op.compare_y()); // extreme points of the two other squares Point q_t = @@ -981,12 +962,12 @@ rectangular_3_center_2_type2( op.place_y_square(op.place_y_square(Q_r_empty, Q_r, *pos.second, r), r, rad); - binder1st< greater_equal< FT > > - le_rad = bind1st(greater_equal< FT >(), rad); + typename Bind< greater_equal< FT >, FT, 1 >::Type + le_rad = bind_1(greater_equal< FT >(), rad); RandomAccessIterator b1 = - partition(m, l, compose1_1(le_rad, bind1st(op.distance(), q_t))); + partition(m, l, compose(le_rad, bind_1(op.distance(), q_t))); RandomAccessIterator b2 = - partition(b1, l, compose1_1(le_rad, bind1st(op.distance(), q_r))); + partition(b1, l, compose(le_rad, bind_1(op.distance(), q_r))); if (b2 != l) return o; @@ -998,7 +979,7 @@ rectangular_3_center_2_type2( while (e - s > 6) { int cutoff = (e - s) / 2; RandomAccessIterator m = s + cutoff - 1; - nth_element(s, m, e, compose2_2(less< FT >(), op.delta(), op.delta())); + nth_element(s, m, e, compose(less< FT >(), op.delta(), op.delta())); // step (b) IP pos = min_max_element(m + 1, e, op.compare_x(), op.compare_y()); @@ -1011,13 +992,13 @@ rectangular_3_center_2_type2( Point q_r = op.place_y_square(q_r_afap, r, op.delta()(*m)); // check for covering - binder1st< greater_equal< FT > > - le_delta_m(bind1st(greater_equal< FT >(), op.delta()(*m))); + typename Bind< greater_equal< FT >, FT, 1 >::Type + le_delta_m(bind_1(greater_equal< FT >(), op.delta()(*m))); RandomAccessIterator b1 = partition(m + 1, e, - compose1_1(le_delta_m, bind1st(op.distance(), q_t))); + compose(le_delta_m, bind_1(op.distance(), q_t))); RandomAccessIterator b2 = - partition(b1, e, compose1_1(le_delta_m, bind1st(op.distance(), q_r))); + partition(b1, e, compose(le_delta_m, bind_1(op.distance(), q_r))); if (b2 != e) s = m; @@ -1035,7 +1016,7 @@ rectangular_3_center_2_type2( // step (a) int cutoff = (e - s) / fraction; RandomAccessIterator m = s + cutoff - 1; - nth_element(s, m, e, compose2_2(less< FT >(), op.delta(), op.delta())); + nth_element(s, m, e, compose(less< FT >(), op.delta(), op.delta())); // step (b) IP pos = min_max_element(m + 1, e, op.compare_x(), op.compare_y()); @@ -1053,28 +1034,28 @@ rectangular_3_center_2_type2( // to Q_t and Q_r are covered by q_t and q_r if ((Q_t_empty || op.compute_x_distance(q_t, Q_t) <= op.delta()(*m)) && (Q_r_empty || op.compute_y_distance(q_r, Q_r) <= op.delta()(*m))) { - binder1st< less< FT > > - greater_delta_m(bind1st(less< FT >(), op.delta()(*m))); + typename Bind< less< FT >, FT, 1 >::Type + greater_delta_m(bind_1(less< FT >(), op.delta()(*m))); CGAL_optimisation_assertion_code(RandomAccessIterator iii =) find_if(e, l, - compose2_1(logical_and< bool >(), - compose1_1(greater_delta_m, - bind1st(op.distance(), q_t)), - compose1_1(greater_delta_m, - bind1st(op.distance(), q_r)))); - CGAL_optimisation_assertion(iii == l); + compose_shared(logical_and< bool >(), + compose(greater_delta_m, + bind_1(op.distance(), q_t)), + compose(greater_delta_m, + bind_1(op.distance(), q_r)))); + CGAL_optimisation_assertion(iii == l); } // check whether the points in [f,s) are covered { - binder1st< greater_equal< FT > > - le_delta_m(bind1st(greater_equal< FT >(), op.delta()(*m))); + typename Bind< greater_equal< FT >, FT, 1 >::Type + le_delta_m(bind_1(greater_equal< FT >(), op.delta()(*m))); RandomAccessIterator iii = - partition(f, s, compose1_1(le_delta_m, op.delta())); + partition(f, s, compose(le_delta_m, op.delta())); iii = partition(iii, s, - compose1_1(le_delta_m, bind1st(op.distance(), q_t))); + compose(le_delta_m, bind_1(op.distance(), q_t))); iii = partition(iii, s, - compose1_1(le_delta_m, bind1st(op.distance(), q_r))); + compose(le_delta_m, bind_1(op.distance(), q_r))); CGAL_optimisation_assertion(iii == s); } #endif // CGAL_3COVER_CHECK @@ -1082,15 +1063,15 @@ rectangular_3_center_2_type2( // partition the range [m+1, e) into ranges // [m+1, b1), [b1, b2), [b2, b3) and [b3, e) // R G cap q_t G cap q_r none - binder1st< greater_equal< FT > > - le_delta_m(bind1st(greater_equal< FT >(), op.delta()(*m))); + typename Bind< greater_equal< FT >, FT, 1 >::Type + le_delta_m(bind_1(greater_equal< FT >(), op.delta()(*m))); RandomAccessIterator b2 = - partition(m + 1, e, compose1_1(le_delta_m, bind1st(op.distance(), q_t))); + partition(m + 1, e, compose(le_delta_m, bind_1(op.distance(), q_t))); RandomAccessIterator b1 = partition(m + 1, b2, - compose1_1(le_delta_m, bind1st(op.distance(), q_r))); + compose(le_delta_m, bind_1(op.distance(), q_r))); RandomAccessIterator b3 = - partition(b2, e, compose1_1(le_delta_m, bind1st(op.distance(), q_r))); + partition(b2, e, compose(le_delta_m, bind_1(op.distance(), q_r))); // step (c) @@ -1151,8 +1132,8 @@ rectangular_3_center_2_type2( Point y_min_cutoff = *(m + 1 + cutoff); nth_element(m + 1, m + 1 + cutoff, b1, op.greater_y_2_object()); Point y_max_cutoff = *(m + 1 + cutoff); - Rectangle B = rect(pohil(x_min_cutoff, y_min_cutoff), - pohil(x_max_cutoff, y_max_cutoff)); + Rectangle B = rect(v(rect(x_min_cutoff, y_min_cutoff), 0), + v(rect(x_max_cutoff, y_max_cutoff), 2)); // Algorithm search_E: @@ -1164,7 +1145,7 @@ rectangular_3_center_2_type2( // step 1 RandomAccessIterator s_m = s_b + (s_e - s_b - 1) / 2; nth_element(s_b, s_m, s_e, - compose2_2(less< FT >(), op.delta(), op.delta())); + compose(less< FT >(), op.delta(), op.delta())); // step 2 (as above) Point q_t_m = q_t_afap; @@ -1199,14 +1180,14 @@ rectangular_3_center_2_type2( // partition the range [s_b+1, e) into ranges // [s_b+1, b1), [b1, b2), [b2, b3) and [b3, e) // R G cap q_t G cap q_r none - binder1st< greater_equal< FT > > - le_delta_sb = bind1st(greater_equal< FT >(), op.delta()(*s_b)); - b2 = partition(s_b + 1, e, compose1_1(le_delta_sb, - bind1st(op.distance(), q_t))); - b1 = partition(s_b + 1, b2, compose1_1(le_delta_sb, - bind1st(op.distance(), q_r))); + typename Bind< greater_equal< FT >, FT, 1 >::Type + le_delta_sb = bind_1(greater_equal< FT >(), op.delta()(*s_b)); + b2 = partition(s_b + 1, e, compose(le_delta_sb, + bind_1(op.distance(), q_t))); + b1 = partition(s_b + 1, b2, compose(le_delta_sb, + bind_1(op.distance(), q_r))); b3 = partition(b2, e, - compose1_1(le_delta_sb, bind1st(op.distance(), q_r))); + compose(le_delta_sb, bind_1(op.distance(), q_r))); if (b3 != e || !Q_t_empty && op.compute_x_distance(q_t, Q_t) > op.delta()(*s_b) || @@ -1236,7 +1217,7 @@ rectangular_3_center_2_type2( std::vector< Point > tmppts(f, l); RandomAccessIterator ii = partition(tmppts.begin(), tmppts.end(), - compose1_1(le_delta_sb, op.delta())); + compose(le_delta_sb, op.delta())); IP tmppos = min_max_element(ii, tmppts.end(), op.compare_x(), op.compare_y()); ) @@ -1279,9 +1260,9 @@ rectangular_3_center_2_type2( // we have to take the next smaller radius RandomAccessIterator next = max_element_if(s, s_b, - compose2_2(less< FT >(), op.delta(), op.delta()), - compose1_1(bind1st(not_equal_to< FT >(), - op.delta()(*s_b)), + compose(less< FT >(), op.delta(), op.delta()), + compose(bind_1(not_equal_to< FT >(), + op.delta()(*s_b)), op.delta())); rho_max = op.delta()(*s_b); q_t_at_rho_max = q_t, q_r_at_rho_max = q_r; @@ -1292,14 +1273,14 @@ rectangular_3_center_2_type2( q_r = op.place_y_square(q_r_afap, r, op.delta()(*next)); // again check for covering - binder1st< greater_equal< FT > > - le_delta_next = bind1st(greater_equal< FT >(), op.delta()(*next)); + typename Bind< greater_equal< FT >, FT, 1 >::Type + le_delta_next = bind_1(greater_equal< FT >(), op.delta()(*next)); b2 = partition(s_b, e, - compose1_1(le_delta_next, bind1st(op.distance(), q_t))); + compose(le_delta_next, bind_1(op.distance(), q_t))); b1 = partition(s_b, b2, - compose1_1(le_delta_next, bind1st(op.distance(), q_r))); + compose(le_delta_next, bind_1(op.distance(), q_r))); b3 = partition(b2, e, - compose1_1(le_delta_next, bind1st(op.distance(), q_r))); + compose(le_delta_next, bind_1(op.distance(), q_r))); if (b3 != e || !Q_t_empty && op.compute_x_distance(q_t, Q_t) > op.delta()(*next) || @@ -1351,7 +1332,7 @@ rectangular_3_center_2_type2( Point q_t_afap = op.place_x_square(Q_t_empty, Q_t, r); Point q_r_afap = op.place_y_square(Q_r_empty, Q_r, r); if (s != e) { - sort(s, e, compose2_2(less< FT >(), op.delta(), op.delta())); + sort(s, e, compose(less< FT >(), op.delta(), op.delta())); rho_max = op.delta()(*--t); } else rho_max = rho_min; @@ -1394,32 +1375,34 @@ rectangular_3_center_2_type2( q_r = op.place_y_square(q_r_afap, r, try_rho); // check for covering - binder1st< less< FT > > - greater_rho_max(bind1st(less< FT >(), try_rho)); + typename Bind< less< FT >, FT, 1 >::Type + greater_rho_max(bind_1(less< FT >(), try_rho)); if (!Q_t_empty && op.compute_x_distance(q_t, Q_t) > try_rho || !Q_r_empty && op.compute_y_distance(q_r, Q_r) > try_rho || - e != find_if(t + 1, - e, - compose2_1(logical_and< bool >(), - compose1_1(greater_rho_max, - bind1st(op.distance(), q_t)), - compose1_1(greater_rho_max, - bind1st(op.distance(), q_r))))) { - rho_min = try_rho; - q_t_q_r_cover_at_rho_min = 0; - if (!Q_t_empty) - q_t_q_r_cover_at_rho_min = - max(q_t_q_r_cover_at_rho_min, - op.compute_x_distance(q_t, Q_t)); - if (!Q_r_empty) - q_t_q_r_cover_at_rho_min = - max(q_t_q_r_cover_at_rho_min, - op.compute_y_distance(q_r, Q_r)); - q_t_at_rho_min = q_t, q_r_at_rho_min = q_r; - s_at_rho_min = t + 1, e_at_rho_min = e; - break; - } - rho_max = try_rho; + e != find_if( + t + 1, + e, + compose_shared(logical_and< bool >(), + compose(greater_rho_max, + bind_1(op.distance(), q_t)), + compose(greater_rho_max, + bind_1(op.distance(), q_r))))) + { + rho_min = try_rho; + q_t_q_r_cover_at_rho_min = 0; + if (!Q_t_empty) + q_t_q_r_cover_at_rho_min = + max(q_t_q_r_cover_at_rho_min, + op.compute_x_distance(q_t, Q_t)); + if (!Q_r_empty) + q_t_q_r_cover_at_rho_min = + max(q_t_q_r_cover_at_rho_min, + op.compute_y_distance(q_r, Q_r)); + q_t_at_rho_min = q_t, q_r_at_rho_min = q_r; + s_at_rho_min = t + 1, e_at_rho_min = e; + break; + } + rho_max = try_rho; } // for (;;) } // if (!radius_is_known) @@ -1439,18 +1422,17 @@ rectangular_3_center_2_type2( CGAL_optimisation_assertion(rho_min <= rho_max); CGAL_optimisation_assertion(rho_min >= 0); FT rad2 = q_t_q_r_cover_at_rho_min; - typedef binder1st< Distance > Dist_bind; + typedef typename Bind< Distance, Point, 1 >::Type Dist_bind; if (s_at_rho_min != e_at_rho_min) { - Binary_compose_1< Min< FT >, Dist_bind, Dist_bind > - mydist(compose2_1(Min< FT >(), - bind1st(op.distance(), q_t_at_rho_min), - bind1st(op.distance(), q_r_at_rho_min))); + typename Compose_shared< Min< FT >, Dist_bind, Dist_bind >::Type + mydist(compose_shared(Min< FT >(), + bind_1(op.distance(), q_t_at_rho_min), + bind_1(op.distance(), q_r_at_rho_min))); rad2 = max( rad2, - mydist(*max_element(s_at_rho_min, - e_at_rho_min, - compose2_2(less< FT >(), mydist, mydist)))); + mydist(*max_element(s_at_rho_min, e_at_rho_min, + compose(less< FT >(), mydist, mydist)))); } CGAL_optimisation_assertion(rad2 == 0 || rad2 > rho_min); diff --git a/Packages/Matrix_search/include/CGAL/rectangular_3_center_2_msvc.h b/Packages/Matrix_search/include/CGAL/rectangular_3_center_2_msvc.h index 9a7c8a8dec3..c1de680193a 100644 --- a/Packages/Matrix_search/include/CGAL/rectangular_3_center_2_msvc.h +++ b/Packages/Matrix_search/include/CGAL/rectangular_3_center_2_msvc.h @@ -36,14 +36,14 @@ struct Rectangular_3_center_2_type2_operations0 { typedef typename R::Infinity_distance_2 Infinity_distance_2; typedef typename R::Less_x_2 Less_x_2; typedef typename R::Less_y_2 Less_y_2; - typedef typename R::Greater_x_2 Greater_x_2; - typedef typename R::Greater_y_2 Greater_y_2; - typedef typename R::Construct_min_point_2 Construct_min_point_2; - typedef typename R::Construct_max_point_2 Construct_max_point_2; - typedef typename R::Construct_corner_2 Construct_corner_2; + typedef typename Swap< Less_x_2 >::Type Greater_x_2; + typedef typename Swap< Less_y_2 >::Type Greater_y_2; + typedef Min< Point_2, Less_x_2 > Min_x_2; + typedef Max< Point_2, Less_x_2 > Max_x_2; + typedef Min< Point_2, Less_y_2 > Min_y_2; + typedef Max< Point_2, Less_y_2 > Max_y_2; + typedef typename R::Construct_vertex_2 Construct_vertex_2; typedef typename R::Construct_iso_rectangle_2 Construct_iso_rectangle_2; - typedef typename R::Construct_projection_onto_horizontal_implicit_line_2 - Construct_projection_onto_horizontal_implicit_line_2; typedef typename R::Construct_point_2_above_right_implicit_point_2 Construct_point_2_above_right_implicit_point_2; typedef typename R::Construct_point_2_above_left_implicit_point_2 @@ -52,21 +52,19 @@ struct Rectangular_3_center_2_type2_operations0 { Construct_point_2_below_right_implicit_point_2; typedef typename R::Construct_point_2_below_left_implicit_point_2 Construct_point_2_below_left_implicit_point_2; - typedef std::binder1st< Infinity_distance_2 > Delta; + typedef typename Bind< Infinity_distance_2, Point_2, 1 >::Type Delta; Delta delta() const { return delta_; } Less_x_2 less_x_2_object() const { return r_.less_x_2_object(); } Less_y_2 less_y_2_object() const { return r_.less_y_2_object(); } - Greater_x_2 greater_x_2_object() const { return r_.greater_x_2_object(); } - Greater_y_2 greater_y_2_object() const { return r_.greater_y_2_object(); } + Greater_x_2 greater_x_2_object() const + { return swap_1(less_x_2_object()); } + Greater_y_2 greater_y_2_object() const + { return swap_1(less_y_2_object()); } Infinity_distance_2 distance() const { return r_.infinity_distance_2_object(); } - Construct_min_point_2 construct_min_point_2_object() const - { return r_.construct_min_point_2_object(); } - Construct_max_point_2 construct_max_point_2_object() const - { return r_.construct_max_point_2_object(); } - Construct_corner_2 corner() const - { return r_.construct_corner_2_object(); } + Construct_vertex_2 construct_vertex_2_object() const + { return r_.construct_vertex_2_object(); } Construct_iso_rectangle_2 construct_iso_rectangle_2_object() const { return r_.construct_iso_rectangle_2_object(); } @@ -83,18 +81,10 @@ struct Rectangular_3_center_2_type2_operations0 { pt_a_r() const { return r_.construct_point_2_above_right_implicit_point_2_object(); } - typedef typename R::Min_x_2 Min_x_2; - Min_x_2 minx() const { return r_.min_x_2_object(); } - typedef typename R::Min_y_2 Min_y_2; - Min_y_2 miny() const { return r_.min_y_2_object(); } - typedef typename R::Max_x_2 Max_x_2; - Max_x_2 maxx() const { return r_.max_x_2_object(); } - typedef typename R::Max_y_2 Max_y_2; - Max_y_2 maxy() const { return r_.max_y_2_object(); } - - Construct_projection_onto_horizontal_implicit_line_2 - construct_projection_onto_horizontal_implicit_line_2_object() const - { return r_.construct_projection_onto_horizontal_implicit_line_2_object(); } + Min_x_2 minx() const { return Min_x_2(less_x_2_object()); } + Min_y_2 miny() const { return Min_y_2(less_y_2_object()); } + Max_x_2 maxx() const { return Max_x_2(less_x_2_object()); } + Max_y_2 maxy() const { return Max_y_2(less_y_2_object()); } private: R& r_; @@ -107,7 +97,7 @@ public: typedef Infinity_distance_2 Distance; Rectangular_3_center_2_type2_operations0(R& r, const Point& p) - : r_(r), delta_(std::bind1st(r.infinity_distance_2_object(), p)) + : r_(r), delta_(bind_1(r.infinity_distance_2_object(), p)) {} X_compare compare_x() const { return less_x_2_object(); } @@ -118,16 +108,17 @@ public: const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - minx()(first_uncovered, construct_min_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_max_point_2_object()(bbox)); + minx()(first_uncovered, v(constraint, 0)); + return v(rect(bpt, v(bbox, 2)), 3); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? first_uncovered : - minx()(first_uncovered, construct_min_point_2_object()(constraint)), - construct_max_point_2_object()(bbox)); + return v(rect(constraint_empty ? first_uncovered : + minx()(first_uncovered, v(constraint, 0)), + v(bbox, 2)), + 3); #endif } @@ -135,17 +126,15 @@ public: const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_max_point_2_object()(bbox)); + Point bpt = constraint_empty ? v(bbox, 2) : v(constraint, 0); + return v(rect(bpt, v(bbox, 2)), 3); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? - construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint), - construct_max_point_2_object()(bbox)); + return v(rect(constraint_empty ? v(bbox, 2) : v(constraint, 0), + v(bbox, 2)), + 3); #endif } @@ -153,11 +142,11 @@ public: const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - minx()( - pt_b_l()(construct_max_point_2_object()(bbox), - construct_max_point_2_object()(bbox), radius), so_far), - so_far); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(minx()(pt_b_l()(v(bbox, 2), v(bbox, 2), radius), so_far), + so_far), + 3); } Point place_y_square(bool constraint_empty, @@ -165,16 +154,17 @@ public: const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - miny()(first_uncovered, construct_min_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), bpt); + miny()(first_uncovered, v(constraint, 0)); + return v(rect(v(bbox, 2), bpt), 1); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), - constraint_empty ? first_uncovered : - miny()(first_uncovered, construct_min_point_2_object()(constraint))); + return v(rect(v(bbox, 2), + constraint_empty ? first_uncovered : + miny()(first_uncovered, v(constraint, 0))), + 1); #endif } @@ -182,17 +172,15 @@ public: const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), bpt); + Point bpt = constraint_empty ? v(bbox, 2) : v(constraint, 0); + return v(rect(v(bbox, 2), bpt), 1); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), - constraint_empty ? - construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint)); + return v(rect(v(bbox, 2), + constraint_empty ? v(bbox, 2) : v(constraint, 0)), + 1); #endif } @@ -200,32 +188,40 @@ public: const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - so_far, - miny()(pt_b_l()(construct_max_point_2_object()(bbox), - construct_max_point_2_object()(bbox), radius), - so_far)); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(so_far, + miny()(pt_b_l()(v(bbox, 2), v(bbox, 2), radius), + so_far)), + 1); } Point update_x_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - minx()(s, newp), s); } + { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); - Point update_y_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - s, miny()(s, newp)); } + return v(rect(minx()(s, newp), s), 3); + } + + Point update_y_square(const Point& s, const Point& newp) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + + return v(rect(s, miny()(s, newp)), 1); + } FT compute_x_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 1)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 1)); } FT compute_y_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 3)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 3)); } Point construct_corner_square(const Rectangle& bbox, FT r) const - { return pt_a_r()(construct_min_point_2_object()(bbox), - construct_min_point_2_object()(bbox), r); } + { return pt_a_r()(construct_vertex_2_object()(bbox, 0), + construct_vertex_2_object()(bbox, 0), r); } Point construct_x_square(const Point& p, FT r) const { return pt_b_r()(p, p, r); } @@ -241,14 +237,14 @@ struct Rectangular_3_center_2_type2_operations1 { typedef typename R::Infinity_distance_2 Infinity_distance_2; typedef typename R::Less_x_2 Less_x_2; typedef typename R::Less_y_2 Less_y_2; - typedef typename R::Greater_x_2 Greater_x_2; - typedef typename R::Greater_y_2 Greater_y_2; - typedef typename R::Construct_min_point_2 Construct_min_point_2; - typedef typename R::Construct_max_point_2 Construct_max_point_2; - typedef typename R::Construct_corner_2 Construct_corner_2; + typedef typename Swap< Less_x_2 >::Type Greater_x_2; + typedef typename Swap< Less_y_2 >::Type Greater_y_2; + typedef Min< Point_2, Less_x_2 > Min_x_2; + typedef Max< Point_2, Less_x_2 > Max_x_2; + typedef Min< Point_2, Less_y_2 > Min_y_2; + typedef Max< Point_2, Less_y_2 > Max_y_2; + typedef typename R::Construct_vertex_2 Construct_vertex_2; typedef typename R::Construct_iso_rectangle_2 Construct_iso_rectangle_2; - typedef typename R::Construct_projection_onto_horizontal_implicit_line_2 - Construct_projection_onto_horizontal_implicit_line_2; typedef typename R::Construct_point_2_above_right_implicit_point_2 Construct_point_2_above_right_implicit_point_2; typedef typename R::Construct_point_2_above_left_implicit_point_2 @@ -257,21 +253,19 @@ struct Rectangular_3_center_2_type2_operations1 { Construct_point_2_below_right_implicit_point_2; typedef typename R::Construct_point_2_below_left_implicit_point_2 Construct_point_2_below_left_implicit_point_2; - typedef std::binder1st< Infinity_distance_2 > Delta; + typedef typename Bind< Infinity_distance_2, Point_2, 1 >::Type Delta; Delta delta() const { return delta_; } Less_x_2 less_x_2_object() const { return r_.less_x_2_object(); } Less_y_2 less_y_2_object() const { return r_.less_y_2_object(); } - Greater_x_2 greater_x_2_object() const { return r_.greater_x_2_object(); } - Greater_y_2 greater_y_2_object() const { return r_.greater_y_2_object(); } + Greater_x_2 greater_x_2_object() const + { return swap_1(less_x_2_object()); } + Greater_y_2 greater_y_2_object() const + { return swap_1(less_y_2_object()); } Infinity_distance_2 distance() const { return r_.infinity_distance_2_object(); } - Construct_min_point_2 construct_min_point_2_object() const - { return r_.construct_min_point_2_object(); } - Construct_max_point_2 construct_max_point_2_object() const - { return r_.construct_max_point_2_object(); } - Construct_corner_2 corner() const - { return r_.construct_corner_2_object(); } + Construct_vertex_2 construct_vertex_2_object() const + { return r_.construct_vertex_2_object(); } Construct_iso_rectangle_2 construct_iso_rectangle_2_object() const { return r_.construct_iso_rectangle_2_object(); } @@ -288,18 +282,10 @@ struct Rectangular_3_center_2_type2_operations1 { pt_a_r() const { return r_.construct_point_2_above_right_implicit_point_2_object(); } - typedef typename R::Min_x_2 Min_x_2; - Min_x_2 minx() const { return r_.min_x_2_object(); } - typedef typename R::Min_y_2 Min_y_2; - Min_y_2 miny() const { return r_.min_y_2_object(); } - typedef typename R::Max_x_2 Max_x_2; - Max_x_2 maxx() const { return r_.max_x_2_object(); } - typedef typename R::Max_y_2 Max_y_2; - Max_y_2 maxy() const { return r_.max_y_2_object(); } - - Construct_projection_onto_horizontal_implicit_line_2 - construct_projection_onto_horizontal_implicit_line_2_object() const - { return r_.construct_projection_onto_horizontal_implicit_line_2_object(); } + Min_x_2 minx() const { return Min_x_2(less_x_2_object()); } + Min_y_2 miny() const { return Min_y_2(less_y_2_object()); } + Max_x_2 maxx() const { return Max_x_2(less_x_2_object()); } + Max_y_2 maxy() const { return Max_y_2(less_y_2_object()); } private: R& r_; @@ -312,7 +298,7 @@ public: typedef Infinity_distance_2 Distance; Rectangular_3_center_2_type2_operations1(R& r, const Point& p) - : r_(r), delta_(std::bind1st(r.infinity_distance_2_object(), p)) + : r_(r), delta_(bind_1(r.infinity_distance_2_object(), p)) {} X_compare compare_x() const { return greater_x_2_object(); } @@ -323,16 +309,17 @@ public: const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - maxx()(first_uncovered, construct_max_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_max_point_2_object()(bbox)); + maxx()(first_uncovered, v(constraint, 2)); + return v(rect(bpt, v(bbox, 3)), 2); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? first_uncovered : - maxx()(first_uncovered, construct_max_point_2_object()(constraint)), - construct_max_point_2_object()(bbox)); + return v(rect(constraint_empty ? first_uncovered : + maxx()(first_uncovered, v(constraint, 2)), + v(bbox, 3)), + 2); #endif } @@ -340,17 +327,15 @@ public: const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_max_point_2_object()(bbox)); + Point bpt = constraint_empty ? v(bbox, 0) : v(constraint, 2); + return v(rect(bpt, v(bbox, 3)), 2); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? - construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint), - construct_max_point_2_object()(bbox)); + return v(rect(constraint_empty ? v(bbox, 0) : v(constraint, 2), + v(bbox, 3)), + 2); #endif } @@ -358,10 +343,12 @@ public: const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - maxx()(so_far, pt_a_r()(construct_min_point_2_object()(bbox), - construct_min_point_2_object()(bbox), radius)), - so_far); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(maxx()(so_far, pt_a_r()(v(bbox, 0), + v(bbox, 0), radius)), + so_far), + 2); } Point place_y_square(bool constraint_empty, @@ -369,16 +356,17 @@ public: const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - miny()(first_uncovered, construct_min_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), bpt); + miny()(first_uncovered, v(constraint, 0)); + return v(rect(v(bbox, 3), bpt), 0); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), - constraint_empty ? first_uncovered : - miny()(first_uncovered, construct_min_point_2_object()(constraint))); + return v(rect(v(bbox, 3), + constraint_empty ? first_uncovered : + miny()(first_uncovered, v(constraint, 0))), + 0); #endif } @@ -386,17 +374,15 @@ public: const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), bpt); + Point bpt = constraint_empty ? v(bbox, 2) : v(constraint, 0); + return v(rect(v(bbox, 3), bpt), 0); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), - constraint_empty ? - construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint)); + return v(rect(v(bbox, 3), + constraint_empty ? v(bbox, 2) : v(constraint, 0)), + 0); #endif } @@ -404,31 +390,37 @@ public: const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - so_far, - miny()(so_far, pt_b_l()(construct_max_point_2_object()(bbox), - construct_max_point_2_object()(bbox), radius))); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(so_far, + miny()(so_far, pt_b_l()(v(bbox, 2), + v(bbox, 2), radius))), + 0); } - Point update_x_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - maxx()(s, newp), s); } + Point update_x_square(const Point& s, const Point& newp) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(maxx()(s, newp), s), 2); + } - Point update_y_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - s, miny()(s, newp)); } + Point update_y_square(const Point& s, const Point& newp) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(s, miny()(s, newp)), 0); + } FT compute_x_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 0)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 0)); } FT compute_y_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 2)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 2)); } Point construct_corner_square(const Rectangle& bbox, FT r) const - { return pt_a_l()(construct_max_point_2_object()(bbox), - construct_min_point_2_object()(bbox), r); } + { return pt_a_l()(construct_vertex_2_object()(bbox, 2), + construct_vertex_2_object()(bbox, 0), r); } Point construct_x_square(const Point& p, FT r) const { return pt_b_l()(p, p, r); } @@ -444,14 +436,14 @@ struct Rectangular_3_center_2_type2_operations2 { typedef typename R::Infinity_distance_2 Infinity_distance_2; typedef typename R::Less_x_2 Less_x_2; typedef typename R::Less_y_2 Less_y_2; - typedef typename R::Greater_x_2 Greater_x_2; - typedef typename R::Greater_y_2 Greater_y_2; - typedef typename R::Construct_min_point_2 Construct_min_point_2; - typedef typename R::Construct_max_point_2 Construct_max_point_2; - typedef typename R::Construct_corner_2 Construct_corner_2; + typedef typename Swap< Less_x_2 >::Type Greater_x_2; + typedef typename Swap< Less_y_2 >::Type Greater_y_2; + typedef Min< Point_2, Less_x_2 > Min_x_2; + typedef Max< Point_2, Less_x_2 > Max_x_2; + typedef Min< Point_2, Less_y_2 > Min_y_2; + typedef Max< Point_2, Less_y_2 > Max_y_2; + typedef typename R::Construct_vertex_2 Construct_vertex_2; typedef typename R::Construct_iso_rectangle_2 Construct_iso_rectangle_2; - typedef typename R::Construct_projection_onto_horizontal_implicit_line_2 - Construct_projection_onto_horizontal_implicit_line_2; typedef typename R::Construct_point_2_above_right_implicit_point_2 Construct_point_2_above_right_implicit_point_2; typedef typename R::Construct_point_2_above_left_implicit_point_2 @@ -460,21 +452,19 @@ struct Rectangular_3_center_2_type2_operations2 { Construct_point_2_below_right_implicit_point_2; typedef typename R::Construct_point_2_below_left_implicit_point_2 Construct_point_2_below_left_implicit_point_2; - typedef std::binder1st< Infinity_distance_2 > Delta; + typedef typename Bind< Infinity_distance_2, Point_2, 1 >::Type Delta; Delta delta() const { return delta_; } Less_x_2 less_x_2_object() const { return r_.less_x_2_object(); } Less_y_2 less_y_2_object() const { return r_.less_y_2_object(); } - Greater_x_2 greater_x_2_object() const { return r_.greater_x_2_object(); } - Greater_y_2 greater_y_2_object() const { return r_.greater_y_2_object(); } + Greater_x_2 greater_x_2_object() const + { return swap_1(less_x_2_object()); } + Greater_y_2 greater_y_2_object() const + { return swap_1(less_y_2_object()); } Infinity_distance_2 distance() const { return r_.infinity_distance_2_object(); } - Construct_min_point_2 construct_min_point_2_object() const - { return r_.construct_min_point_2_object(); } - Construct_max_point_2 construct_max_point_2_object() const - { return r_.construct_max_point_2_object(); } - Construct_corner_2 corner() const - { return r_.construct_corner_2_object(); } + Construct_vertex_2 construct_vertex_2_object() const + { return r_.construct_vertex_2_object(); } Construct_iso_rectangle_2 construct_iso_rectangle_2_object() const { return r_.construct_iso_rectangle_2_object(); } @@ -491,18 +481,10 @@ struct Rectangular_3_center_2_type2_operations2 { pt_a_r() const { return r_.construct_point_2_above_right_implicit_point_2_object(); } - typedef typename R::Min_x_2 Min_x_2; - Min_x_2 minx() const { return r_.min_x_2_object(); } - typedef typename R::Min_y_2 Min_y_2; - Min_y_2 miny() const { return r_.min_y_2_object(); } - typedef typename R::Max_x_2 Max_x_2; - Max_x_2 maxx() const { return r_.max_x_2_object(); } - typedef typename R::Max_y_2 Max_y_2; - Max_y_2 maxy() const { return r_.max_y_2_object(); } - - Construct_projection_onto_horizontal_implicit_line_2 - construct_projection_onto_horizontal_implicit_line_2_object() const - { return r_.construct_projection_onto_horizontal_implicit_line_2_object(); } + Min_x_2 minx() const { return Min_x_2(less_x_2_object()); } + Min_y_2 miny() const { return Min_y_2(less_y_2_object()); } + Max_x_2 maxx() const { return Max_x_2(less_x_2_object()); } + Max_y_2 maxy() const { return Max_y_2(less_y_2_object()); } private: R& r_; @@ -515,7 +497,7 @@ public: typedef Infinity_distance_2 Distance; Rectangular_3_center_2_type2_operations2(R& r, const Point& p) - : r_(r), delta_(std::bind1st(r.infinity_distance_2_object(), p)) + : r_(r), delta_(bind_1(r.infinity_distance_2_object(), p)) {} X_compare compare_x() const { return greater_x_2_object(); } @@ -526,16 +508,17 @@ public: const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - maxx()(first_uncovered, construct_max_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_min_point_2_object()(bbox)); + maxx()(first_uncovered, v(constraint, 2)); + return v(rect(bpt, v(bbox, 0)), 1); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? first_uncovered : - maxx()(first_uncovered, construct_max_point_2_object()(constraint)), - construct_min_point_2_object()(bbox)); + return v(rect(constraint_empty ? first_uncovered : + maxx()(first_uncovered, v(constraint, 2)), + v(bbox, 0)), + 1); #endif } @@ -543,17 +526,15 @@ public: const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_min_point_2_object()(bbox)); + Point bpt = constraint_empty ? v(bbox, 0) : v(constraint, 2); + return v(rect(bpt, v(bbox, 0)), 1); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? - construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint), - construct_min_point_2_object()(bbox)); + return v(rect(constraint_empty ? v(bbox, 0) : v(constraint, 2), + v(bbox, 0)), + 1); #endif } @@ -561,10 +542,12 @@ public: const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - maxx()(so_far, pt_a_r()(construct_min_point_2_object()(bbox), - construct_min_point_2_object()(bbox), radius)), - so_far); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(maxx()(so_far, pt_a_r()(v(bbox, 0), + v(bbox, 0), radius)), + so_far), + 1); } Point place_y_square(bool constraint_empty, @@ -572,16 +555,17 @@ public: const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - maxy()(first_uncovered, construct_max_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), bpt); + maxy()(first_uncovered, v(constraint, 2)); + return v(rect(v(bbox, 0), bpt), 3); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), - constraint_empty ? first_uncovered : - maxy()(first_uncovered, construct_max_point_2_object()(constraint))); + return v(rect(v(bbox, 0), + constraint_empty ? first_uncovered : + maxy()(first_uncovered, v(constraint, 2))), + 3); #endif } @@ -589,17 +573,15 @@ public: const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), bpt); + Point bpt = constraint_empty ? v(bbox, 0) : v(constraint, 2); + return v(rect(v(bbox, 0), bpt), 3); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_min_point_2_object()(bbox), - constraint_empty ? - construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint)); + return v(rect(v(bbox, 0), + constraint_empty ? v(bbox, 0) : v(constraint, 2)), + 3); #endif } @@ -607,31 +589,37 @@ public: const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - so_far, - maxy()(pt_a_r()(construct_min_point_2_object()(bbox), - construct_min_point_2_object()(bbox), radius), so_far)); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(so_far, + maxy()(pt_a_r()(v(bbox, 0), + v(bbox, 0), radius), so_far)), + 3); } - Point update_x_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - maxx()(s, newp), s); } + Point update_x_square(const Point& s, const Point& newp) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(maxx()(s, newp), s), 1); + } - Point update_y_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - s, maxy()(s, newp)); } + Point update_y_square(const Point& s, const Point& newp) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(s, maxy()(s, newp)), 3); + } FT compute_x_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 3)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 3)); } FT compute_y_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 1)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 1)); } Point construct_corner_square(const Rectangle& bbox, FT r) const - { return pt_b_l()(construct_max_point_2_object()(bbox), - construct_max_point_2_object()(bbox), r); } + { return pt_b_l()(construct_vertex_2_object()(bbox, 2), + construct_vertex_2_object()(bbox, 2), r); } Point construct_x_square(const Point& p, FT r) const { return pt_a_l()(p, p, r); } @@ -647,14 +635,14 @@ struct Rectangular_3_center_2_type2_operations3 { typedef typename R::Infinity_distance_2 Infinity_distance_2; typedef typename R::Less_x_2 Less_x_2; typedef typename R::Less_y_2 Less_y_2; - typedef typename R::Greater_x_2 Greater_x_2; - typedef typename R::Greater_y_2 Greater_y_2; - typedef typename R::Construct_min_point_2 Construct_min_point_2; - typedef typename R::Construct_max_point_2 Construct_max_point_2; - typedef typename R::Construct_corner_2 Construct_corner_2; + typedef typename Swap< Less_x_2 >::Type Greater_x_2; + typedef typename Swap< Less_y_2 >::Type Greater_y_2; + typedef Min< Point_2, Less_x_2 > Min_x_2; + typedef Max< Point_2, Less_x_2 > Max_x_2; + typedef Min< Point_2, Less_y_2 > Min_y_2; + typedef Max< Point_2, Less_y_2 > Max_y_2; + typedef typename R::Construct_vertex_2 Construct_vertex_2; typedef typename R::Construct_iso_rectangle_2 Construct_iso_rectangle_2; - typedef typename R::Construct_projection_onto_horizontal_implicit_line_2 - Construct_projection_onto_horizontal_implicit_line_2; typedef typename R::Construct_point_2_above_right_implicit_point_2 Construct_point_2_above_right_implicit_point_2; typedef typename R::Construct_point_2_above_left_implicit_point_2 @@ -663,21 +651,19 @@ struct Rectangular_3_center_2_type2_operations3 { Construct_point_2_below_right_implicit_point_2; typedef typename R::Construct_point_2_below_left_implicit_point_2 Construct_point_2_below_left_implicit_point_2; - typedef std::binder1st< Infinity_distance_2 > Delta; + typedef typename Bind< Infinity_distance_2, Point_2, 1 >::Type Delta; Delta delta() const { return delta_; } Less_x_2 less_x_2_object() const { return r_.less_x_2_object(); } Less_y_2 less_y_2_object() const { return r_.less_y_2_object(); } - Greater_x_2 greater_x_2_object() const { return r_.greater_x_2_object(); } - Greater_y_2 greater_y_2_object() const { return r_.greater_y_2_object(); } + Greater_x_2 greater_x_2_object() const + { return swap_1(less_x_2_object()); } + Greater_y_2 greater_y_2_object() const + { return swap_1(less_y_2_object()); } Infinity_distance_2 distance() const { return r_.infinity_distance_2_object(); } - Construct_min_point_2 construct_min_point_2_object() const - { return r_.construct_min_point_2_object(); } - Construct_max_point_2 construct_max_point_2_object() const - { return r_.construct_max_point_2_object(); } - Construct_corner_2 corner() const - { return r_.construct_corner_2_object(); } + Construct_vertex_2 construct_vertex_2_object() const + { return r_.construct_vertex_2_object(); } Construct_iso_rectangle_2 construct_iso_rectangle_2_object() const { return r_.construct_iso_rectangle_2_object(); } @@ -694,18 +680,10 @@ struct Rectangular_3_center_2_type2_operations3 { pt_a_r() const { return r_.construct_point_2_above_right_implicit_point_2_object(); } - typedef typename R::Min_x_2 Min_x_2; - Min_x_2 minx() const { return r_.min_x_2_object(); } - typedef typename R::Min_y_2 Min_y_2; - Min_y_2 miny() const { return r_.min_y_2_object(); } - typedef typename R::Max_x_2 Max_x_2; - Max_x_2 maxx() const { return r_.max_x_2_object(); } - typedef typename R::Max_y_2 Max_y_2; - Max_y_2 maxy() const { return r_.max_y_2_object(); } - - Construct_projection_onto_horizontal_implicit_line_2 - construct_projection_onto_horizontal_implicit_line_2_object() const - { return r_.construct_projection_onto_horizontal_implicit_line_2_object(); } + Min_x_2 minx() const { return Min_x_2(less_x_2_object()); } + Min_y_2 miny() const { return Min_y_2(less_y_2_object()); } + Max_x_2 maxx() const { return Max_x_2(less_x_2_object()); } + Max_y_2 maxy() const { return Max_y_2(less_y_2_object()); } private: R& r_; @@ -718,7 +696,7 @@ public: typedef Infinity_distance_2 Distance; Rectangular_3_center_2_type2_operations3(R& r, const Point& p) - : r_(r), delta_(std::bind1st(r.infinity_distance_2_object(), p)) + : r_(r), delta_(bind_1(r.infinity_distance_2_object(), p)) {} X_compare compare_x() const { return less_x_2_object(); } @@ -729,16 +707,17 @@ public: const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - minx()(first_uncovered, construct_min_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_min_point_2_object()(bbox)); + minx()(first_uncovered, v(constraint, 0)); + return v(rect(bpt, v(bbox, 1)), 0); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? first_uncovered : - minx()(first_uncovered, construct_min_point_2_object()(constraint)), - construct_min_point_2_object()(bbox)); + return v(rect(constraint_empty ? first_uncovered : + minx()(first_uncovered, v(constraint, 0)), + v(bbox, 1)), + 0); #endif } @@ -746,17 +725,15 @@ public: const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - bpt, construct_min_point_2_object()(bbox)); + Point bpt = constraint_empty ? v(bbox, 2) : v(constraint, 0); + return v(rect(bpt, v(bbox, 1)), 0); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - constraint_empty ? - construct_max_point_2_object()(bbox) : - construct_min_point_2_object()(constraint), - construct_min_point_2_object()(bbox)); + return v(rect(constraint_empty ? v(bbox, 2) : v(constraint, 0), + v(bbox, 1)), + 0); #endif } @@ -764,10 +741,12 @@ public: const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - minx()(pt_b_l()(construct_max_point_2_object()(bbox), - construct_max_point_2_object()(bbox), radius), so_far), - so_far); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(minx()(pt_b_l()(v(bbox, 2), + v(bbox, 2), radius), so_far), + so_far), + 0); } Point place_y_square(bool constraint_empty, @@ -775,16 +754,17 @@ public: const Point& first_uncovered, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ Point bpt = constraint_empty ? first_uncovered : - maxy()(first_uncovered, construct_max_point_2_object()(constraint)); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), bpt); + maxy()(first_uncovered, v(constraint, 2)); + return v(rect(v(bbox, 1), bpt), 2); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), - constraint_empty ? first_uncovered : - maxy()(first_uncovered, construct_max_point_2_object()(constraint))); + return v(rect(v(bbox, 1), + constraint_empty ? first_uncovered : + maxy()(first_uncovered, v(constraint, 2))), + 2); #endif } @@ -792,17 +772,15 @@ public: const Rectangle& constraint, const Rectangle& bbox) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); #ifdef __BORLANDC__ - Point bpt = constraint_empty ? construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint); - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), bpt); + Point bpt = constraint_empty ? v(bbox, 0) : v(constraint, 2); + return v(rect(v(bbox, 1), bpt), 2); #else - return construct_projection_onto_horizontal_implicit_line_2_object()( - construct_max_point_2_object()(bbox), - constraint_empty ? - construct_min_point_2_object()(bbox) : - construct_max_point_2_object()(constraint)); + return v(rect(v(bbox, 1), + constraint_empty ? v(bbox, 0) : v(constraint, 2)), + 2); #endif } @@ -810,31 +788,37 @@ public: const Rectangle& bbox, FT radius) const { - return construct_projection_onto_horizontal_implicit_line_2_object()( - so_far, - maxy()(pt_a_r()(construct_min_point_2_object()(bbox), - construct_min_point_2_object()(bbox), radius), so_far)); + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(so_far, + maxy()(pt_a_r()(v(bbox, 0), + v(bbox, 0), radius), so_far)), + 2); } - Point update_x_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - minx()(s, newp), s); } + Point update_x_square(const Point& s, const Point& newp) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(minx()(s, newp), s), 0); + } - Point update_y_square(const Point& s, const Point& newp) const - { return construct_projection_onto_horizontal_implicit_line_2_object()( - s, maxy()(s, newp)); } + Point update_y_square(const Point& s, const Point& newp) const { + Construct_iso_rectangle_2 rect = construct_iso_rectangle_2_object(); + Construct_vertex_2 v = construct_vertex_2_object(); + return v(rect(s, maxy()(s, newp)), 2); + } FT compute_x_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 2)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 2)); } FT compute_y_distance(const Point& extreme, const Rectangle& constraint) const - { return distance()(extreme, corner()(constraint, 0)); } + { return distance()(extreme, construct_vertex_2_object()(constraint, 0)); } Point construct_corner_square(const Rectangle& bbox, FT r) const - { return pt_b_r()(construct_min_point_2_object()(bbox), - construct_max_point_2_object()(bbox), r); } + { return pt_b_r()(construct_vertex_2_object()(bbox, 0), + construct_vertex_2_object()(bbox, 2), r); } Point construct_x_square(const Point& p, FT r) const { return pt_a_r()(p, p, r); } diff --git a/Packages/Matrix_search/include/CGAL/rectangular_p_center_2.h b/Packages/Matrix_search/include/CGAL/rectangular_p_center_2.h index 93b2ed215c1..f0df0ba3b21 100644 --- a/Packages/Matrix_search/include/CGAL/rectangular_p_center_2.h +++ b/Packages/Matrix_search/include/CGAL/rectangular_p_center_2.h @@ -29,7 +29,7 @@ #define CGAL_RECTANGULAR_P_CENTER_2_H 1 #include -#include +#include #include #include #include @@ -127,17 +127,6 @@ cartesian_matrix_horizontally_flipped( RandomAccessIC_column > ( r_f, r_l, c_f, c_l, o); } -#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 91) -// gcc-2.91 gives funny ices when I try to do this with -// bind/compose adaptors -template < class NT > -struct Pcenter_gcc291_operation -: public CGAL_STD::binary_function< NT, NT, NT > -{ - NT operator()(const NT& n1, const NT& n2) const - { return max(NT(0), n1 - n2); } -}; -#endif // defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 91) /* template < class ForwardIterator, class OutputIterator, @@ -283,7 +272,6 @@ rectangular_p_center_2_matrix_search( #ifndef CGAL_CFG_NO_NAMESPACE using std::minus; - using std::bind1st; using std::sort; #endif @@ -390,7 +378,6 @@ rectangular_p_center_2_matrix_search( #endif #ifndef CGAL_CFG_NO_NAMESPACE using std::minus; - using std::bind1st; #endif return rectangular_p_center_2_matrix_search( @@ -400,14 +387,7 @@ rectangular_p_center_2_matrix_search( r, pf, t, -#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 91) - // gcc-2.91 gives funny ices when I try to do this with - // bind/compose adaptors - Pcenter_gcc291_operation< FT >() -#else - compose1_2(bind1st(Max< FT >(), 0), minus< FT >()) -#endif // defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ <= 91) - ); + compose(bind_1(Max< FT >(), 0), minus< FT >())); } // Pcenter_matrix_search( ... ) diff --git a/Packages/Matrix_search/include/CGAL/sorted_matrix_search.h b/Packages/Matrix_search/include/CGAL/sorted_matrix_search.h index b5c0274be53..7e9964269ce 100644 --- a/Packages/Matrix_search/include/CGAL/sorted_matrix_search.h +++ b/Packages/Matrix_search/include/CGAL/sorted_matrix_search.h @@ -30,9 +30,8 @@ #include #include -#include +#include #include -#include #include #include @@ -127,6 +126,7 @@ template < class Cell > struct Cell_min : public CGAL_STD::unary_function< Cell, typename Cell::Value > { + typedef Arity_tag< 1 > Arity; typename Cell::Value operator()( const Cell& c) const { return c.min(); } @@ -135,6 +135,7 @@ struct Cell_min template < class Cell > struct Cell_max : public CGAL_STD::unary_function< Cell, typename Cell::Value > { + typedef Arity_tag< 1 > Arity; Cell_max( int offset) : ofs( offset) {} @@ -159,10 +160,6 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t) using std::remove_if; using std::logical_or; using std::equal_to; - using CGAL::compose1_1; - using CGAL::compose2_1; - using std::bind1st; - using std::bind2nd; #endif typedef typename Traits::Matrix Matrix; @@ -264,7 +261,7 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t) nth_element(active_cells.begin(), active_cells.begin() + upper_median_rank, active_cells.end(), - compose2_2( + compose( t.compare_strictly(), Cell_min< Cell >(), Cell_min< Cell >())); @@ -277,7 +274,7 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t) nth_element(active_cells.begin(), active_cells.begin() + lower_median_rank, active_cells.end(), - compose2_2( + compose( t.compare_strictly(), Cell_max< Cell >(ccd), Cell_max< Cell >(ccd))); @@ -292,8 +289,8 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t) lower_median_cell = find_if(active_cells.begin(), active_cells.end(), - compose1_1( - bind1st(equal_to< Value >(), lower_median), + compose( + bind_1(equal_to< Value >(), lower_median), Cell_min< Cell >())); CGAL_optimisation_assertion(lower_median_cell != active_cells.end()); // ------------------------------------------------------ @@ -327,8 +324,8 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t) remove_if( active_cells.begin() + 1, active_cells.end(), - compose1_1( - bind1st( t.compare_non_strictly(), min_median), + compose( + bind_1( t.compare_non_strictly(), min_median), Cell_min< Cell >())); } // lower_median and upper_median are feasible @@ -345,15 +342,15 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t) remove_if( active_cells.begin() + 1, active_cells.end(), - compose2_1( + compose_shared( logical_or< bool >(), - compose1_1( - bind1st( + compose( + bind_1( t.compare_non_strictly(), lower_median), Cell_min< Cell >()), - compose1_1( - bind2nd( + compose( + bind_2( t.compare_non_strictly(), upper_median), Cell_max< Cell >( ccd)))); @@ -374,15 +371,15 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t) remove_if( active_cells.begin() + 1, active_cells.end(), - compose2_1( + compose_shared( logical_or< bool >(), - compose1_1( - bind1st( + compose( + bind_1( t.compare_non_strictly(), upper_median), Cell_min< Cell >()), - compose1_1( - bind2nd( + compose( + bind_2( t.compare_non_strictly(), lower_median), Cell_max< Cell >( ccd)))); @@ -397,8 +394,8 @@ sorted_matrix_search(InputIterator f, InputIterator l, Traits t) remove_if( active_cells.begin(), active_cells.end(), - compose1_1( - bind2nd( + compose( + bind_2( t.compare_non_strictly(), max( lower_median, upper_median)), Cell_max< Cell >( ccd))); diff --git a/Packages/Matrix_search/test/Matrix_search/all_furthest_neighbors_2_test.C b/Packages/Matrix_search/test/Matrix_search/all_furthest_neighbors_2_test.C index 1c33f9a1f93..0cb2743175b 100644 --- a/Packages/Matrix_search/test/Matrix_search/all_furthest_neighbors_2_test.C +++ b/Packages/Matrix_search/test/Matrix_search/all_furthest_neighbors_2_test.C @@ -26,7 +26,6 @@ // ============================================================================ #include -#include #include #include #include diff --git a/Packages/Matrix_search/test/Matrix_search/extremal_polygon_2_test.C b/Packages/Matrix_search/test/Matrix_search/extremal_polygon_2_test.C index 7ea68f3340e..5a54f98f3bc 100644 --- a/Packages/Matrix_search/test/Matrix_search/extremal_polygon_2_test.C +++ b/Packages/Matrix_search/test/Matrix_search/extremal_polygon_2_test.C @@ -26,7 +26,6 @@ // ============================================================================ #include -#include #include #include #include @@ -51,10 +50,10 @@ using CGAL::maximum_perimeter_inscribed_k_gon_2; // typedefs: typedef double FT; //typedef leda_real FT; -typedef Cartesian< FT > R; -typedef CGAL::Point_2< R > Point; -typedef Polygon_traits_2< R > P_traits; -typedef vector< Point > Cont; +typedef Cartesian< FT > K; +typedef K::Point_2 Point; +typedef Polygon_traits_2< K > P_traits; +typedef vector< Point > Cont; typedef CGAL::Polygon_2< P_traits, Cont > Polygon; // do random convex set generation always with double @@ -147,15 +146,6 @@ brute_force_area_4( RandomAccessIC b, } // brute_force_4( b, e, o) -/* -struct D2R : public unary_function< Point_double, Point > -{ - Point - operator()( const Point_double& p) - { return Point( p.x(), p.y()); } -}; -*/ - int main() { // set_pretty_mode( cout); diff --git a/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random1_test.C b/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random1_test.C index ef18ac6971d..6950e83e255 100644 --- a/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random1_test.C +++ b/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random1_test.C @@ -26,9 +26,6 @@ // ============================================================================ #include -#include -#include -#include #include #include #include @@ -70,10 +67,10 @@ typedef leda_real FT; typedef double FT; #endif // CGAL_USE_LEDA -typedef Cartesian< FT > R; -typedef CGAL::Point_2< R > Point; -typedef CGAL::Vector_2< R > Vector; -typedef CGAL::Iso_rectangle_2< R > Square_2; +typedef Cartesian< FT > K; +typedef K::Point_2 Point; +typedef K::Vector_2 Vector; +typedef K::Iso_rectangle_2 Square_2; typedef vector< Point > PCont; typedef PCont::iterator iterator; typedef Creator_uniform_2< FT, Point > Creator; @@ -220,7 +217,7 @@ main(int argc, char* argv[]) #ifdef CGAL_USE_LEDA // check that all points are covered - CGAL::Infinity_distance_2< R > dist; + CGAL::Infinity_distance_2< K > dist; #ifdef _MSC_VER { #endif @@ -245,8 +242,8 @@ main(int argc, char* argv[]) // check that there is at least one square with two points // on opposite sides - CGAL::Signed_x_distance_2< R > xdist; - CGAL::Signed_y_distance_2< R > ydist; + CGAL::Signed_x_distance_2< K > xdist; + CGAL::Signed_y_distance_2< K > ydist; bool boundary = false; #ifdef _MSC_VER { diff --git a/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random2_test.C b/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random2_test.C index ca805508423..9ebdbb63557 100644 --- a/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random2_test.C +++ b/Packages/Matrix_search/test/Matrix_search/rectangular_p_center_2_random2_test.C @@ -26,9 +26,6 @@ // ============================================================================ #include -#include -#include -#include #include #include #include @@ -70,10 +67,10 @@ typedef leda_real FT; typedef double FT; #endif // CGAL_USE_LEDA -typedef Cartesian< FT > R; -typedef CGAL::Point_2< R > Point; -typedef CGAL::Vector_2< R > Vector; -typedef CGAL::Iso_rectangle_2< R > Square_2; +typedef Cartesian< FT > K; +typedef K::Point_2 Point; +typedef K::Vector_2 Vector; +typedef K::Iso_rectangle_2 Square_2; typedef vector< Point > PCont; typedef PCont::iterator iterator; typedef Creator_uniform_2< FT, Point > Creator; @@ -235,7 +232,7 @@ main(int argc, char* argv[]) #ifdef CGAL_USE_LEDA // check that all points are covered - CGAL::Infinity_distance_2< R > dist; + CGAL::Infinity_distance_2< K > dist; #ifdef _MSC_VER { #endif @@ -260,8 +257,8 @@ main(int argc, char* argv[]) // check that there is at least one square with two points // on opposite sides - CGAL::Signed_x_distance_2< R > xdist; - CGAL::Signed_y_distance_2< R > ydist; + CGAL::Signed_x_distance_2< K > xdist; + CGAL::Signed_y_distance_2< K > ydist; bool boundary = false; #ifdef _MSC_VER { diff --git a/Packages/Matrix_search/test/Matrix_search/sorted_matrix_search_test.C b/Packages/Matrix_search/test/Matrix_search/sorted_matrix_search_test.C index f855cfa2b21..a3ee10c7a2a 100644 --- a/Packages/Matrix_search/test/Matrix_search/sorted_matrix_search_test.C +++ b/Packages/Matrix_search/test/Matrix_search/sorted_matrix_search_test.C @@ -26,7 +26,6 @@ // ============================================================================ #include -#include #include #include #include @@ -59,10 +58,10 @@ using std::sort; using std::less; using std::greater_equal; using std::max; -using std::bind2nd; using std::cerr; using std::endl; using CGAL::Cartesian_matrix; +using CGAL::bind_2; using CGAL::Random; using CGAL::default_random; using CGAL::sorted_matrix_search; @@ -193,7 +192,7 @@ main( int argc, char* argv[]) matrices.begin(), matrices.end(), sorted_matrix_search_traits_adaptor( - bind2nd( greater_equal< Value >(), + bind_2( greater_equal< Value >(), bound), *(matrices.begin())))); diff --git a/Packages/Matrix_search/version b/Packages/Matrix_search/version index 320e5bd892c..dac34eabf26 100644 --- a/Packages/Matrix_search/version +++ b/Packages/Matrix_search/version @@ -1 +1 @@ -1.46 (21 June 2001) +1.47 (06 July 2001)