Use new functor adaptors.

Worked over traits classes -> Kernel Traits.
This commit is contained in:
Michael Hoffmann 2001-07-06 13:07:33 +00:00
parent 59e2aa1672
commit 848abdbe5a
41 changed files with 1323 additions and 1941 deletions

View File

@ -26,10 +26,11 @@
// ============================================================================
#ifdef CGAL_USE_LEDA
#include <CGAL/basic.h>
#if (defined(CGAL_USE_LEDA) || defined(CGAL_USE_CGAL_WINDOW))
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_convex_set_2.h>
@ -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;

View File

@ -26,7 +26,9 @@
// ============================================================================
#ifdef CGAL_USE_LEDA
#include <CGAL/basic.h>
#if (defined(CGAL_USE_LEDA) || defined(CGAL_USE_CGAL_WINDOW))
#include <CGAL/Cartesian.h>
#include <CGAL/squared_distance_2.h>
@ -37,7 +39,7 @@
#include <CGAL/point_generators_2.h>
#include <CGAL/random_convex_set_2.h>
#include <CGAL/Timer.h>
#include <CGAL/IO/leda_window.h>
#include <CGAL/IO/Window_stream.h>
#include <iostream>
#include <cstdlib>
#include <cstdio>
@ -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);

View File

@ -26,18 +26,21 @@
// ============================================================================
#ifdef CGAL_USE_LEDA
#include <CGAL/basic.h>
#if (defined(CGAL_USE_LEDA) || defined(CGAL_USE_CGAL_WINDOW))
#include <CGAL/Cartesian.h>
#include <CGAL/IO/leda_window.h>
#include <CGAL/IO/Ostream_iterator.h>
#include <CGAL/IO/Istream_iterator.h>
#include <CGAL/rectangular_p_center_2.h>
#include <CGAL/point_generators_2.h>
//#include <CGAL/Arithmetic_filter.h>
#include <CGAL/leda_real.h>
#include <CGAL/algorithm.h>
#include <CGAL/Timer.h>
#include <CGAL/IO/Ostream_iterator.h>
#include <CGAL/IO/Istream_iterator.h>
#include <CGAL/IO/Window_stream.h>
#ifdef CGAL_USE_LEDA
#include <CGAL/leda_real.h>
#endif // CGAL_USE_LEDA
#include <iostream>
#include <vector>
#include <algorithm>
@ -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());

View File

@ -1,7 +1,4 @@
#line 1492 "mon_search.aw"
#line 775 "afn.awi"
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_convex_set_2.h>
@ -41,4 +38,3 @@ main()
return 0;
}
#line 1493 "mon_search.aw"

View File

@ -1,5 +1,4 @@
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_convex_set_2.h>
@ -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;

View File

@ -1,5 +1,4 @@
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_convex_set_2.h>
@ -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;

View File

@ -1,7 +1,4 @@
#line 726 "pcenter.aw"
#line 599 "pc_testprog.awi"
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/rectangular_p_center_2.h>
#include <CGAL/IO/Ostream_iterator.h>
@ -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"

View File

@ -1,7 +1,4 @@
#line 355 "fj_testprog.awi"
#line 293 "fj_testprog.awi"
#include <CGAL/Random.h>
#include <CGAL/function_objects.h>
#include <CGAL/Cartesian_matrix.h>
#include <CGAL/sorted_matrix_search.h>
#include <vector>
@ -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"

View File

@ -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<R>}) 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<R>} 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<R>}\\
\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<R>}
\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<R>}
\ccRefIdfierPage{Cartesian<FieldNumberType>},
\ccRefIdfierPage{Homogeneous<RingNumberType>},
\ccRefIdfierPage{Simple_cartesian<FieldNumberType>},
\ccRefIdfierPage{Simple_homogeneous<RingNumberType>}.
\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}

View File

