mirror of https://github.com/CGAL/cgal
***
This commit is contained in:
parent
d9dc4a2570
commit
a6021f5f2f
|
|
@ -33,34 +33,37 @@ predicates on those primitives.
|
|||
\ccNestedType{Iso_rectangle_2}{The iso rectangle type.}
|
||||
|
||||
\ccNestedType{Construct_iso_rectangle_2} {A constructor object for
|
||||
\ccc{Iso_rectangle_2}. Must provide.}
|
||||
\ccc{Iso_rectangle_2}.}
|
||||
|
||||
|
||||
\ccNestedType{Compare_x_2}{Predicate object. Must provide
|
||||
the operator.
|
||||
\ccc{Comparison_result operator()(Point p, Point q)}
|
||||
\ccNestedType{Compare_x_2_object}{Predicate object. Must provide
|
||||
the operator
|
||||
\ccc{Comparison_result operator()(Point_2 p, Point_2 q)}
|
||||
which returns
|
||||
\ccc{SMALLER, EQUAL} or \ccc{ LARGER}
|
||||
according ding to the
|
||||
$x$-ordering of points \ccc{p} and \ccc{q}.}
|
||||
\ccGlue
|
||||
\ccNestedType{Compare_y_2}{Predicate object. Must provide
|
||||
the operator.
|
||||
\ccc{Comparison_result operator()(Point p, Point q)}
|
||||
which returns the
|
||||
(\ccc{SMALLER, EQUAL} or \ccc{ LARGER})
|
||||
\ccNestedType{Compare_y_2_object}{Predicate object. Must provide
|
||||
the operator
|
||||
\ccc{Comparison_result operator()(Point_2 p, Point_2 q)}
|
||||
which returns
|
||||
\ccc{SMALLER, EQUAL} or \ccc{ LARGER}
|
||||
according to the
|
||||
$y$-ordering of points \ccc{p} and \ccc{q}.}
|
||||
\ccGlue
|
||||
\ccNestedType{Less_x_2}{Predicate object. Must provide
|
||||
the operator.
|
||||
}\ccGlue
|
||||
\ccNestedType{Less_xy_2}{Predicate object. Must provide
|
||||
the operator
|
||||
}\ccGlue
|
||||
\ccNestedType{Less_yx_2}{Predicate object. Must provide
|
||||
the operator
|
||||
}
|
||||
\ccNestedType{Less_x_2_object}{Predicate object. Must provide
|
||||
the operator
|
||||
\ccc{bool operator()(Point_2 p, Point_2 q)}
|
||||
which returns
|
||||
whether \ccc{p} is less than \ccc{q} according to their $x$-ordering.}
|
||||
\ccGlue
|
||||
\ccNestedType{Less_y_2_object}{Predicate object. Must provide
|
||||
the operator
|
||||
\ccc{bool operator()(Point_2 p, Point_2 q)}
|
||||
which returns
|
||||
whether \ccc{p} is less than \ccc{q} according to their $y$-ordering.}
|
||||
|
||||
\ccCreation
|
||||
\ccCreationVariable{traits} %% choose variable name
|
||||
Only a default constructor, copy constructor
|
||||
|
|
|
|||
|
|
@ -1,20 +1,30 @@
|
|||
% +------------------------------------------------------------------------+
|
||||
% | Reference manual page: Largest_empty_iso_rectangle_2.tex
|
||||
% | CGAL Reference Manual: snapRounding.tex
|
||||
% +------------------------------------------------------------------------+
|
||||
% | 27.3.2000 Eli Packer
|
||||
% | Package:
|
||||
% |
|
||||
%\RCSdef{\RCSTriangulationRev}{$Revision$}
|
||||
%\RCSdefDate{\RCSTriangulationDate}{$Date$}
|
||||
% | snap rounding of line segments
|
||||
% |
|
||||
%%RefPage: end of header, begin of main body
|
||||
% | 9.4.00 Eli Packer
|
||||
% |
|
||||
%\RCSdef{\largestEmptyRectangleRev}{$Revision$}
|
||||
%\RCSdefDate{largestEmptyRectangleDate}{$Date$}
|
||||
% +------------------------------------------------------------------------+
|
||||
|
||||
\ccParDims
|
||||
|
||||
\begin{ccRefClass}{Largest_empty_iso_rectangle_2<T>}
|
||||
% \usepackage{graphics, amssymb,epsfig}
|
||||
|
||||
%% \ccHtmlCrossLink{} %% add further rules for cross referencing links
|
||||
%% \ccHtmlIndexC[class]{} %% add further index entries
|
||||
\chapter{Largest Empty Rectangle}
|
||||
\label{chapterLer}
|
||||
%\ccChapterRelease{\largestEmptyRectangleRev. \ \largestEmptyRectangleDate}\\
|
||||
\ccChapterAuthor{Eli Packer}
|
||||
|
||||
% +------------------------------------------------------------------------+
|
||||
\section{Overview}
|
||||
The Largest Empty Rectangle problem answers the following query. Given
|
||||
a set of points in the plane and a bounding box( iso-rectangle) that bounds them,
|
||||
find the iso-rectangle with the largest area among all iso-rectangles that are
|
||||
inside the above bounding box and do not contain any point of the point set.
|
||||
See Figure~\ref{fig:ler1} for an illustration.
|
||||
|
||||
\begin{figure}[h]
|
||||
\begin{ccTexOnly}
|
||||
|
|
@ -24,7 +34,7 @@
|
|||
\end{ccTexOnly}
|
||||
|
||||
\caption{An example of the largest empty iso rectangle of a set of points
|
||||
\label{LER:example_pic}}
|
||||
\label{fig:ler1}}
|
||||
|
||||
\begin{ccHtmlOnly}
|
||||
<P>
|
||||
|
|
@ -35,154 +45,23 @@
|
|||
\end{ccHtmlOnly}
|
||||
\end{figure}
|
||||
|
||||
\ccDefinition
|
||||
|
||||
Given a set of points in the plane, the class \ccRefName\ is a data
|
||||
structure that maintains an iso-rectangle with the largest area among
|
||||
all iso-rectangles that are inside a given bounding box( iso-rectangle), and
|
||||
that do not contain any point of the point set.
|
||||
|
||||
The class \ccRefName\ expects a model of the concept \ccc{LargestEmptyIsoRectangleTraits_2} as its template argument.
|
||||
|
||||
\ccInclude{CGAL/Largest_empty_iso_rectangle_2.h}
|
||||
|
||||
|
||||
\ccTypes
|
||||
The class \ccClassTemplateName\ defines the following types:
|
||||
|
||||
\ccThreeToTwo
|
||||
|
||||
\ccTypedef{typedef T Traits;}{}
|
||||
|
||||
\ccTypedef{typedef Traits::Point_2 Point_2;}{}
|
||||
\ccGlue
|
||||
\ccTypedef{typedef Traits::Iso_rectangle_2 Iso_rectangle_2;}{}
|
||||
|
||||
|
||||
The following iterator allows to enumerate the points.
|
||||
It is non mutable, bidirectional
|
||||
and its value type is \ccc{Point_2}.
|
||||
It is invalidated by any insertion or removal of a point.
|
||||
|
||||
\ccNestedType{const_iterator}{Iterator over the points.}
|
||||
|
||||
|
||||
\ccCreation
|
||||
\ccCreationVariable{l} %% choose variable name
|
||||
\ccSetTwoColumns{Qt_widget}{}
|
||||
%\ccThree{Largest_empty_iso_rectangle_2<Traits>(const Point_2& bl, const Point_2& tr)}{}{}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
(const Iso_rectangle_2 &b);}
|
||||
{Constructor. The iso-rectangle \ccc{b} is the bounding rectangle.}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
(const Point_2 p,const Point_2 q);}
|
||||
{Constructor. The iso-rectangle whose lower left and upper right points are \ccc{p} and
|
||||
\ccc{q} respectively is the bounding rectangle.}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
();}
|
||||
{Constructor. The iso-rectangle whose lower left point and upper right points are (0,0)
|
||||
and (1,1) respectively is the bounding rectangle.}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
(const Largest_empty_iso_rectangle_2<Traits> tr);}
|
||||
{Copy constructor.}
|
||||
|
||||
%\ccConstructor{\tilde Largest_empty_iso_rectangle_2<Traits>();}
|
||||
%{Destructor.}
|
||||
%
|
||||
\ccOperations
|
||||
\ccSetThreeColumns{const_iterator}{container.begin() const;}{}
|
||||
|
||||
\ccHeading{Assignment}
|
||||
|
||||
\ccMethod{Largest_empty_iso_rectangle_2<T>
|
||||
operator=(const Largest_empty_iso_rectangle_2<T> & tr);}
|
||||
{}
|
||||
|
||||
\ccAccessFunctions
|
||||
|
||||
\ccMethod{const Traits & traits() const;}
|
||||
{Returns a const reference to the traits object.}
|
||||
|
||||
|
||||
\ccMethod{const_iterator begin() const;}
|
||||
{Returns an iterator to the beginning of the point set.}
|
||||
\ccMethod{const_iterator end() const;}
|
||||
{Returns a past-the-end iterator for the point set.}
|
||||
|
||||
|
||||
\ccHeading{Queries}
|
||||
|
||||
\ccMethod{Quadruple<Point_2, Point_2, Point_2, Point_2>
|
||||
get_left_bottom_right_top();}
|
||||
{Returns the four points that define the largest empty iso-rectangle.
|
||||
Note that these points are almost never on a corner of an iso-rectangle.}
|
||||
\ccGlue
|
||||
\ccMethod{Iso_rectangle_2 get_largest_empty_iso_rectangle();}
|
||||
{Returns the largest empty iso-rectangle. Note that the two
|
||||
points defining the iso-rectangle are almost never part of
|
||||
the point set.}
|
||||
\ccGlue
|
||||
\ccMethod{Iso_rectangle_2 get_bounding_box();}
|
||||
{Returns the iso-rectangle passed in the constructor.}
|
||||
\ccHeading{Insertion}
|
||||
|
||||
\ccMethod{void
|
||||
insert(const Point_2& p);}
|
||||
{Inserts point \ccc{p} in the point set, if it is not already in the set.}
|
||||
|
||||
\ccMethod{void
|
||||
push_back(const Point_2& p);}
|
||||
{Inserts point \ccc{p} in the point set, if it is not already in the set.}
|
||||
|
||||
\ccMethod{template < class InputIterator >
|
||||
int
|
||||
insert(InputIterator first, InputIterator last);}
|
||||
{Inserts the points in the range $\left[\right.$\ccc{first},
|
||||
\ccc{last}$\left.\right)$. Returns the number of inserted points. \\ \\
|
||||
\ccRequirements The \ccc{value_type} of \ccc{first} and \ccc{last} is \ccc{Point}.}
|
||||
|
||||
\ccHeading{Removal}
|
||||
|
||||
\ccMethod{bool remove(const Point_2& p);}{Removes point \ccc{p}.
|
||||
Returns false iff \ccc{p} is not in the point set. }
|
||||
|
||||
\ccMethod{void clear();}
|
||||
{Removes all points of \ccVar.}
|
||||
|
||||
%\ccSeeAlso
|
||||
|
||||
\ccImplementation
|
||||
|
||||
The algorithm is an implementation of \cite{o-naler-90}. The runtime of an
|
||||
insertion or a removal is $O(\log n)$. A query takes $O(n^2)$ worst
|
||||
case time and $O(n \log n)$ expected time. The working storage is $
|
||||
O(n)$.
|
||||
|
||||
|
||||
% +========================================================================+
|
||||
\section{Examples of Largest empty iso rectangle}
|
||||
\section{Examples of Largest Empty Rectangle}
|
||||
% +========================================================================+
|
||||
|
||||
The following example generates the Largest empty rectangle of a set
|
||||
The following example generates the Largest Empty Rectangle of a set
|
||||
of points.
|
||||
|
||||
\ccIncludeExampleCode{../../examples/Largest_empty_rect_2/example.C}
|
||||
|
||||
% +--------------------------------------------------------+
|
||||
|
||||
%\ccExample
|
||||
|
||||
%%\ccIncludeExampleCode{examples/Triangulation3/example1.C}
|
||||
|
||||
\bibliography{Largest_empty_iso_rectangle_2}
|
||||
\bibliographystyle{abbrv}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
||||
% +------------------------------------------------------------------------+
|
||||
%%RefPage: end of main body, begin of footer
|
||||
% EOF
|
||||
% +------------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,156 @@
|
|||
% +------------------------------------------------------------------------+
|
||||
% | Reference manual page: Largest_empty_iso_rectangle_2.tex
|
||||
% +------------------------------------------------------------------------+
|
||||
% | 27.3.2000 Eli Packer
|
||||
% | Package:
|
||||
% |
|
||||
%\RCSdef{\RCSTriangulationRev}{$Revision$}
|
||||
%\RCSdefDate{\RCSTriangulationDate}{$Date$}
|
||||
% |
|
||||
%%RefPage: end of header, begin of main body
|
||||
% +------------------------------------------------------------------------+
|
||||
|
||||
|
||||
\begin{ccRefClass}{Largest_empty_iso_rectangle_2<T>}
|
||||
|
||||
%% \ccHtmlCrossLink{} %% add further rules for cross referencing links
|
||||
%% \ccHtmlIndexC[class]{} %% add further index entries
|
||||
|
||||
|
||||
\ccDefinition
|
||||
|
||||
Given a set of points in the plane, the class \ccRefName\ is a data
|
||||
structure that maintains an iso-rectangle with the largest area among
|
||||
all iso-rectangles that are inside a given bounding box( iso-rectangle), and
|
||||
that do not contain any point of the point set.
|
||||
|
||||
The class \ccRefName\ expects a model of the concept \ccc{LargestEmptyIsoRectangleTraits_2} as its template argument.
|
||||
|
||||
\ccInclude{CGAL/Largest_empty_iso_rectangle_2.h}
|
||||
|
||||
|
||||
\ccTypes
|
||||
The class \ccClassTemplateName\ defines the following types:
|
||||
|
||||
\ccThreeToTwo
|
||||
|
||||
\ccTypedef{typedef T Traits;}{}
|
||||
|
||||
\ccTypedef{typedef Traits::Point_2 Point_2;}{}
|
||||
|
||||
\ccTypedef{typedef Traits::Iso_rectangle_2 Iso_rectangle_2;}{}
|
||||
|
||||
|
||||
The following iterator allows to enumerate the points.
|
||||
It is non mutable, bidirectional
|
||||
and its value type is \ccc{Point_2}.
|
||||
It is invalidated by any insertion or removal of a point.
|
||||
|
||||
\ccNestedType{const_iterator}{Iterator over the points.}
|
||||
|
||||
|
||||
\ccCreation
|
||||
\ccCreationVariable{l} %% choose variable name
|
||||
\ccSetTwoColumns{Qt_widget}{}
|
||||
%\ccThree{Largest_empty_iso_rectangle_2<Traits>(const Point_2& bl, const Point_2& tr)}{}{}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
(const Iso_rectangle_2 &b);}
|
||||
{Constructor. The iso-rectangle \ccc{b} is the bounding rectangle.}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
(const Point_2 p,const Point_2 q);}
|
||||
{Constructor. The iso-rectangle whose lower left and upper right points are \ccc{p} and
|
||||
\ccc{q} respectively is the bounding rectangle.}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
();}
|
||||
{Constructor. The iso-rectangle whose lower left point and upper right points are (0,0)
|
||||
and (1,1) respectively is the bounding rectangle.}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
(const Largest_empty_iso_rectangle_2<Traits> tr);}
|
||||
{Copy constructor.}
|
||||
|
||||
%\ccConstructor{\tilde Largest_empty_iso_rectangle_2<Traits>();}
|
||||
%{Destructor.}
|
||||
%
|
||||
\ccOperations
|
||||
\ccSetThreeColumns{const_iterator}{container.begin() const;}{}
|
||||
|
||||
\ccHeading{Assignment}
|
||||
|
||||
\ccMethod{Largest_empty_iso_rectangle_2<T>
|
||||
operator=(const Largest_empty_iso_rectangle_2<T> & tr);}
|
||||
{}
|
||||
|
||||
\ccAccessFunctions
|
||||
|
||||
\ccMethod{const Traits & traits() const;}
|
||||
{Returns a const reference to the traits object.}
|
||||
|
||||
|
||||
\ccMethod{const_iterator begin() const;}
|
||||
{Returns an iterator to the beginning of the point set.}
|
||||
\ccMethod{const_iterator end() const;}
|
||||
{Returns a past-the-end iterator for the point set.}
|
||||
|
||||
|
||||
\ccHeading{Queries}
|
||||
|
||||
\ccMethod{Quadruple<Point_2, Point_2, Point_2, Point_2>
|
||||
get_left_bottom_right_top();}
|
||||
{Returns the four points that define the largest empty iso-rectangle.
|
||||
(Note that these points are not necessarily on a corner of an iso-rectangle.)}
|
||||
\ccGlue
|
||||
\ccMethod{Iso_rectangle_2 get_largest_empty_iso_rectangle();}
|
||||
{Returns the largest empty iso-rectangle. (Note that the two
|
||||
points defining the iso-rectangle are not necessarily part of
|
||||
the point set.)}
|
||||
\ccGlue
|
||||
\ccMethod{Iso_rectangle_2 get_bounding_box();}
|
||||
{Returns the iso-rectangle passed in the constructor.}
|
||||
\ccHeading{Insertion}
|
||||
|
||||
\ccMethod{void
|
||||
insert(const Point_2& p);}
|
||||
{Inserts point \ccc{p} in the point set, if it is not already in the set.}
|
||||
|
||||
\ccMethod{void
|
||||
push_back(const Point_2& p);}
|
||||
{Inserts point \ccc{p} in the point set, if it is not already in the set.}
|
||||
|
||||
\ccMethod{template < class InputIterator >
|
||||
int
|
||||
insert(InputIterator first, InputIterator last);}
|
||||
{Inserts the points in the range $\left[\right.$\ccc{first},
|
||||
\ccc{last}$\left.\right)$. Returns the number of inserted points. \\ \\
|
||||
\ccRequirements The \ccc{value_type} of \ccc{first} and \ccc{last} is \ccc{Point}.}
|
||||
|
||||
\ccHeading{Removal}
|
||||
|
||||
\ccMethod{bool remove(const Point_2& p);}{Removes point \ccc{p}.
|
||||
Returns false iff \ccc{p} is not in the point set. }
|
||||
|
||||
\ccMethod{void clear();}
|
||||
{Removes all points of \ccVar.}
|
||||
|
||||
%\ccSeeAlso
|
||||
|
||||
\ccImplementation
|
||||
|
||||
The algorithm is an implementation of \cite{o-naler-90}. The runtime of an
|
||||
insertion or a removal is $O(\log n)$. A query takes $O(n^2)$ worst
|
||||
case time and $O(n \log n)$ expected time. The working storage is $
|
||||
O(n)$.
|
||||
|
||||
\bibliography{Largest_empty_iso_rectangle_2}
|
||||
\bibliographystyle{abbrv}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
||||
% +------------------------------------------------------------------------+
|
||||
%%RefPage: end of main body, begin of footer
|
||||
% EOF
|
||||
% +------------------------------------------------------------------------+
|
||||
|
||||
|
|
@ -2,5 +2,7 @@
|
|||
|
||||
\inputOpt{Largest_empty_iso_rectangle_2}
|
||||
|
||||
\inputOpt{Largest_empty_iso_rectangle_2_ref}
|
||||
|
||||
\inputOpt{LargestEmptyIsoRectangleTraits_2}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,34 +33,37 @@ predicates on those primitives.
|
|||
\ccNestedType{Iso_rectangle_2}{The iso rectangle type.}
|
||||
|
||||
\ccNestedType{Construct_iso_rectangle_2} {A constructor object for
|
||||
\ccc{Iso_rectangle_2}. Must provide.}
|
||||
\ccc{Iso_rectangle_2}.}
|
||||
|
||||
|
||||
\ccNestedType{Compare_x_2}{Predicate object. Must provide
|
||||
the operator.
|
||||
\ccc{Comparison_result operator()(Point p, Point q)}
|
||||
\ccNestedType{Compare_x_2_object}{Predicate object. Must provide
|
||||
the operator
|
||||
\ccc{Comparison_result operator()(Point_2 p, Point_2 q)}
|
||||
which returns
|
||||
\ccc{SMALLER, EQUAL} or \ccc{ LARGER}
|
||||
according ding to the
|
||||
$x$-ordering of points \ccc{p} and \ccc{q}.}
|
||||
\ccGlue
|
||||
\ccNestedType{Compare_y_2}{Predicate object. Must provide
|
||||
the operator.
|
||||
\ccc{Comparison_result operator()(Point p, Point q)}
|
||||
which returns the
|
||||
(\ccc{SMALLER, EQUAL} or \ccc{ LARGER})
|
||||
\ccNestedType{Compare_y_2_object}{Predicate object. Must provide
|
||||
the operator
|
||||
\ccc{Comparison_result operator()(Point_2 p, Point_2 q)}
|
||||
which returns
|
||||
\ccc{SMALLER, EQUAL} or \ccc{ LARGER}
|
||||
according to the
|
||||
$y$-ordering of points \ccc{p} and \ccc{q}.}
|
||||
\ccGlue
|
||||
\ccNestedType{Less_x_2}{Predicate object. Must provide
|
||||
the operator.
|
||||
}\ccGlue
|
||||
\ccNestedType{Less_xy_2}{Predicate object. Must provide
|
||||
the operator
|
||||
}\ccGlue
|
||||
\ccNestedType{Less_yx_2}{Predicate object. Must provide
|
||||
the operator
|
||||
}
|
||||
\ccNestedType{Less_x_2_object}{Predicate object. Must provide
|
||||
the operator
|
||||
\ccc{bool operator()(Point_2 p, Point_2 q)}
|
||||
which returns
|
||||
whether \ccc{p} is less than \ccc{q} according to their $x$-ordering.}
|
||||
\ccGlue
|
||||
\ccNestedType{Less_y_2_object}{Predicate object. Must provide
|
||||
the operator
|
||||
\ccc{bool operator()(Point_2 p, Point_2 q)}
|
||||
which returns
|
||||
whether \ccc{p} is less than \ccc{q} according to their $y$-ordering.}
|
||||
|
||||
\ccCreation
|
||||
\ccCreationVariable{traits} %% choose variable name
|
||||
Only a default constructor, copy constructor
|
||||
|
|
|
|||
|
|
@ -1,20 +1,30 @@
|
|||
% +------------------------------------------------------------------------+
|
||||
% | Reference manual page: Largest_empty_iso_rectangle_2.tex
|
||||
% | CGAL Reference Manual: snapRounding.tex
|
||||
% +------------------------------------------------------------------------+
|
||||
% | 27.3.2000 Eli Packer
|
||||
% | Package:
|
||||
% |
|
||||
%\RCSdef{\RCSTriangulationRev}{$Revision$}
|
||||
%\RCSdefDate{\RCSTriangulationDate}{$Date$}
|
||||
% | snap rounding of line segments
|
||||
% |
|
||||
%%RefPage: end of header, begin of main body
|
||||
% | 9.4.00 Eli Packer
|
||||
% |
|
||||
%\RCSdef{\largestEmptyRectangleRev}{$Revision$}
|
||||
%\RCSdefDate{largestEmptyRectangleDate}{$Date$}
|
||||
% +------------------------------------------------------------------------+
|
||||
|
||||
\ccParDims
|
||||
|
||||
\begin{ccRefClass}{Largest_empty_iso_rectangle_2<T>}
|
||||
% \usepackage{graphics, amssymb,epsfig}
|
||||
|
||||
%% \ccHtmlCrossLink{} %% add further rules for cross referencing links
|
||||
%% \ccHtmlIndexC[class]{} %% add further index entries
|
||||
\chapter{Largest Empty Rectangle}
|
||||
\label{chapterLer}
|
||||
%\ccChapterRelease{\largestEmptyRectangleRev. \ \largestEmptyRectangleDate}\\
|
||||
\ccChapterAuthor{Eli Packer}
|
||||
|
||||
% +------------------------------------------------------------------------+
|
||||
\section{Overview}
|
||||
The Largest Empty Rectangle problem answers the following query. Given
|
||||
a set of points in the plane and a bounding box( iso-rectangle) that bounds them,
|
||||
find the iso-rectangle with the largest area among all iso-rectangles that are
|
||||
inside the above bounding box and do not contain any point of the point set.
|
||||
See Figure~\ref{fig:ler1} for an illustration.
|
||||
|
||||
\begin{figure}[h]
|
||||
\begin{ccTexOnly}
|
||||
|
|
@ -24,7 +34,7 @@
|
|||
\end{ccTexOnly}
|
||||
|
||||
\caption{An example of the largest empty iso rectangle of a set of points
|
||||
\label{LER:example_pic}}
|
||||
\label{fig:ler1}}
|
||||
|
||||
\begin{ccHtmlOnly}
|
||||
<P>
|
||||
|
|
@ -35,154 +45,23 @@
|
|||
\end{ccHtmlOnly}
|
||||
\end{figure}
|
||||
|
||||
\ccDefinition
|
||||
|
||||
Given a set of points in the plane, the class \ccRefName\ is a data
|
||||
structure that maintains an iso-rectangle with the largest area among
|
||||
all iso-rectangles that are inside a given bounding box( iso-rectangle), and
|
||||
that do not contain any point of the point set.
|
||||
|
||||
The class \ccRefName\ expects a model of the concept \ccc{LargestEmptyIsoRectangleTraits_2} as its template argument.
|
||||
|
||||
\ccInclude{CGAL/Largest_empty_iso_rectangle_2.h}
|
||||
|
||||
|
||||
\ccTypes
|
||||
The class \ccClassTemplateName\ defines the following types:
|
||||
|
||||
\ccThreeToTwo
|
||||
|
||||
\ccTypedef{typedef T Traits;}{}
|
||||
|
||||
\ccTypedef{typedef Traits::Point_2 Point_2;}{}
|
||||
\ccGlue
|
||||
\ccTypedef{typedef Traits::Iso_rectangle_2 Iso_rectangle_2;}{}
|
||||
|
||||
|
||||
The following iterator allows to enumerate the points.
|
||||
It is non mutable, bidirectional
|
||||
and its value type is \ccc{Point_2}.
|
||||
It is invalidated by any insertion or removal of a point.
|
||||
|
||||
\ccNestedType{const_iterator}{Iterator over the points.}
|
||||
|
||||
|
||||
\ccCreation
|
||||
\ccCreationVariable{l} %% choose variable name
|
||||
\ccSetTwoColumns{Qt_widget}{}
|
||||
%\ccThree{Largest_empty_iso_rectangle_2<Traits>(const Point_2& bl, const Point_2& tr)}{}{}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
(const Iso_rectangle_2 &b);}
|
||||
{Constructor. The iso-rectangle \ccc{b} is the bounding rectangle.}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
(const Point_2 p,const Point_2 q);}
|
||||
{Constructor. The iso-rectangle whose lower left and upper right points are \ccc{p} and
|
||||
\ccc{q} respectively is the bounding rectangle.}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
();}
|
||||
{Constructor. The iso-rectangle whose lower left point and upper right points are (0,0)
|
||||
and (1,1) respectively is the bounding rectangle.}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
(const Largest_empty_iso_rectangle_2<Traits> tr);}
|
||||
{Copy constructor.}
|
||||
|
||||
%\ccConstructor{\tilde Largest_empty_iso_rectangle_2<Traits>();}
|
||||
%{Destructor.}
|
||||
%
|
||||
\ccOperations
|
||||
\ccSetThreeColumns{const_iterator}{container.begin() const;}{}
|
||||
|
||||
\ccHeading{Assignment}
|
||||
|
||||
\ccMethod{Largest_empty_iso_rectangle_2<T>
|
||||
operator=(const Largest_empty_iso_rectangle_2<T> & tr);}
|
||||
{}
|
||||
|
||||
\ccAccessFunctions
|
||||
|
||||
\ccMethod{const Traits & traits() const;}
|
||||
{Returns a const reference to the traits object.}
|
||||
|
||||
|
||||
\ccMethod{const_iterator begin() const;}
|
||||
{Returns an iterator to the beginning of the point set.}
|
||||
\ccMethod{const_iterator end() const;}
|
||||
{Returns a past-the-end iterator for the point set.}
|
||||
|
||||
|
||||
\ccHeading{Queries}
|
||||
|
||||
\ccMethod{Quadruple<Point_2, Point_2, Point_2, Point_2>
|
||||
get_left_bottom_right_top();}
|
||||
{Returns the four points that define the largest empty iso-rectangle.
|
||||
Note that these points are almost never on a corner of an iso-rectangle.}
|
||||
\ccGlue
|
||||
\ccMethod{Iso_rectangle_2 get_largest_empty_iso_rectangle();}
|
||||
{Returns the largest empty iso-rectangle. Note that the two
|
||||
points defining the iso-rectangle are almost never part of
|
||||
the point set.}
|
||||
\ccGlue
|
||||
\ccMethod{Iso_rectangle_2 get_bounding_box();}
|
||||
{Returns the iso-rectangle passed in the constructor.}
|
||||
\ccHeading{Insertion}
|
||||
|
||||
\ccMethod{void
|
||||
insert(const Point_2& p);}
|
||||
{Inserts point \ccc{p} in the point set, if it is not already in the set.}
|
||||
|
||||
\ccMethod{void
|
||||
push_back(const Point_2& p);}
|
||||
{Inserts point \ccc{p} in the point set, if it is not already in the set.}
|
||||
|
||||
\ccMethod{template < class InputIterator >
|
||||
int
|
||||
insert(InputIterator first, InputIterator last);}
|
||||
{Inserts the points in the range $\left[\right.$\ccc{first},
|
||||
\ccc{last}$\left.\right)$. Returns the number of inserted points. \\ \\
|
||||
\ccRequirements The \ccc{value_type} of \ccc{first} and \ccc{last} is \ccc{Point}.}
|
||||
|
||||
\ccHeading{Removal}
|
||||
|
||||
\ccMethod{bool remove(const Point_2& p);}{Removes point \ccc{p}.
|
||||
Returns false iff \ccc{p} is not in the point set. }
|
||||
|
||||
\ccMethod{void clear();}
|
||||
{Removes all points of \ccVar.}
|
||||
|
||||
%\ccSeeAlso
|
||||
|
||||
\ccImplementation
|
||||
|
||||
The algorithm is an implementation of \cite{o-naler-90}. The runtime of an
|
||||
insertion or a removal is $O(\log n)$. A query takes $O(n^2)$ worst
|
||||
case time and $O(n \log n)$ expected time. The working storage is $
|
||||
O(n)$.
|
||||
|
||||
|
||||
% +========================================================================+
|
||||
\section{Examples of Largest empty iso rectangle}
|
||||
\section{Examples of Largest Empty Rectangle}
|
||||
% +========================================================================+
|
||||
|
||||
The following example generates the Largest empty rectangle of a set
|
||||
The following example generates the Largest Empty Rectangle of a set
|
||||
of points.
|
||||
|
||||
\ccIncludeExampleCode{../../examples/Largest_empty_rect_2/example.C}
|
||||
|
||||
% +--------------------------------------------------------+
|
||||
|
||||
%\ccExample
|
||||
|
||||
%%\ccIncludeExampleCode{examples/Triangulation3/example1.C}
|
||||
|
||||
\bibliography{Largest_empty_iso_rectangle_2}
|
||||
\bibliographystyle{abbrv}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
||||
% +------------------------------------------------------------------------+
|
||||
%%RefPage: end of main body, begin of footer
|
||||
% EOF
|
||||
% +------------------------------------------------------------------------+
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,156 @@
|
|||
% +------------------------------------------------------------------------+
|
||||
% | Reference manual page: Largest_empty_iso_rectangle_2.tex
|
||||
% +------------------------------------------------------------------------+
|
||||
% | 27.3.2000 Eli Packer
|
||||
% | Package:
|
||||
% |
|
||||
%\RCSdef{\RCSTriangulationRev}{$Revision$}
|
||||
%\RCSdefDate{\RCSTriangulationDate}{$Date$}
|
||||
% |
|
||||
%%RefPage: end of header, begin of main body
|
||||
% +------------------------------------------------------------------------+
|
||||
|
||||
|
||||
\begin{ccRefClass}{Largest_empty_iso_rectangle_2<T>}
|
||||
|
||||
%% \ccHtmlCrossLink{} %% add further rules for cross referencing links
|
||||
%% \ccHtmlIndexC[class]{} %% add further index entries
|
||||
|
||||
|
||||
\ccDefinition
|
||||
|
||||
Given a set of points in the plane, the class \ccRefName\ is a data
|
||||
structure that maintains an iso-rectangle with the largest area among
|
||||
all iso-rectangles that are inside a given bounding box( iso-rectangle), and
|
||||
that do not contain any point of the point set.
|
||||
|
||||
The class \ccRefName\ expects a model of the concept \ccc{LargestEmptyIsoRectangleTraits_2} as its template argument.
|
||||
|
||||
\ccInclude{CGAL/Largest_empty_iso_rectangle_2.h}
|
||||
|
||||
|
||||
\ccTypes
|
||||
The class \ccClassTemplateName\ defines the following types:
|
||||
|
||||
\ccThreeToTwo
|
||||
|
||||
\ccTypedef{typedef T Traits;}{}
|
||||
|
||||
\ccTypedef{typedef Traits::Point_2 Point_2;}{}
|
||||
|
||||
\ccTypedef{typedef Traits::Iso_rectangle_2 Iso_rectangle_2;}{}
|
||||
|
||||
|
||||
The following iterator allows to enumerate the points.
|
||||
It is non mutable, bidirectional
|
||||
and its value type is \ccc{Point_2}.
|
||||
It is invalidated by any insertion or removal of a point.
|
||||
|
||||
\ccNestedType{const_iterator}{Iterator over the points.}
|
||||
|
||||
|
||||
\ccCreation
|
||||
\ccCreationVariable{l} %% choose variable name
|
||||
\ccSetTwoColumns{Qt_widget}{}
|
||||
%\ccThree{Largest_empty_iso_rectangle_2<Traits>(const Point_2& bl, const Point_2& tr)}{}{}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
(const Iso_rectangle_2 &b);}
|
||||
{Constructor. The iso-rectangle \ccc{b} is the bounding rectangle.}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
(const Point_2 p,const Point_2 q);}
|
||||
{Constructor. The iso-rectangle whose lower left and upper right points are \ccc{p} and
|
||||
\ccc{q} respectively is the bounding rectangle.}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
();}
|
||||
{Constructor. The iso-rectangle whose lower left point and upper right points are (0,0)
|
||||
and (1,1) respectively is the bounding rectangle.}
|
||||
|
||||
\ccConstructor{Largest_empty_iso_rectangle_2<Traits>
|
||||
(const Largest_empty_iso_rectangle_2<Traits> tr);}
|
||||
{Copy constructor.}
|
||||
|
||||
%\ccConstructor{\tilde Largest_empty_iso_rectangle_2<Traits>();}
|
||||
%{Destructor.}
|
||||
%
|
||||
\ccOperations
|
||||
\ccSetThreeColumns{const_iterator}{container.begin() const;}{}
|
||||
|
||||
\ccHeading{Assignment}
|
||||
|
||||
\ccMethod{Largest_empty_iso_rectangle_2<T>
|
||||
operator=(const Largest_empty_iso_rectangle_2<T> & tr);}
|
||||
{}
|
||||
|
||||
\ccAccessFunctions
|
||||
|
||||
\ccMethod{const Traits & traits() const;}
|
||||
{Returns a const reference to the traits object.}
|
||||
|
||||
|
||||
\ccMethod{const_iterator begin() const;}
|
||||
{Returns an iterator to the beginning of the point set.}
|
||||
\ccMethod{const_iterator end() const;}
|
||||
{Returns a past-the-end iterator for the point set.}
|
||||
|
||||
|
||||
\ccHeading{Queries}
|
||||
|
||||
\ccMethod{Quadruple<Point_2, Point_2, Point_2, Point_2>
|
||||
get_left_bottom_right_top();}
|
||||
{Returns the four points that define the largest empty iso-rectangle.
|
||||
(Note that these points are not necessarily on a corner of an iso-rectangle.)}
|
||||
\ccGlue
|
||||
\ccMethod{Iso_rectangle_2 get_largest_empty_iso_rectangle();}
|
||||
{Returns the largest empty iso-rectangle. (Note that the two
|
||||
points defining the iso-rectangle are not necessarily part of
|
||||
the point set.)}
|
||||
\ccGlue
|
||||
\ccMethod{Iso_rectangle_2 get_bounding_box();}
|
||||
{Returns the iso-rectangle passed in the constructor.}
|
||||
\ccHeading{Insertion}
|
||||
|
||||
\ccMethod{void
|
||||
insert(const Point_2& p);}
|
||||
{Inserts point \ccc{p} in the point set, if it is not already in the set.}
|
||||
|
||||
\ccMethod{void
|
||||
push_back(const Point_2& p);}
|
||||
{Inserts point \ccc{p} in the point set, if it is not already in the set.}
|
||||
|
||||
\ccMethod{template < class InputIterator >
|
||||
int
|
||||
insert(InputIterator first, InputIterator last);}
|
||||
{Inserts the points in the range $\left[\right.$\ccc{first},
|
||||
\ccc{last}$\left.\right)$. Returns the number of inserted points. \\ \\
|
||||
\ccRequirements The \ccc{value_type} of \ccc{first} and \ccc{last} is \ccc{Point}.}
|
||||
|
||||
\ccHeading{Removal}
|
||||
|
||||
\ccMethod{bool remove(const Point_2& p);}{Removes point \ccc{p}.
|
||||
Returns false iff \ccc{p} is not in the point set. }
|
||||
|
||||
\ccMethod{void clear();}
|
||||
{Removes all points of \ccVar.}
|
||||
|
||||
%\ccSeeAlso
|
||||
|
||||
\ccImplementation
|
||||
|
||||
The algorithm is an implementation of \cite{o-naler-90}. The runtime of an
|
||||
insertion or a removal is $O(\log n)$. A query takes $O(n^2)$ worst
|
||||
case time and $O(n \log n)$ expected time. The working storage is $
|
||||
O(n)$.
|
||||
|
||||
\bibliography{Largest_empty_iso_rectangle_2}
|
||||
\bibliographystyle{abbrv}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
||||
% +------------------------------------------------------------------------+
|
||||
%%RefPage: end of main body, begin of footer
|
||||
% EOF
|
||||
% +------------------------------------------------------------------------+
|
||||
|
||||
|
|
@ -2,5 +2,7 @@
|
|||
|
||||
\inputOpt{Largest_empty_iso_rectangle_2}
|
||||
|
||||
\inputOpt{Largest_empty_iso_rectangle_2_ref}
|
||||
|
||||
\inputOpt{LargestEmptyIsoRectangleTraits_2}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue