Removed Ron from maintainer list. Updated Ron's email address. Cleaned up documentation and example programs

This commit is contained in:
Efi Fogel 2014-08-28 17:05:57 +03:00
parent 7ce44a2615
commit f48ce38473
26 changed files with 270 additions and 353 deletions

View File

@ -432,7 +432,7 @@ function template computes the offset of a given polygon \f$ P\f$
by a rational radius \f$ r\f$ in an exact manner. The input by a rational radius \f$ r\f$ in an exact manner. The input
polygon $P$ must be either simple or degenerate consisting of two polygon $P$ must be either simple or degenerate consisting of two
vertices (representing a line segment). The `traits` argument must model vertices (representing a line segment). The `traits` argument must model
the concept `ArrangementTraits_2`; it should be capable of handling the concept `ArrangementTraits_2` and it should be capable of handling
conic arcs in an exact manner---using an instance of the conic arcs in an exact manner---using an instance of the
`Arr_conic_traits_2` class template with the number `Arr_conic_traits_2` class template with the number
types provided by the <span class="textsc">Core</span> library is the types provided by the <span class="textsc">Core</span> library is the
@ -455,69 +455,73 @@ considerably slower:
\cgalExample{Minkowski_sum_2/exact_offset.cpp} \cgalExample{Minkowski_sum_2/exact_offset.cpp}
\cgalAdvancedBegin \cgalAdvancedBegin
Both functions `approximated_offset_2()` and `offset_polygon_2()` Both functions templates `approximated_offset_2()` and `offset_polygon_2()`
also have overloaded versions that accept a decomposition strategy also have overloaded versions that accept a decomposition strategy
and use the polygon-decomposition approach to compute (or approximate) and use the polygon-decomposition approach to compute (or approximate)
the offset. These functions are less efficient than their counterparts the offset. These functions are typically considerably slower than their
that employ the convolution approach, and are only included in the package counterparts that employ the convolution approach. However, similar to the
for the sake of completeness. functions that compute the general Minkowski sum, they are able to compute
the offset of polygons with holes, given a decomposition strategy that
handles polygons with holes, such as the
'Polygon_vertical_decomposition_2<Kernel>' class template.
\cgalAdvancedEnd \cgalAdvancedEnd
\subsection mink_ssecinner_offset Computing Inner Offsets \subsection mink_ssecinner_offset Computing Inner Offsets
An operation closely related to the offset computation, is obtaining the An operation closely related to the (outer) offset computation, is
<I>inner offset</I> of a polygon, or <I>insetting</I> it by a given radius. computing the <I>inner offset</I> of a polygon, or <I>insetting</I> it
The inset of a polygon \f$ P\f$ with radius \f$ r\f$ is the set of points by a given radius. The inset of a polygon \f$ P\f$ with radius
iside \f$ P\f$ whose distance from the polygon boundary, denoted \f$ r\f$ is the set of points iside \f$ P\f$ the distance of which
\f$ \partial P\f$, is at least \f$ r\f$, namely: from the polygon boundary, denoted \f$ \partial P\f$, is at least \f$ r\f$,
\f$ \{ p \in P \;|\; {\rm dist}(p, \partial P) \geq r \}\f$. namely: \f$ \{ p \in P \;|\; {\rm dist}(p, \partial P) \geq r \}\f$.
Note that the resulting set may not be connected in case \f$ P\f$ is a Note that the resulting point set may be dicconnected when \f$ P\f$ is a
non-convex polygon that has some narrow components, and thus is non-convex polygon that has some narrow components. In such a case the
characterized by a (possibly empty) set of polygons whose edges are resulting set is characterized by a (possibly empty) set of polygons the
line segments and circular arcs of radius \f$ r\f$. edges of which are line segments and circular arcs of radius \f$ r\f$.
The offset can be computed using the convolution method if we traverse the The inset can be computed using the convolution method traversing the
polygon in a <I>clockwise</I> orientation (and not in <I>counterclockwise</I> polygon in a <I>clockwise</I> order (as oppose to the
orientation, as done in case of ofsetting a polygon). <I>counterclockwise</I> order applied in the case of ofsetting a polygon).
As in case of the offset functions, the Minkowski-sum package contains two As with the (outer) offset functions, the Minkowski-sum package contains two
functions for insetting a simple polygon: functions for insetting a simple polygon, namely,
`approximated_inset_2(P, r, eps, oi)` and `inset_polygon_2(P, r, traits, oi)`.
The function \link approximated_inset_2() `approximated_inset_2(P, r, eps, oi)`\endlink accepts a polygon The \link approximated_inset_2() `approximated_inset_2(P, r, eps, oi)`\endlink
\f$ P\f$, an inset radius \f$ r\f$ and \f$ \varepsilon > 0\f$. It constructs an function template accepts a polygon \f$ P\f$, an inset radius \f$ r\f$,
approximation for the inset of \f$ P\f$ by the radius \f$ r\f$, with the approximation (a floating-point number) \f$ \epsilon > 0 \f$, and an output
error bounded by \f$ \varepsilon\f$. The function returns its output via the iterator `oi`, whose value-type must be an instance of the class template
output iterator `oi`, whose value-type must be `Gps_circle_segment_traits_2::Polygon_2`. . It constructs an approximation
`Gps_circle_segment_traits_2::Polygon_2` representing of the inset of \f$ P\f$ by the radius \f$ r\f$, where the approximation
the polygons that approximates the inset polygon. error is bounded by \f$ \epsilon\f$. The function returns the polygons that
approximate the inset polygon through the output iterator `oi`.
\cgalExample{Minkowski_sum_2/approx_inset.cpp} \cgalExample{Minkowski_sum_2/approx_inset.cpp}
Similarly, the function Similarly, the function template
\link inset_polygon_2() `inset_polygon_2(P, r, traits, oi)` \endlink computes \link inset_polygon_2() `inset_polygon_2(P, r, traits, oi)` \endlink
the exact inset of \f$ P\f$ with radius \f$ r\f$, and returns its output via the given computes the exact inset of \f$ P\f$ with radius \f$ r\f$, and returns
output iterator `oi`. The `traits` parameter should be an instance of its output through the given output iterator `oi`. The `traits` parameter
an arrangement-traits class that is capable of handling conic arcs in an must model the concept `ArrangementTraits_2` and it should be capable of
exact manner, whereas `oi`'s value-type must be handling conic arcs in an exact manner, whereas the value-type of `oi`
`Gps_traits_2::Polygon_2`. must be an instance of `Gps_traits_2::Polygon_2`.
\cgalExample{Minkowski_sum_2/exact_inset.cpp} \cgalExample{Minkowski_sum_2/exact_inset.cpp}
\cgalAdvancedBegin Unlike the functions that compute the offsets, there are no overloaded
Unlike the offset functions, there are no overloaded versions of the inset versions of the functions that compute the insets and use convex polygon
functions that use convex polygon decomposition to compute insets, as this decomposition, as decomposition approach cannot be easily generalized for
method cannot be easily generalized for inset computations. inset computations.
\cgalAdvancedEnd
In this context let us mention that there exist overloaded versions of the The package also provides overloaded versions of the functions
functions
\link approximated_offset_2() `approximated_offset_2(P, r, eps)`\endlink \link approximated_offset_2() `approximated_offset_2(P, r, eps)`\endlink
and and
\link offset_polygon_2() `offset_polygon_2(P, r, traits)`\endlink \link offset_polygon_2() `offset_polygon_2(P, r, traits)`\endlink
that accept a <I>polygon with holes</I> that accept a <I>polygon with holes</I>
\f$ P\f$ and computed its offset. This ofset is obtain by taking the outer offset \f$ P\f$ and compute its offset. This ofset is obtain by computing the
of \f$ P\f$'s outer boundary, and computing the inner offsets of \f$ P\f$'s holes. outer offset of the outer boundary of \f$ P\f$'s, and computing the inner
The former polygon defines the output boundary of \f$ P \oplus B_r\f$, and the latter offsets of the holes of \f$ P\f$. The former polygon defines the output
define the holes within the result. boundary of \f$ P \oplus B_r\f$, and the latter define the holes within
the result.
\section Minkowski_sum_2Acknowledgements Acknowledgements \section Minkowski_sum_2Acknowledgements Acknowledgements