@ -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<R>} 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<R>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2<R>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2<K>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2<K>}\\
\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<R>}
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<R>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2<R>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2<K>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2<K>}\\
\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<R>}
\begin{ccRefClass}{Extremal_polygon_area_traits_2<K>}
\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<R>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2<K>}\\
\ccRefConceptPage{ExtremalPolygonTraits_2}
\end{ccAdvanced}
\end{ccRefClass}
\begin{ccRefClass}{Extremal_polygon_perimeter_traits_2<R>}
\begin{ccRefClass}{Extremal_polygon_perimeter_traits_2<K>}
\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<R>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2<K>}\\
\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<R>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2<R>}
\ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2<K>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2<K>}
\ccSeeAlso
\ccRefIdfierPage{CGAL::maximum_area_inscribed_k_gon_2}\\

View File

@ -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<R>}

View File

@ -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

View File

@ -1,7 +1,4 @@
#line 1492 "mon_search.aw"
#line 775 "afn.awi"
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_convex_set_2.h>
@ -41,4 +38,3 @@ main()
return 0;
}
#line 1493 "mon_search.aw"

View File

@ -1,5 +1,4 @@
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_convex_set_2.h>
@ -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;

View File

@ -1,5 +1,4 @@
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_convex_set_2.h>
@ -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;

View File

@ -1,7 +1,4 @@
#line 726 "pcenter.aw"
#line 599 "pc_testprog.awi"
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/rectangular_p_center_2.h>
#include <CGAL/IO/Ostream_iterator.h>
@ -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"

View File

@ -1,7 +1,4 @@
#line 355 "fj_testprog.awi"
#line 293 "fj_testprog.awi"
#include <CGAL/Random.h>
#include <CGAL/function_objects.h>
#include <CGAL/Cartesian_matrix.h>
#include <CGAL/sorted_matrix_search.h>
#include <vector>
@ -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"

View File

@ -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<R>}) 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<R>} 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<R>}\\
\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<R>}
\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<R>}
\ccRefIdfierPage{Cartesian<FieldNumberType>},
\ccRefIdfierPage{Homogeneous<RingNumberType>},
\ccRefIdfierPage{Simple_cartesian<FieldNumberType>},
\ccRefIdfierPage{Simple_homogeneous<RingNumberType>}.
\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}

View File

@ -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<R>} 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<R>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2<R>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2<K>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2<K>}\\
\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<R>}
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<R>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2<R>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2<K>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2<K>}\\
\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<R>}
\begin{ccRefClass}{Extremal_polygon_area_traits_2<K>}
\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<R>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2<K>}\\
\ccRefConceptPage{ExtremalPolygonTraits_2}
\end{ccAdvanced}
\end{ccRefClass}
\begin{ccRefClass}{Extremal_polygon_perimeter_traits_2<R>}
\begin{ccRefClass}{Extremal_polygon_perimeter_traits_2<K>}
\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<R>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2<K>}\\
\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<R>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2<R>}
\ccRefIdfierPage{CGAL::Extremal_polygon_area_traits_2<K>}\\
\ccRefIdfierPage{CGAL::Extremal_polygon_perimeter_traits_2<K>}
\ccSeeAlso
\ccRefIdfierPage{CGAL::maximum_area_inscribed_k_gon_2}\\

View File

@ -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<R>}

View File

@ -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

View File

@ -26,7 +26,6 @@
// ============================================================================
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_convex_set_2.h>

View File

@ -26,7 +26,6 @@
// ============================================================================
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_convex_set_2.h>
@ -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;

View File

@ -26,7 +26,6 @@
// ============================================================================
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/rectangular_p_center_2.h>
#include <CGAL/IO/Ostream_iterator.h>
@ -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() {

View File

@ -26,7 +26,6 @@
// ============================================================================
#include <CGAL/Random.h>
#include <CGAL/function_objects.h>
#include <CGAL/Cartesian_matrix.h>
#include <CGAL/sorted_matrix_search.h>
#include <vector>
@ -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;

View File

@ -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,

View File

@ -31,61 +31,40 @@
#include <CGAL/Optimisation/assertions.h>
#include <CGAL/squared_distance_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/function_objects.h>
#include <CGAL/functional.h>
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;
};