View File

@ -1,63 +1,48 @@
//! \file examples/Minkowski_sum_2/approx_inset.cpp //! \file examples/Minkowski_sum_2/approx_inset.cpp
// Computing the approximated inset of a polygon. // Computing the approximated inset of a polygon.
#include "ms_rational_nt.h" #include <fstream>
#include <CGAL/Lazy_exact_nt.h>
#include <CGAL/Cartesian.h>
#include <CGAL/approximated_offset_2.h>
#include <CGAL/offset_polygon_2.h>
#include <CGAL/Timer.h>
#include <iostream> #include <iostream>
#include <list>
#include <boost/timer.hpp>
typedef CGAL::Lazy_exact_nt<Number_type> Lazy_exact_nt; #include <CGAL/basic.h>
#include <CGAL/approximated_offset_2.h>
struct Kernel : public CGAL::Cartesian<Lazy_exact_nt> {}; #include "bops_circular.h"
typedef CGAL::Polygon_2<Kernel> Polygon_2;
typedef CGAL::Gps_circle_segment_traits_2<Kernel> Gps_traits_2; typedef CGAL::Polygon_2<Kernel> Linear_polygon;
typedef Gps_traits_2::Polygon_2 Offset_polygon_2;
typedef Gps_traits_2::Polygon_with_holes_2 Offset_polygon_with_holes_2;
int main () int main(int argc, char* argv[])
{ {
// Open the input file. // Open the input file and read a polygon.
std::ifstream in_file ("tight.dat"); const char* filename = (argc > 1) ? argv[1] : "tight.dat";
std::ifstream in_file(filename);
if (! in_file.is_open()) if (! in_file.is_open()) {
{
std::cerr << "Failed to open the input file." << std::endl; std::cerr << "Failed to open the input file." << std::endl;
return (1); return -1;
} }
// Read the input polygon. // Read the input polygon.
Polygon_2 P; Linear_polygon P;
in_file >> P; in_file >> P;
in_file.close(); in_file.close();
std::cout << "Read an input polygon with " std::cout << "Read an input polygon with " << P.size() << " vertices."
<< P.size() << " vertices." << std::endl; << std::endl;
// Approximate the offset polygon. // Approximate the offset polygon.
const Number_type radius = 1; std::list<Polygon> inset_polygons;
const double err_bound = 0.00001; boost::timer timer;
std::list<Offset_polygon_2> inset_polygons; approximated_inset_2(P, 1, 0.00001, std::back_inserter(inset_polygons));
std::list<Offset_polygon_2>::iterator iit; double secs = timer.elapsed();
CGAL::Timer timer;
timer.start(); std::list<Polygon>::iterator it;
approximated_inset_2 (P, radius, err_bound, std::cout << "The inset comprises " << inset_polygons.size()
std::back_inserter (inset_polygons)); << " polygon(s)." << std::endl;
timer.stop(); for (it = inset_polygons.begin(); it != inset_polygons.end(); ++it)
std::cout << " Polygon with " << it->size() << " vertices." << std::endl;
std::cout << "The inset comprises " std::cout << "Inset computation took " << secs << " seconds." << std::endl;
<< inset_polygons.size() << " polygon(s)." << std::endl; return 0;
for (iit = inset_polygons.begin(); iit != inset_polygons.end(); ++iit)
{
std::cout << " Polygon with "
<< iit->size() << " vertices." << std::endl;
}
std::cout << "Inset computation took "
<< timer.time() << " seconds." << std::endl;
return (0);
} }

View File

@ -15,7 +15,7 @@ int main(int argc, char* argv[])
{ {
// Open the input file and read a polygon. // Open the input file and read a polygon.
const char* filename = (argc > 1) ? argv[1] : "spiked.dat"; const char* filename = (argc > 1) ? argv[1] : "spiked.dat";
std::ifstream in_file(filename); std::ifstream in_file(filename);
if (! in_file.is_open()) { if (! in_file.is_open()) {
std::cerr << "Failed to open the input file." << std::endl; std::cerr << "Failed to open the input file." << std::endl;
return -1; return -1;

View File

@ -0,0 +1,25 @@
#ifndef ARR_CONICS_H
#define ARR_CONICS_H
#include <CGAL/Cartesian.h>
#include <CGAL/CORE_algebraic_number_traits.h>
#include <CGAL/Arr_conic_traits_2.h>
#include <CGAL/Arrangement_2.h>
typedef CGAL::CORE_algebraic_number_traits Nt_traits;
typedef Nt_traits::Rational Rational;
typedef CGAL::Cartesian<Rational> Rat_kernel;
typedef Rat_kernel::Point_2 Rat_point;
typedef Rat_kernel::Segment_2 Rat_segment;
typedef Rat_kernel::Circle_2 Rat_circle;
typedef Nt_traits::Algebraic Algebraic;
typedef CGAL::Cartesian<Algebraic> Alg_kernel;
typedef CGAL::Arr_conic_traits_2<Rat_kernel, Alg_kernel, Nt_traits>
Traits;
typedef Traits::Point_2 Point;
typedef Traits::Curve_2 Conic_arc;
typedef Traits::X_monotone_curve_2 X_monotone_conic_arc;
typedef CGAL::Arrangement_2<Traits> Arrangement;
#endif

View File

@ -1,80 +1,60 @@
//! \file examples/Minkowski_sum_2/exact_inset.cpp //! \file examples/Minkowski_sum_2/exact_inset.cpp
// Computing the exact inner offset of a polygon. // Computing the exact inner offset of a polygon.
#include <iostream>
#include <CGAL/basic.h> #include <CGAL/basic.h>
#ifndef CGAL_USE_CORE #ifndef CGAL_USE_CORE
#include <iostream> int main()
int main ()
{ {
std::cout << "Sorry, this example needs CORE ..." << std::endl; std::cout << "Sorry, this example needs CORE ..." << std::endl;
return (0); return 0;
} }
#else #else
#include <CGAL/Cartesian.h> #include <fstream>
#include <CGAL/CORE_algebraic_number_traits.h> #include <boost/timer.hpp>
#include <CGAL/Arr_conic_traits_2.h>
#include <CGAL/Gps_traits_2.h>
#include <CGAL/offset_polygon_2.h> #include <CGAL/offset_polygon_2.h>
#include <CGAL/Timer.h>
#include <iostream>
typedef CGAL::CORE_algebraic_number_traits Nt_traits; #include "arr_conics.h"
typedef Nt_traits::Rational Rational;
typedef Nt_traits::Algebraic Algebraic;
struct Rat_kernel : public CGAL::Cartesian<Rational> {}; typedef CGAL::Polygon_2<Rat_kernel> Polygon;
struct Alg_kernel : public CGAL::Cartesian<Algebraic> {}; typedef CGAL::Gps_traits_2<Traits> Gps_traits;
struct Conic_traits_2 : public CGAL::Arr_conic_traits_2<Rat_kernel, typedef Gps_traits::Polygon_2 Offset_polygon;
Alg_kernel,
Nt_traits> {};
typedef CGAL::Polygon_2<Rat_kernel> Polygon_2; int main(int argc, char* argv[])
typedef CGAL::Gps_traits_2<Conic_traits_2> Gps_traits_2;
typedef Gps_traits_2::Polygon_2 Offset_polygon_2;
int main ()
{ {
// Open the input file. // Open the input file and read the input polygon.
std::ifstream in_file ("tight.dat"); const char* filename = (argc > 1) ? argv[1] : "tight.dat";
std::ifstream in_file(filename);
if (! in_file.is_open()) if (! in_file.is_open()) {
{
std::cerr << "Failed to open the input file." << std::endl; std::cerr << "Failed to open the input file." << std::endl;
return (1); return -1;
} }
Polygon P;
// Read the input polygon.
Polygon_2 P;
in_file >> P; in_file >> P;
in_file.close(); in_file.close();
std::cout << "Read an input polygon with " << P.size() << " vertices."
std::cout << "Read an input polygon with " << std::endl;
<< P.size() << " vertices." << std::endl;
// Compute the inner offset of the polygon. // Compute the inner offset of the polygon.
Conic_traits_2 traits; Traits traits;
const Rational radius = 1; std::list<Offset_polygon> inset_polygons;
std::list<Offset_polygon_2> inset_polygons; boost::timer timer;
std::list<Offset_polygon_2>::iterator iit; inset_polygon_2(P, 1, traits, std::back_inserter(inset_polygons));
CGAL::Timer timer; double secs = timer.elapsed();
timer.start(); std::list<Offset_polygon>::iterator it;
inset_polygon_2 (P, radius, traits, std::cout << "The inset comprises "
std::back_inserter (inset_polygons));
timer.stop();
std::cout << "The inset comprises "
<< inset_polygons.size() << " polygon(s)." << std::endl; << inset_polygons.size() << " polygon(s)." << std::endl;
for (iit = inset_polygons.begin(); iit != inset_polygons.end(); ++iit) for (it = inset_polygons.begin(); it != inset_polygons.end(); ++it)
{ std::cout << " Polygon with " << it->size() << " vertices."
std::cout << " Polygon with " << std::endl;
<< iit->size() << " vertices." << std::endl; std::cout << "Inset computation took " << secs << " seconds." << std::endl;
} return 0;
std::cout << "Inset computation took "
<< timer.time() << " seconds." << std::endl;
return (0);
} }
#endif #endif

View File

@ -1,75 +1,56 @@
//! \file examples/Minkowski_sum_2/exact_offset.cpp //! \file examples/Minkowski_sum_2/exact_offset.cpp
// Computing the exact offset of a polygon. // Computing the exact offset of a polygon.
#include <iostream>
#include <CGAL/basic.h> #include <CGAL/basic.h>
#ifndef CGAL_USE_CORE #ifndef CGAL_USE_CORE
#include <iostream> int main()
int main ()
{ {
std::cout << "Sorry, this example needs CORE ..." << std::endl; std::cout << "Sorry, this example needs CORE ..." << std::endl;
return (0); return 0;
} }
#else #else
#include <CGAL/Cartesian.h> #include <fstream>
#include <CGAL/CORE_algebraic_number_traits.h> #include <boost/timer.hpp>
#include <CGAL/Arr_conic_traits_2.h>
#include <CGAL/Gps_traits_2.h>
#include <CGAL/offset_polygon_2.h> #include <CGAL/offset_polygon_2.h>
#include <CGAL/Timer.h>
#include <iostream>
typedef CGAL::CORE_algebraic_number_traits Nt_traits; #include "arr_conics.h"
typedef Nt_traits::Rational Rational;
typedef Nt_traits::Algebraic Algebraic;
struct Rat_kernel : public CGAL::Cartesian<Rational> {}; typedef CGAL::Polygon_2<Rat_kernel> Polygon;
struct Alg_kernel : public CGAL::Cartesian<Algebraic> {}; typedef CGAL::Gps_traits_2<Traits> Gps_traits;
struct Conic_traits_2 : public CGAL::Arr_conic_traits_2<Rat_kernel, typedef Gps_traits::Polygon_with_holes_2 Offset_polygon_with_holes;
Alg_kernel,
Nt_traits> {};
typedef CGAL::Polygon_2<Rat_kernel> Polygon_2; int main(int argc, char* argv[])
typedef CGAL::Gps_traits_2<Conic_traits_2> Gps_traits_2;
typedef Gps_traits_2::Polygon_2 Offset_polygon_2;
typedef Gps_traits_2::Polygon_with_holes_2 Offset_polygon_with_holes_2;
int main ()
{ {
// Open the input file. // Open the input file and read the input polygon.
std::ifstream in_file ("spiked.dat"); const char* filename = (argc > 1) ? argv[1] : "spiked.dat";
std::ifstream in_file(filename);
if (! in_file.is_open()) if (! in_file.is_open()) {
{
std::cerr << "Failed to open the input file." << std::endl; std::cerr << "Failed to open the input file." << std::endl;
return (1); return -1;
} }
Polygon P;
// Read the input polygon.
Polygon_2 P;
in_file >> P; in_file >> P;
in_file.close(); in_file.close();
std::cout << "Read an input polygon with " << P.size() << " vertices."
std::cout << "Read an input polygon with " << std::endl;
<< P.size() << " vertices." << std::endl;
// Compute the offset polygon. // Compute the offset polygon.
Conic_traits_2 traits; Traits traits;
const Rational radius = 5; boost::timer timer;
Offset_polygon_with_holes_2 offset; Offset_polygon_with_holes offset = CGAL::offset_polygon_2(P, 5, traits);
CGAL::Timer timer; double secs = timer.elapsed();
timer.start(); std::cout << "The offset polygon has " << offset.outer_boundary().size()
offset = offset_polygon_2 (P, radius, traits); << " vertices, " << offset.number_of_holes() << " holes."
timer.stop(); << std::endl;
std::cout << "Offset computation took " << secs << " seconds." << std::endl;
std::cout << "The offset polygon has " return 0;
<< offset.outer_boundary().size() << " vertices, "
<< offset.number_of_holes() << " holes." << std::endl;
std::cout << "Offset computation took "
<< timer.time() << " seconds." << std::endl;
return (0);
} }
#endif #endif

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
// Andreas Fabri <Andreas.Fabri@geometryfactory.com> // Andreas Fabri <Andreas.Fabri@geometryfactory.com>
// Laurent Rineau <Laurent.Rineau@geometryfactory.com> // Laurent Rineau <Laurent.Rineau@geometryfactory.com>
// Efi Fogel <efif@post.tau.ac.il> // Efi Fogel <efif@post.tau.ac.il>
@ -52,7 +49,7 @@ protected:
typedef CGAL::Polygon_with_holes_2<Kernel, Container_> Polygon_with_holes_2; typedef CGAL::Polygon_with_holes_2<Kernel, Container_> Polygon_with_holes_2;
private: private:
// Kernel types: // Kernel types:
typedef typename Kernel::Point_2 Point_2; typedef typename Kernel::Point_2 Point_2;
typedef typename Kernel::Line_2 Line_2; typedef typename Kernel::Line_2 Line_2;
@ -70,8 +67,8 @@ private:
protected: protected:
typedef typename Traits_2::Polygon_2 Offset_polygon_2; typedef typename Traits_2::Polygon_2 Offset_polygon_2;
typedef Arr_labeled_traits_2<Traits_2> Labeled_traits_2; typedef Arr_labeled_traits_2<Traits_2> Labeled_traits_2;
typedef typename Labeled_traits_2::X_monotone_curve_2 Labeled_curve_2; typedef typename Labeled_traits_2::X_monotone_curve_2 Labeled_curve_2;
// Data members: // Data members:
@ -92,7 +89,7 @@ public:
_inv_sqrt_eps = static_cast<int> (1.0 / CGAL::sqrt (_eps)); _inv_sqrt_eps = static_cast<int> (1.0 / CGAL::sqrt (_eps));
if (_inv_sqrt_eps <= 0) if (_inv_sqrt_eps <= 0)
_inv_sqrt_eps = 1; _inv_sqrt_eps = 1;
} }
protected: protected:
@ -119,7 +116,7 @@ protected:
Vertex_circulator first, curr, next, prev; Vertex_circulator first, curr, next, prev;
first = pgn.vertices_circulator(); first = pgn.vertices_circulator();
curr = first; curr = first;
next = first; next = first;
prev = first; prev = first;
@ -312,19 +309,19 @@ protected:
// In case of overflow of denom // In case of overflow of denom
numer = 1; numer = 1;
denom = max_int; denom = max_int;
} }
} }
} }
else {// if numer < 0 (overflow) else {// if numer < 0 (overflow)
numer = max_int; numer = max_int;
denom = 1; denom = 1;
} }
app_d = NT (numer) / NT (denom); app_d = NT (numer) / NT (denom);
app_err = sqr_d - CGAL::square (app_d); app_err = sqr_d - CGAL::square (app_d);
while (CGAL::compare (CGAL::abs (app_err), while (CGAL::compare (CGAL::abs (app_err),
err_bound) == CGAL::LARGER || err_bound) == CGAL::LARGER ||
CGAL::compare (app_d, abs_delta_x) != LARGER || CGAL::compare (app_d, abs_delta_x) != LARGER ||
CGAL::compare (app_d, abs_delta_y) != LARGER) CGAL::compare (app_d, abs_delta_y) != LARGER)
@ -452,7 +449,7 @@ protected:
// Compute the line l1 tangent to the circle centered at (x1, y1) // Compute the line l1 tangent to the circle centered at (x1, y1)
// with radius r at the approximated point op1. // with radius r at the approximated point op1.
l1 = f_perp_line (f_line (*curr, op1), op1); l1 = f_perp_line (f_line (*curr, op1), op1);
// Compute the line l2 tangent to the circle centered at (x2, y2) // Compute the line l2 tangent to the circle centered at (x2, y2)
// with radius r at the approximated point op2. // with radius r at the approximated point op2.
l2 = f_perp_line (f_line (*next, op2), op2); l2 = f_perp_line (f_line (*next, op2), op2);
@ -460,7 +457,7 @@ protected:
// Intersect the two lines. The intersection point serves as a common // Intersect the two lines. The intersection point serves as a common
// end point for the two line segments we are about to introduce. // end point for the two line segments we are about to introduce.
obj = f_intersect (l1, l2); obj = f_intersect (l1, l2);
assign_success = CGAL::assign (mid_p, obj); assign_success = CGAL::assign (mid_p, obj);
CGAL_assertion (assign_success); CGAL_assertion (assign_success);
CGAL_USE(assign_success); CGAL_USE(assign_success);
@ -508,7 +505,7 @@ protected:
} }
if (res1 != res2) orient = CGAL::LEFT_TURN; if (res1 != res2) orient = CGAL::LEFT_TURN;
} }
// Connect the offset target point of the previous edge to the // Connect the offset target point of the previous edge to the
// offset source of the current edge. // offset source of the current edge.
if (orient == CGAL::LEFT_TURN) { if (orient == CGAL::LEFT_TURN) {
@ -557,12 +554,12 @@ protected:
*oi++ = Labeled_curve_2 (seg2, X_curve_label (dir_right2, *oi++ = Labeled_curve_2 (seg2, X_curve_label (dir_right2,
cycle_id, curve_index++)); cycle_id, curve_index++));
} }
// Proceed to the next polygon vertex. // Proceed to the next polygon vertex.
prev_op = op2; prev_op = op2;
prev = curr; prev = curr;
curr = next; curr = next;
} while (curr != first); } while (curr != first);
// Close the convolution cycle by creating the final circular arc, // Close the convolution cycle by creating the final circular arc,
@ -582,7 +579,7 @@ protected:
assign_success = CGAL::assign (xarc, *xobj_it); assign_success = CGAL::assign (xarc, *xobj_it);
CGAL_assertion (assign_success); CGAL_assertion (assign_success);
CGAL_USE(assign_success); CGAL_USE(assign_success);
++xobj_it; ++xobj_it;
bool is_last = (xobj_it == xobjs.end()); bool is_last = (xobj_it == xobjs.end());

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_ARR_LABELED_TRAITS_2_H #ifndef CGAL_ARR_LABELED_TRAITS_2_H
#define CGAL_ARR_LABELED_TRAITS_2_H #define CGAL_ARR_LABELED_TRAITS_2_H
@ -29,7 +26,7 @@ namespace CGAL {
* A meta-traits class that adds lables to points and to x-monotone curves, * A meta-traits class that adds lables to points and to x-monotone curves,
* such that the comparison of two points, as well as the computation of the * such that the comparison of two points, as well as the computation of the
* intersections between two segments can be easily filtered. * intersections between two segments can be easily filtered.
*/ */
template <class Traits_> template <class Traits_>
class Arr_labeled_traits_2 : public Traits_ class Arr_labeled_traits_2 : public Traits_
{ {
@ -97,7 +94,7 @@ public:
{} {}
/*! Constructor from an x-monotone curve an a label. */ /*! Constructor from an x-monotone curve an a label. */
X_monotone_curve_2 (const Base_x_monotone_curve_2& p, X_monotone_curve_2 (const Base_x_monotone_curve_2& p,
const X_curve_label& label) : const X_curve_label& label) :
Base_x_monotone_curve_2 (p), Base_x_monotone_curve_2 (p),
_label (label) _label (label)
@ -133,7 +130,7 @@ public:
// Inherited functors: // Inherited functors:
typedef typename Base_traits_2::Is_vertical_2 Is_vertical_2; typedef typename Base_traits_2::Is_vertical_2 Is_vertical_2;
typedef typename Base_traits_2::Compare_y_at_x_2 Compare_y_at_x_2; typedef typename Base_traits_2::Compare_y_at_x_2 Compare_y_at_x_2;
typedef typename Base_traits_2::Compare_y_at_x_right_2 typedef typename Base_traits_2::Compare_y_at_x_right_2
Compare_y_at_x_right_2; Compare_y_at_x_right_2;
typedef typename Base_traits_2::Equal_2 Equal_2; typedef typename Base_traits_2::Equal_2 Equal_2;
@ -235,7 +232,7 @@ public:
else if (cv.label().right_count() == 0 && cv.label().left_count() == 1) else if (cv.label().right_count() == 0 && cv.label().left_count() == 1)
{ {
// A curve directed from right to left: // A curve directed from right to left:
Point_label label (cv.label().component(), Point_label label (cv.label().component(),
cv.label().is_last() ? 0 : cv.label().index()+1); cv.label().is_last() ? 0 : cv.label().index()+1);
return (Point_2 (pt, label)); return (Point_2 (pt, label));
@ -370,7 +367,7 @@ public:
std::list<CGAL::Object> base_objs; std::list<CGAL::Object> base_objs;
base->intersect_2_object() (cv1, cv2, std::back_inserter (base_objs)); base->intersect_2_object() (cv1, cv2, std::back_inserter (base_objs));
if (base_objs.empty()) if (base_objs.empty())
return (oi); return (oi);
@ -387,7 +384,7 @@ public:
if (base_pt != NULL) if (base_pt != NULL)
{ {
// Attach an invalid label to an itersection point. // Attach an invalid label to an itersection point.
*oi = CGAL::make_object *oi = CGAL::make_object
(std::make_pair (Point_2 (base_pt->first), base_pt->second)); (std::make_pair (Point_2 (base_pt->first), base_pt->second));
++oi; ++oi;
} }
@ -397,8 +394,8 @@ public:
CGAL_assertion (base_xcv != NULL); CGAL_assertion (base_xcv != NULL);
// Attach a merged label to the overlapping curve. // Attach a merged label to the overlapping curve.
*oi = CGAL::make_object *oi = CGAL::make_object
(X_monotone_curve_2 (*base_xcv, (X_monotone_curve_2 (*base_xcv,
X_curve_label (cv1.label(), cv2.label()))); X_curve_label (cv1.label(), cv2.label())));
++oi; ++oi;
} }

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efifogel@gmail.com> // Efi Fogel <efifogel@gmail.com>
#ifndef CGAL_POLYGON_DECOMPOSITION_STRATEGY_ADAPTER_H #ifndef CGAL_POLYGON_DECOMPOSITION_STRATEGY_ADAPTER_H

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_EXACT_OFFSET_BASE_H #ifndef CGAL_EXACT_OFFSET_BASE_H
#define CGAL_EXACT_OFFSET_BASE_H #define CGAL_EXACT_OFFSET_BASE_H
@ -37,9 +34,9 @@ template <class Traits_, class Container_>
class Exact_offset_base_2 class Exact_offset_base_2
{ {
private: private:
typedef Traits_ Traits_2; typedef Traits_ Traits_2;
// Rational kernel types: // Rational kernel types:
typedef typename Traits_2::Rat_kernel Rat_kernel; typedef typename Traits_2::Rat_kernel Rat_kernel;
typedef typename Rat_kernel::FT Rational; typedef typename Rat_kernel::FT Rational;
@ -66,14 +63,14 @@ private:
typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2; typedef typename Traits_2::X_monotone_curve_2 X_monotone_curve_2;
typedef CGAL::Gps_traits_2<Traits_2> Gps_traits_2; typedef CGAL::Gps_traits_2<Traits_2> Gps_traits_2;
protected: protected:
typedef CGAL::Polygon_2<Rat_kernel, Container_> Polygon_2; typedef CGAL::Polygon_2<Rat_kernel, Container_> Polygon_2;
typedef CGAL::Polygon_with_holes_2<Rat_kernel, typedef CGAL::Polygon_with_holes_2<Rat_kernel,
Container_> Polygon_with_holes_2; Container_> Polygon_with_holes_2;
typedef typename Gps_traits_2::Polygon_2 Offset_polygon_2; typedef typename Gps_traits_2::Polygon_2 Offset_polygon_2;
private: private:
// Polygon-related types: // Polygon-related types:
@ -81,7 +78,7 @@ private:
protected: protected:
typedef Arr_labeled_traits_2<Traits_2> Labeled_traits_2; typedef Arr_labeled_traits_2<Traits_2> Labeled_traits_2;
typedef typename Labeled_traits_2::X_monotone_curve_2 Labeled_curve_2; typedef typename Labeled_traits_2::X_monotone_curve_2 Labeled_curve_2;
@ -89,7 +86,7 @@ public:
/*! Default constructor. */ /*! Default constructor. */
Exact_offset_base_2 () Exact_offset_base_2 ()
{} {}
protected: protected:
@ -114,9 +111,9 @@ protected:
// Prepare circulators over the polygon vertices. // Prepare circulators over the polygon vertices.
const bool forward = (pgn.orientation() == orient); const bool forward = (pgn.orientation() == orient);
Vertex_circulator first, curr, next; Vertex_circulator first, curr, next;
first = pgn.vertices_circulator(); first = pgn.vertices_circulator();
curr = first; curr = first;
next = first; next = first;
// Traverse the polygon vertices and edges and construct the arcs that // Traverse the polygon vertices and edges and construct the arcs that
@ -163,7 +160,7 @@ protected:
delta_x = x2 - x1; delta_x = x2 - x1;
delta_y = y2 - y1; delta_y = y2 - y1;
len = nt_traits.sqrt (nt_traits.convert (CGAL::square (delta_x) + len = nt_traits.sqrt (nt_traits.convert (CGAL::square (delta_x) +
CGAL::square (delta_y))); CGAL::square (delta_y)));
// The angle theta between the vector v and the x-axis is given by: // The angle theta between the vector v and the x-axis is given by:
@ -184,7 +181,7 @@ protected:
// Construct the first offset vertex, which corresponds to the // Construct the first offset vertex, which corresponds to the
// source vertex of the current polygon edge. // source vertex of the current polygon edge.
op1 = Alg_point_2 (nt_traits.convert (x1) + trans_x, op1 = Alg_point_2 (nt_traits.convert (x1) + trans_x,
nt_traits.convert (y1) + trans_y); nt_traits.convert (y1) + trans_y);
if (curr == first) if (curr == first)
@ -201,12 +198,12 @@ protected:
arc = Curve_2 (Rat_circle_2 (*curr, sqr_r), arc = Curve_2 (Rat_circle_2 (*curr, sqr_r),
CGAL::COUNTERCLOCKWISE, CGAL::COUNTERCLOCKWISE,
op2, op1); op2, op1);
// Subdivide the arc into x-monotone subarcs and append them to the // Subdivide the arc into x-monotone subarcs and append them to the
// convolution cycle. // convolution cycle.
xobjs.clear(); xobjs.clear();
f_make_x_monotone (arc, std::back_inserter(xobjs)); f_make_x_monotone (arc, std::back_inserter(xobjs));
for (xobj_it = xobjs.begin(); xobj_it != xobjs.end(); ++xobj_it) for (xobj_it = xobjs.begin(); xobj_it != xobjs.end(); ++xobj_it)
{ {
assign_success = CGAL::assign (xarc, *xobj_it); assign_success = CGAL::assign (xarc, *xobj_it);
@ -225,7 +222,7 @@ protected:
// Construct the second offset vertex, which corresponds to the // Construct the second offset vertex, which corresponds to the
// target vertex of the current polygon edge. // target vertex of the current polygon edge.
op2 = Alg_point_2 (nt_traits.convert (x2) + trans_x, op2 = Alg_point_2 (nt_traits.convert (x2) + trans_x,
nt_traits.convert (y2) + trans_y); nt_traits.convert (y2) + trans_y);
// The equation of the line connecting op1 and op2 is given by: // The equation of the line connecting op1 and op2 is given by:
@ -248,7 +245,7 @@ protected:
// Proceed to the next polygon vertex. // Proceed to the next polygon vertex.
curr = next; curr = next;
} while (curr != first); } while (curr != first);
if (! f_equal (op2, first_op)) if (! f_equal (op2, first_op))
@ -258,21 +255,21 @@ protected:
arc = Curve_2 (Rat_circle_2 (*first, sqr_r), arc = Curve_2 (Rat_circle_2 (*first, sqr_r),
CGAL::COUNTERCLOCKWISE, CGAL::COUNTERCLOCKWISE,
op2, first_op); op2, first_op);
// Subdivide the arc into x-monotone subarcs and append them to the // Subdivide the arc into x-monotone subarcs and append them to the
// convolution cycle. // convolution cycle.
bool is_last; bool is_last;
xobjs.clear(); xobjs.clear();
f_make_x_monotone (arc, std::back_inserter(xobjs)); f_make_x_monotone (arc, std::back_inserter(xobjs));
xobj_it = xobjs.begin(); xobj_it = xobjs.begin();
while (xobj_it != xobjs.end()) while (xobj_it != xobjs.end())
{ {
assign_success = CGAL::assign (xarc, *xobj_it); assign_success = CGAL::assign (xarc, *xobj_it);
CGAL_assertion (assign_success); CGAL_assertion (assign_success);
CGAL_USE(assign_success); CGAL_USE(assign_success);
++xobj_it; ++xobj_it;
is_last = (xobj_it == xobjs.end()); is_last = (xobj_it == xobjs.end());

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_MINKOWSKI_SUM_LABELS_H #ifndef CGAL_MINKOWSKI_SUM_LABELS_H
#define CGAL_MINKOWSKI_SUM_LABELS_H #define CGAL_MINKOWSKI_SUM_LABELS_H
@ -46,7 +43,7 @@ public:
* \param component The index of the component. * \param component The index of the component.
* \param index Index of the point within the component. * \param index Index of the point within the component.
*/ */
Point_label (unsigned int component, Point_label (unsigned int component,
unsigned int index) : unsigned int index) :
_component (component), _component (component),
_index (index) _index (index)
@ -86,7 +83,7 @@ public:
void set_component (unsigned int component) void set_component (unsigned int component)
{ {
CGAL_precondition (component != 0); CGAL_precondition (component != 0);
_component = component; _component = component;
return; return;
} }
@ -134,7 +131,7 @@ public:
* \param is_last Is this the last curve of the component. * \param is_last Is this the last curve of the component.
*/ */
X_curve_label (bool is_directed_right, X_curve_label (bool is_directed_right,
unsigned int component, unsigned int component,
unsigned int index, unsigned int index,
bool is_last = false) : bool is_last = false) :
_component (component), _component (component),
@ -252,13 +249,13 @@ public:
void set_component (unsigned int component) void set_component (unsigned int component)
{ {
CGAL_precondition (component != 0); CGAL_precondition (component != 0);
_component = component; _component = component;
return; return;
} }
/*! /*!
* Set the curve index within the component. * Set the curve index within the component.
* \param index The index in the component. * \param index The index in the component.
* \param is_last Is this the last curve of the component. * \param is_last Is this the last curve of the component.
*/ */

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efifogel@gmail.com> // Efi Fogel <efifogel@gmail.com>
#ifndef CGAL_MINKOWSKI_SUM_CONV_H #ifndef CGAL_MINKOWSKI_SUM_CONV_H

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_MINKOWSKI_SUM_DECOMP_2_H #ifndef CGAL_MINKOWSKI_SUM_DECOMP_2_H
#define CGAL_MINKOWSKI_SUM_DECOMP_2_H #define CGAL_MINKOWSKI_SUM_DECOMP_2_H

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_OFFSET_CONV_H #ifndef CGAL_OFFSET_CONV_H
#define CGAL_OFFSET_CONV_H #define CGAL_OFFSET_CONV_H
@ -43,10 +40,10 @@ public:
typedef typename Base::Polygon_2 Polygon_2; typedef typename Base::Polygon_2 Polygon_2;
typedef typename Base::Polygon_with_holes_2 Polygon_with_holes_2; typedef typename Base::Polygon_with_holes_2 Polygon_with_holes_2;
typedef typename Base::Offset_polygon_2 Offset_polygon_2; typedef typename Base::Offset_polygon_2 Offset_polygon_2;
private: private:
typedef typename Base::Labeled_traits_2 Labeled_traits_2; typedef typename Base::Labeled_traits_2 Labeled_traits_2;
typedef typename Base::Labeled_curve_2 Labeled_curve_2; typedef typename Base::Labeled_curve_2 Labeled_curve_2;
typedef std::list<Labeled_curve_2> Curves_list; typedef std::list<Labeled_curve_2> Curves_list;
@ -59,11 +56,11 @@ public:
/*! Constructor. */ /*! Constructor. */
Offset_by_convolution_2 (const Base_& base) : Offset_by_convolution_2 (const Base_& base) :
Base (base) Base (base)
{} {}
/*! /*!
* Compute the offset of a simple polygon by a given radius. * Compute the offset of a simple polygon by a given radius.
* Note that as the input polygon may not be convex, its offset may not be * Note that as the input polygon may not be convex, its offset may not be
* simply connected. The result is therefore represented as the outer * simply connected. The result is therefore represented as the outer
* boundary of the Minkowski sum (which is always a simple offset polygon) * boundary of the Minkowski sum (which is always a simple offset polygon)
* and a container of offset polygons, representing the holes in this "outer" * and a container of offset polygons, representing the holes in this "outer"
@ -126,7 +123,7 @@ public:
// that forms the outer boundary. // that forms the outer boundary.
Curves_list cycle; Curves_list cycle;
unsigned int cycle_id = 1; unsigned int cycle_id = 1;
_offset_polygon (pwh.outer_boundary(), _offset_polygon (pwh.outer_boundary(),
CGAL::COUNTERCLOCKWISE, CGAL::COUNTERCLOCKWISE,
r, r,
@ -159,7 +156,7 @@ public:
/*! /*!
* Compute the inset of a simple polygon by a given radius. * Compute the inset of a simple polygon by a given radius.
* Note that as the input polygon may not be convex, its offset may not be * Note that as the input polygon may not be convex, its offset may not be
* simply connected. The result is therefore represented as a sequence of * simply connected. The result is therefore represented as a sequence of
* polygons (which may also be empty). * polygons (which may also be empty).
* \param pgn The polygon. * \param pgn The polygon.

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_OFFSET_DECOMP_H #ifndef CGAL_OFFSET_DECOMP_H
#define CGAL_OFFSET_DECOMP_H #define CGAL_OFFSET_DECOMP_H
@ -43,16 +40,16 @@ public:
typedef typename Base::Basic_kernel Kernel; typedef typename Base::Basic_kernel Kernel;
typedef typename Base::Basic_NT NT; typedef typename Base::Basic_NT NT;
typedef typename Base::Polygon_2 Polygon_2; typedef typename Base::Polygon_2 Polygon_2;
typedef typename Base::Offset_polygon_2 Offset_polygon_2; typedef typename Base::Offset_polygon_2 Offset_polygon_2;
typedef DecompStrategy_ Decomposition_strategy; typedef DecompStrategy_ Decomposition_strategy;
private: private:
typedef std::list<Polygon_2> Polygons_list; typedef std::list<Polygon_2> Polygons_list;
typedef typename Polygons_list::iterator Polygons_iterator; typedef typename Polygons_list::iterator Polygons_iterator;
typedef typename Base::Labeled_traits_2 Labeled_traits_2; typedef typename Base::Labeled_traits_2 Labeled_traits_2;
typedef typename Base::Labeled_curve_2 Labeled_curve_2; typedef typename Base::Labeled_curve_2 Labeled_curve_2;
typedef std::list<Labeled_curve_2> Curves_list; typedef std::list<Labeled_curve_2> Curves_list;
@ -64,16 +61,16 @@ public:
/*! Constructor. */ /*! Constructor. */
Offset_by_decomposition_2 (const Base_& base) : Offset_by_decomposition_2 (const Base_& base) :
Base (base) Base (base)
{} {}
/*! /*!
* Compute the offset of a simple polygon by a given radius. * Compute the offset of a simple polygon by a given radius.
* Note that as the input polygon may not be convex, its offset may not be * Note that as the input polygon may not be convex, its offset may not be
* simply connected. The result is therefore represented as the outer * simply connected. The result is therefore represented as the outer
* boundary of the Minkowski sum (which is always a simple offset polygon) * boundary of the Minkowski sum (which is always a simple offset polygon)
* and a container of offset polygons, representing the holes in this "outer" * and a container of offset polygons, representing the holes in this "outer"
* polygon. * polygon.
* \param traits Arrangement traits that can deal with line segments and * \param traits Arrangement traits that can deal with line segments and
* circular arcs. * circular arcs.
* \param pgn The polygon. * \param pgn The polygon.
* \param r The offset radius. * \param r The offset radius.

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_DECOMPOSITION_STRATEGY_ADAPTER_H #ifndef CGAL_DECOMPOSITION_STRATEGY_ADAPTER_H
#define CGAL_DECOMPOSITION_STRATEGY_ADAPTER_H #define CGAL_DECOMPOSITION_STRATEGY_ADAPTER_H
@ -48,7 +45,7 @@ template <class Kernel_, class Container_, class StrategyTag_>
class Decomposition_strategy_adapter class Decomposition_strategy_adapter
{ {
public: public:
typedef Kernel_ Kernel; typedef Kernel_ Kernel;
typedef Polygon_2<Kernel, Container_> Polygon_2; typedef Polygon_2<Kernel, Container_> Polygon_2;
typedef StrategyTag_ Strategy_tag; typedef StrategyTag_ Strategy_tag;

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_UNION_OF_CURVE_CYCLES_2_H #ifndef CGAL_UNION_OF_CURVE_CYCLES_2_H
#define CGAL_UNION_OF_CURVE_CYCLES_2_H #define CGAL_UNION_OF_CURVE_CYCLES_2_H
@ -151,7 +148,7 @@ public:
return (temp); return (temp);
} }
}; };
/*! Default constructor. */ /*! Default constructor. */
@ -179,7 +176,7 @@ public:
this->_construct_arrangement (begin, end, arr); this->_construct_arrangement (begin, end, arr);
// Produce the result. First set the outer boundary of the union, given // Produce the result. First set the outer boundary of the union, given
// as the inner boundary of the single hole in the unbounded face. // as the inner boundary of the single hole in the unbounded face.
Face_iterator fit; Face_iterator fit;
const Face_handle uf = arr.unbounded_face(); const Face_handle uf = arr.unbounded_face();
Inner_ccb_iterator iccb_it = uf->inner_ccbs_begin(); Inner_ccb_iterator iccb_it = uf->inner_ccbs_begin();
@ -193,7 +190,7 @@ public:
for (fit = arr.faces_begin(); fit != arr.faces_end(); ++fit) for (fit = arr.faces_begin(); fit != arr.faces_end(); ++fit)
{ {
CGAL_assertion (fit->data() != this->UNVISITED); CGAL_assertion (fit->data() != this->UNVISITED);
// If a bounded face has an inside count that equals 0, it forms a hole // If a bounded face has an inside count that equals 0, it forms a hole
// in the union. // in the union.
if (! fit->is_unbounded() && fit->data() == 0) if (! fit->is_unbounded() && fit->data() == 0)

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_UNION_OF_CYCLES_2_H #ifndef CGAL_UNION_OF_CYCLES_2_H
#define CGAL_UNION_OF_CYCLES_2_H #define CGAL_UNION_OF_CYCLES_2_H
@ -111,7 +108,7 @@ protected:
{ {
he = circ; he = circ;
f_next = he->twin()->face(); f_next = he->twin()->face();
if (f_next->data() == UNVISITED) if (f_next->data() == UNVISITED)
{ {
next_count = _boundary_count (he->twin()); next_count = _boundary_count (he->twin());
@ -124,9 +121,9 @@ protected:
} }
++circ; ++circ;
} while (circ != first); } while (circ != first);
++iccb_it; ++iccb_it;
// Make sure that there is a single hole in the unbounded face. // Make sure that there is a single hole in the unbounded face.
@ -158,11 +155,11 @@ protected:
} }
else if (f_curr != f_next) else if (f_curr != f_next)
{ {
CGAL_assertion (f_next->data() == CGAL_assertion (f_next->data() ==
curr_count + _boundary_count (he->twin())); curr_count + _boundary_count (he->twin()));
} }
++circ; ++circ;
} while (circ != first); } while (circ != first);
// Go over the holes (inner CCBs) of the current face. // Go over the holes (inner CCBs) of the current face.
@ -184,7 +181,7 @@ protected:
} }
else if (f_curr != f_next) else if (f_curr != f_next)
{ {
CGAL_assertion (f_next->data() == CGAL_assertion (f_next->data() ==
curr_count + _boundary_count (he->twin())); curr_count + _boundary_count (he->twin()));
} }
++circ; ++circ;
@ -192,7 +189,7 @@ protected:
} while (circ != first); } while (circ != first);
} }
} }
return; return;
} }
@ -208,13 +205,13 @@ private:
if ((Arr_halfedge_direction) he->direction() == ARR_LEFT_TO_RIGHT) if ((Arr_halfedge_direction) he->direction() == ARR_LEFT_TO_RIGHT)
{ {
// Halfedge is directed from left to right: // Halfedge is directed from left to right:
return (he->curve().label().right_count() - return (he->curve().label().right_count() -
he->curve().label().left_count()); he->curve().label().left_count());
} }
else else
{ {
// Halfedge is directed from right to left: // Halfedge is directed from right to left:
return (he->curve().label().left_count() - return (he->curve().label().left_count() -
he->curve().label().right_count()); he->curve().label().right_count());
} }
} }

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_UNION_OF_SEGMENT_CYCLES_2_H #ifndef CGAL_UNION_OF_SEGMENT_CYCLES_2_H
#define CGAL_UNION_OF_SEGMENT_CYCLES_2_H #define CGAL_UNION_OF_SEGMENT_CYCLES_2_H
@ -82,13 +79,13 @@ public:
this->_construct_arrangement (begin, end, arr); this->_construct_arrangement (begin, end, arr);
// Produce the result. First set the outer boundary of the union, given // Produce the result. First set the outer boundary of the union, given
// as the inner boundary of the single hole in the unbounded face. // as the inner boundary of the single hole in the unbounded face.
Face_iterator fit; Face_iterator fit;
const Face_handle uf = arr.unbounded_face(); const Face_handle uf = arr.unbounded_face();
Inner_ccb_iterator iccb_it = uf->inner_ccbs_begin(); Inner_ccb_iterator iccb_it = uf->inner_ccbs_begin();
Ccb_halfedge_circulator first, circ; Ccb_halfedge_circulator first, circ;
Halfedge_handle he; Halfedge_handle he;
out_bound.erase (out_bound.vertices_begin(), out_bound.vertices_end()); out_bound.erase (out_bound.vertices_begin(), out_bound.vertices_end());
circ = first = *iccb_it; circ = first = *iccb_it;
@ -96,7 +93,7 @@ public:
{ {
out_bound.push_back (circ->source()->point()); out_bound.push_back (circ->source()->point());
--circ; --circ;
} while (circ != first); } while (circ != first);
++iccb_it; ++iccb_it;
@ -104,19 +101,19 @@ public:
for (fit = arr.faces_begin(); fit != arr.faces_end(); ++fit) for (fit = arr.faces_begin(); fit != arr.faces_end(); ++fit)
{ {
CGAL_assertion (fit->data() != this->UNVISITED); CGAL_assertion (fit->data() != this->UNVISITED);
// If a bounded face has an inside count that equals 0, it forms a hole // If a bounded face has an inside count that equals 0, it forms a hole
// in the union. // in the union.
if (! fit->is_unbounded() && fit->data() == 0) if (! fit->is_unbounded() && fit->data() == 0)
{ {
Polygon_2 pgn_hole; Polygon_2 pgn_hole;
circ = first = fit->outer_ccb(); circ = first = fit->outer_ccb();
do do
{ {
pgn_hole.push_back (circ->source()->point()); pgn_hole.push_back (circ->source()->point());
--circ; --circ;
} while (circ != first); } while (circ != first);
// Insert it to the containers of holes in the Minkowski sum. // Insert it to the containers of holes in the Minkowski sum.

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_POLYGON_CONVEX_DECOMPOSITION_H #ifndef CGAL_POLYGON_CONVEX_DECOMPOSITION_H
#define CGAL_POLYGON_CONVEX_DECOMPOSITION_H #define CGAL_POLYGON_CONVEX_DECOMPOSITION_H

View File

@ -12,9 +12,6 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$
// $Id$
//
// Author(s) : Efi Fogel <efifogel@gmail.com> // Author(s) : Efi Fogel <efifogel@gmail.com>
#ifndef CGAL_POLYGON_VERTICAL_DECOMPOSITION_2_H #ifndef CGAL_POLYGON_VERTICAL_DECOMPOSITION_2_H

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
// (based on an old version by Eyal Flato) // (based on an old version by Eyal Flato)
// Efi Fogel <efifogel@gmail.com> // Efi Fogel <efifogel@gmail.com>

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_APPROXIMATED_OFFSET_H #ifndef CGAL_APPROXIMATED_OFFSET_H
#define CGAL_APPROXIMATED_OFFSET_H #define CGAL_APPROXIMATED_OFFSET_H
@ -29,7 +26,7 @@ namespace CGAL {
/*! /*!
* Approximate the offset of a given simple polygon by a given radius, * Approximate the offset of a given simple polygon by a given radius,
* using the convolution method. * using the convolution method.
* Note that as the input polygon may not be convex, its offset may not be * Note that as the input polygon may not be convex, its offset may not be
* simply connected. The result is therefore represented as a polygon with * simply connected. The result is therefore represented as a polygon with
* holes. * holes.
* \param pgn The polygon. * \param pgn The polygon.
@ -96,7 +93,7 @@ approximated_offset_2 (const Polygon_with_holes_2<Kernel, Container>& pwh,
* Approximate the offset of a given simple polygon by a given radius, * Approximate the offset of a given simple polygon by a given radius,
* by decomposing it to convex sub-polygons and computing the union of their * by decomposing it to convex sub-polygons and computing the union of their
* offsets. * offsets.
* Note that as the input polygon may not be convex, its offset may not be * Note that as the input polygon may not be convex, its offset may not be
* simply connected. The result is therefore represented as a polygon with * simply connected. The result is therefore represented as a polygon with
* holes. * holes.
* \param pgn The polygon. * \param pgn The polygon.
@ -132,7 +129,7 @@ approximated_offset_2 (const Polygon_2<Kernel, Container>& pgn,
/*! /*!
* Approximate the inset of a given simple polygon by a given radius, using * Approximate the inset of a given simple polygon by a given radius, using
* the convolution method. * the convolution method.
* Note that as the input polygon may not be convex, its inset may not be * Note that as the input polygon may not be convex, its inset may not be
* simply connected. The result is therefore represented as a set of polygons. * simply connected. The result is therefore represented as a set of polygons.
* \param pgn The polygon. * \param pgn The polygon.
* \param r The inset radius. * \param r The inset radius.

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
// Efi Fogel <efifogel@gmail.com> // Efi Fogel <efifogel@gmail.com>
#ifndef CGAL_MINKOWSKI_SUM_2_H #ifndef CGAL_MINKOWSKI_SUM_2_H

View File

@ -12,10 +12,7 @@
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
// //
// $URL$ // Author(s) : Ron Wein <wein_r@yahoo.com>
// $Id$
//
// Author(s) : Ron Wein <wein@post.tau.ac.il>
#ifndef CGAL_OFFSET_POLYGON_H #ifndef CGAL_OFFSET_POLYGON_H
#define CGAL_OFFSET_POLYGON_H #define CGAL_OFFSET_POLYGON_H
@ -29,7 +26,7 @@ namespace CGAL {
/*! /*!
* Compute the offset of a given simple polygon by a given radius, * Compute the offset of a given simple polygon by a given radius,
* using the convolution method. * using the convolution method.
* Note that as the input polygon may not be convex, its offset may not be * Note that as the input polygon may not be convex, its offset may not be
* simply connected. The result is therefore represented as a polygon with * simply connected. The result is therefore represented as a polygon with
* holes. * holes.
* \param pgn The polygon. * \param pgn The polygon.
@ -52,7 +49,7 @@ offset_polygon_2 (const Polygon_2<typename ConicTraits::Rat_kernel,
Offset_polygon_2 offset_bound; Offset_polygon_2 offset_bound;
std::list<Offset_polygon_2> offset_holes; std::list<Offset_polygon_2> offset_holes;
exact_offset (pgn, r, exact_offset (pgn, r,
offset_bound, std::back_inserter(offset_holes)); offset_bound, std::back_inserter(offset_holes));
return (typename Gps_traits_2<ConicTraits>::Polygon_with_holes_2 return (typename Gps_traits_2<ConicTraits>::Polygon_with_holes_2
@ -85,7 +82,7 @@ offset_polygon_2 (const Polygon_with_holes_2<typename ConicTraits::Rat_kernel,
Offset_polygon_2 offset_bound; Offset_polygon_2 offset_bound;
std::list<Offset_polygon_2> offset_holes; std::list<Offset_polygon_2> offset_holes;
exact_offset (pwh, r, exact_offset (pwh, r,
offset_bound, std::back_inserter(offset_holes)); offset_bound, std::back_inserter(offset_holes));
return (typename Gps_traits_2<ConicTraits>::Polygon_with_holes_2 return (typename Gps_traits_2<ConicTraits>::Polygon_with_holes_2
@ -96,7 +93,7 @@ offset_polygon_2 (const Polygon_with_holes_2<typename ConicTraits::Rat_kernel,
* Compute the offset of a given simple polygon by a given radius, * Compute the offset of a given simple polygon by a given radius,
* by decomposing it to convex sub-polygons and computing the union of their * by decomposing it to convex sub-polygons and computing the union of their
* offsets. * offsets.
* Note that as the input polygon may not be convex, its offset may not be * Note that as the input polygon may not be convex, its offset may not be
* simply connected. The result is therefore represented as a polygon with * simply connected. The result is therefore represented as a polygon with
* holes. * holes.
* \param pgn The polygon. * \param pgn The polygon.
@ -132,7 +129,7 @@ offset_polygon_2 (const Polygon_2<typename ConicTraits::Rat_kernel,
/*! /*!
* Compute the inset of a given simple polygon by a given radius, using the * Compute the inset of a given simple polygon by a given radius, using the
* convolution method. * convolution method.
* Note that as the input polygon may not be convex, its inset may not be * Note that as the input polygon may not be convex, its inset may not be
* simply connected. The result is therefore represented as a set of polygons. * simply connected. The result is therefore represented as a set of polygons.
* \param pgn The polygon. * \param pgn The polygon.
* \param r The inset radius. * \param r The inset radius.

View File

@ -1,2 +1 @@
Ron Wein <wein@post.tau.ac.il>
Efi Fogel <efif@post.tau.ac.il> Efi Fogel <efif@post.tau.ac.il>