View File

@ -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 >

View File

@ -29,15 +29,11 @@
#define CGAL_ALL_FURTHEST_NEIGHBORS_2_H 1
#include <CGAL/Optimisation/assertions.h>
#ifdef CGAL_REP_CLASS_DEFINED
#include <CGAL/All_furthest_neighbors_traits_2.h>
#endif // CGAL_REP_CLASS_DEFINED
#include <CGAL/Cartesian_matrix.h>
#include <CGAL/Dynamic_matrix.h>
#include <CGAL/monotone_matrix_search.h>
#include <functional>
#include <CGAL/Polygon_2_algorithms.h>
#include <CGAL/functional.h>
#include <algorithm>
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)

View File

@ -32,6 +32,7 @@
#include <CGAL/monotone_matrix_search.h>
#include <CGAL/Dynamic_matrix.h>
#include <CGAL/Transform_iterator.h>
#include <CGAL/Polygon_2_algorithms.h>
#include <vector>
#include <functional>
#include <algorithm>
@ -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(

View File

@ -30,7 +30,7 @@
#include <CGAL/Optimisation/assertions.h>
#include <CGAL/circulator.h>
#include <CGAL/function_objects.h>
#include <CGAL/functional.h>
#include <CGAL/algorithm.h>
#include <algorithm>
#include <iterator>
@ -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<FT>(), d.r),
bind1st(dist, corner))));
compose(bind_1(std::greater_equal<FT>(), 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<FT>(), d.r),
bind1st(dist, corner))));
compose(bind_1(std::greater_equal<FT>(), d.r),
bind_1(dist, corner))));
three_cover_points(d, o, ok);

File diff suppressed because it is too large Load Diff

View File

@ -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); }

View File

@ -29,7 +29,7 @@
#define CGAL_RECTANGULAR_P_CENTER_2_H 1
#include <CGAL/pierce_rectangles_2.h>
#include <CGAL/function_objects.h>
#include <CGAL/functional.h>
#include <CGAL/sorted_matrix_search.h>
#include <CGAL/rectangular_3_center_2.h>
#include <algorithm>
@ -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( ... )

View File

@ -30,9 +30,8 @@
#include <CGAL/basic.h>
#include <CGAL/Optimisation/assertions.h>
#include <CGAL/function_objects.h>
#include <CGAL/functional.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <CGAL/Sorted_matrix_search_traits_adaptor.h>
@ -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)));

View File

@ -26,7 +26,6 @@
// ============================================================================
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Polygon_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_convex_set_2.h>

View File

@ -26,7 +26,6 @@
// ============================================================================
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/random_convex_set_2.h>
#include <CGAL/extremal_polygon_2.h>
@ -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);

View File

@ -26,9 +26,6 @@
// ============================================================================
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Vector_2.h>
#include <CGAL/Iso_rectangle_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/rectangular_p_center_2.h>
#include <CGAL/Random.h>
@ -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
{

View File

@ -26,9 +26,6 @@
// ============================================================================
#include <CGAL/Cartesian.h>
#include <CGAL/Point_2.h>
#include <CGAL/Vector_2.h>
#include <CGAL/Iso_rectangle_2.h>
#include <CGAL/point_generators_2.h>
#include <CGAL/rectangular_p_center_2.h>
#include <CGAL/Random.h>
@ -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
{

View File

@ -26,7 +26,6 @@
// ============================================================================
#include <CGAL/Random.h>
#include <CGAL/function_objects.h>
#include <CGAL/Cartesian_matrix.h>
#include <CGAL/sorted_matrix_search.h>
#include <vector>
@ -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()))));

View File

@ -1 +1 @@
1.46 (21 June 2001)
1.47 (06 July 2001)