CGAL 4.6.2 - 2D Minkowski Sums
|
This package consist of functions for computing the Minkowksi sum of two polygons in the plane. Namely, given two polygons \( P,Q \in \mathbb{R}^2\) it computes \( P \oplus Q = \left\{ p + q ~|~ p \in P, q \in Q \right\}\).
In addition, the package also includes functions for offsetting a polygon, namely computing its Minkowski sum with a disc of a given radius, and for insetting a polygon (namely computing its inner offset). It is possible to compute the exact representation of the offset (or the inset), or to approximate it with guaranteed error bounds, in order to speed up the computation time.
CGAL::minkowski_sum_2()
CGAL::approximated_offset_2()
CGAL::approximated_inset_2()
CGAL::offset_polygon_2()
CGAL::inset_polygon_2()
CGAL::Small_side_angle_bisector_decomposition_2<Kernel,Container>
CGAL::Optimal_convex_decomposition_2<Kernel,Container>
CGAL::Hertel_Mehlhorn_convex_decomposition_2<Kernel,Container>
CGAL::Greene_convex_decomposition_2<Kernel,Container>
Modules | |
Concepts | |
Functions | |
template<class Kernel , class Container , class OutputIterator > | |
OutputIterator | CGAL::approximated_inset_2 (const Polygon_2< Kernel, Container > &pgn, const typename Kernel::FT &r, const double &eps, OutputIterator oi) |
Provides a guaranteed approximation of the inset, or inner offset, of the given polygon P by a given radius r . More... | |
template<class Kernel , class Container > | |
Gps_circle_segment_traits_2 < Kernel > ::Polygon_with_holes_2 | CGAL::approximated_offset_2 (const Polygon_2< Kernel, Container > &P, const typename Kernel::FT &r, const double &eps) |
Provides a guaranteed approximation of the offset of the given polygon P by a given radius r - namely, the function computes the Minkowski sum \( P \oplus B_r\), where \( B_r\) is a disc of radius r centered at the origin. More... | |
template<class Kernel , class Container > | |
Gps_circle_segment_traits_2 < Kernel > ::Polygon_with_holes_2 | CGAL::approximated_offset_2 (const Polygon_with_holes_2< Kernel, Container > &wh, const typename Kernel::FT &r, const double &eps) |
Provides a guaranteed approximation of offset the given polygon with holes pwh by a given radius r , such that the approximation error is bounded by eps . More... | |
template<class Kernel , class Container , class DecompositionStrategy > | |
Gps_circle_segment_traits_2 < Kernel > ::Polygon_with_holes_2 | CGAL::approximated_offset_2 (const Polygon_2< Kernel, Container > &P, const typename Kernel::FT &r, const double &eps, const DecompositionStrategy &decomp) |
Provides a guaranteed approximation of the offset of the given polygon P by a radius r , as described above. More... | |
template<class Kernel , class Container > | |
Polygon_with_holes_2< Kernel, Container > | CGAL::minkowski_sum_2 (const Polygon_2< Kernel, Container > &P, const Polygon_2< Kernel, Container > &Q) |
Computes the Minkowski sum \( P \oplus Q\) of the two given polygons. More... | |
template<class Kernel , class Container , class DecompositionStrategy > | |
Polygon_with_holes_2< Kernel, Container > | CGAL::minkowski_sum_2 (const Polygon_2< Kernel, Container > &P, const Polygon_2< Kernel, Container > &Q, const DecompositionStrategy &decomp) |
Computes the Minkowski sum \( P \oplus Q\) of the two given polygons. More... | |
template<class ConicTraits , class Container , class OutputIterator > | |
OutputIterator | CGAL::inset_polygon_2 (const Polygon_2< typename ConicTraits::Rat_kernel, Container > &P, const typename ConicTraits::Rat_kernel::FT &r, const ConicTraits &traits, OutputIterator oi) |
Computes the inset, or inner offset, of the given polygon P by a given radius r - namely, the function computes the set of points inside the polygon whose distance from \( P\)'s boundary is at least \( r\): \( \{ p \in P \;|\; {\rm dist}(p, \partial P) \geq r \}\). More... | |
template<class ConicTraits , class Container > | |
Gps_traits_2< ConicTraits > ::Polygon_with_holes_2 | CGAL::offset_polygon_2 (const Polygon_2< typename ConicTraits::Rat_kernel, Container > &P, const typename ConicTraits::Rat_kernel::FT &r, const ConicTraits &traits) |
Computes the offset of the given polygon P by a given radius r - namely, the function computes the Minkowski sum \( P \oplus B_r\), where \( B_r\) is a disc of radius r centered at the origin. More... | |
template<class ConicTraits , class Container > | |
Gps_traits_2< ConicTraits > ::Polygon_with_holes_2 | CGAL::offset_polygon_2 (const Polygon_with_holes_2< typename ConicTraits::Rat_kernel, Container > &pwh, const typename ConicTraits::Rat_kernel::FT &r, const ConicTraits &traits) |
Computes the offset of the given polygon with holes pwh by a given radius r . More... | |
template<class ConicTraits , class Container , class DecompositionStrategy > | |
Gps_traits_2< ConicTraits > ::Polygon_with_holes_2 | CGAL::offset_polygon_2 (const Polygon_2< typename ConicTraits::Rat_kernel, Container > &P, const typename ConicTraits::Rat_kernel::FT &r, const DecompositionStrategy &decomp, const ConicTraits &traits) |
Computes the exact representation of the offset of the given polygon P by a radius r , as described above. More... | |
OutputIterator CGAL::approximated_inset_2 | ( | const Polygon_2< Kernel, Container > & | pgn, |
const typename Kernel::FT & | r, | ||
const double & | eps, | ||
OutputIterator | oi | ||
) |
Provides a guaranteed approximation of the inset, or inner offset, of the given polygon P
by a given radius r
.
Namely, the function computes the set of points inside the polygon whose distance from \( P\)'s boundary is at least \( r\): \( \{ p \in P \;|\; {\rm dist}(p, \partial P) \geq r \}\), with the approximation error bounded by eps
. Note that as the input polygon may not be convex, its inset may comprise several disconnected components. The result is therefore represented as a sequence of generalized polygons, whose edges are either line segments or circular arcs. The output sequence is returned via the output iterator oi
, whose value-type must be Gps_circle_segment_traits_2::Polygon_2
.
P
is a simple polygon. #include <CGAL/approximated_offset_2.h>
Gps_circle_segment_traits_2<Kernel>::Polygon_with_holes_2 CGAL::approximated_offset_2 | ( | const Polygon_2< Kernel, Container > & | P, |
const typename Kernel::FT & | r, | ||
const double & | eps | ||
) |
Provides a guaranteed approximation of the offset of the given polygon P
by a given radius r
- namely, the function computes the Minkowski sum \( P \oplus B_r\), where \( B_r\) is a disc of radius r
centered at the origin.
The function actually outputs a set \( S\) that contains the Minkowski sum, such that the approximation error is bounded by eps
. Note that as the input polygon may not be convex, its offset may not be a simple polygon. The result is therefore represented as a polygon with holes, whose edges are either line segments or circular arcs.
P
is a simple polygon. #include <CGAL/approximated_offset_2.h>
Gps_circle_segment_traits_2<Kernel>::Polygon_with_holes_2 CGAL::approximated_offset_2 | ( | const Polygon_with_holes_2< Kernel, Container > & | wh, |
const typename Kernel::FT & | r, | ||
const double & | eps | ||
) |
Provides a guaranteed approximation of offset the given polygon with holes pwh
by a given radius r
, such that the approximation error is bounded by eps
.
It does so by offsetting outer boundary of pwh
and insetting its holes. The result is represented as a generalized polygon with holes, such that the edges of the polygon correspond to line segment and circular arcs.
pwh
is not unbounded (it has a valid outer boundary). #include <CGAL/approximated_offset_2.h>
Gps_circle_segment_traits_2<Kernel>::Polygon_with_holes_2 CGAL::approximated_offset_2 | ( | const Polygon_2< Kernel, Container > & | P, |
const typename Kernel::FT & | r, | ||
const double & | eps, | ||
const DecompositionStrategy & | decomp | ||
) |
Provides a guaranteed approximation of the offset of the given polygon P
by a radius r
, as described above.
If the input polygon P
is not convex, the function decomposes it into convex sub-polygons \( P_1, \ldots, P_k\) and computes the union of the sub-offsets (namely \( \bigcup_{i}{(P_i \oplus B_r)}\)). The decomposition is performed using the given decomposition strategy decomp
, which must be an instance of a class that models the concept PolygonConvexDecomposition
.
P
is a simple polygon. #include <CGAL/approximated_offset_2.h>
OutputIterator CGAL::inset_polygon_2 | ( | const Polygon_2< typename ConicTraits::Rat_kernel, Container > & | P, |
const typename ConicTraits::Rat_kernel::FT & | r, | ||
const ConicTraits & | traits, | ||
OutputIterator | oi | ||
) |
Computes the inset, or inner offset, of the given polygon P
by a given radius r
- namely, the function computes the set of points inside the polygon whose distance from \( P\)'s boundary is at least \( r\): \( \{ p \in P \;|\; {\rm dist}(p, \partial P) \geq r \}\).
Note that as the input polygon may not be convex, its inset may comprise several disconnected components. The result is therefore represented as a sequence of generalized polygons, such that the edges of each polygon correspond to line segments and circular arcs, both are special types of conic arcs, as represented by the traits
class. The output sequence is returned via the output iterator oi
, whose value-type must be Gps_traits_2::Polygon_2
.
P
is a simple polygon. #include <CGAL/offset_polygon_2.h>
Polygon_with_holes_2<Kernel,Container> CGAL::minkowski_sum_2 | ( | const Polygon_2< Kernel, Container > & | P, |
const Polygon_2< Kernel, Container > & | Q | ||
) |
Computes the Minkowski sum \( P \oplus Q\) of the two given polygons.
The function computes the convolution cycles of the two polygons and extract the regions having positive winding number with respect to these cycles. This method work very efficiently, regardless of whether P
and Q
are convex or non-convex. Note that as the input polygons may not be convex, their Minkowski sum may not be a simple polygon. The result is therefore represented as a polygon with holes.
P
and Q
are simple polygons. #include <CGAL/minkowski_sum_2.h>
Polygon_with_holes_2<Kernel,Container> CGAL::minkowski_sum_2 | ( | const Polygon_2< Kernel, Container > & | P, |
const Polygon_2< Kernel, Container > & | Q, | ||
const DecompositionStrategy & | decomp | ||
) |
Computes the Minkowski sum \( P \oplus Q\) of the two given polygons.
If the input polygons P
and Q
are not convex, the function decomposes them into convex sub-polygons \( P_1, \ldots, P_k\) and \( Q_1, \ldots, Q_{\ell}\) and computes the union of pairwise sub-sums (namely \( \bigcup_{i,j}{(P_i \oplus Q_j)}\)). The decomposition is performed using the given decomposition strategy decomp
, which must be an instance of a class that models the concept PolygonConvexDecomposition
. Note that as the input polygons may not be convex, their Minkowski sum may not be a simple polygon. The result is therefore represented as a polygon with holes.
P
and Q
are simple polygons. #include <CGAL/minkowski_sum_2.h>
Gps_traits_2<ConicTraits>::Polygon_with_holes_2 CGAL::offset_polygon_2 | ( | const Polygon_2< typename ConicTraits::Rat_kernel, Container > & | P, |
const typename ConicTraits::Rat_kernel::FT & | r, | ||
const ConicTraits & | traits | ||
) |
Computes the offset of the given polygon P
by a given radius r
- namely, the function computes the Minkowski sum \( P \oplus B_r\), where \( B_r\) is a disc of radius r
centered at the origin.
Note that as the input polygon may not be convex, its offset may not be a simple polygon. The result is therefore represented as a generalized polygon with holes, such that the edges of the polygon correspond to line segments and circular arcs, both are special types of conic arcs, as represented by the traits
class.
P
is a simple polygon. #include <CGAL/offset_polygon_2.h>
Gps_traits_2<ConicTraits>::Polygon_with_holes_2 CGAL::offset_polygon_2 | ( | const Polygon_with_holes_2< typename ConicTraits::Rat_kernel, Container > & | pwh, |
const typename ConicTraits::Rat_kernel::FT & | r, | ||
const ConicTraits & | traits | ||
) |
Computes the offset of the given polygon with holes pwh
by a given radius r
.
It does so by offsetting outer boundary of pwh
and insetting its holes. The result is represented as a generalized polygon with holes, such that the edges of the polygon correspond to line segments and circular arcs, both are special types of conic arcs, as represented by the traits
class.
pwh
is not unbounded (it has a valid outer boundary). #include <CGAL/offset_polygon_2.h>
Gps_traits_2<ConicTraits>::Polygon_with_holes_2 CGAL::offset_polygon_2 | ( | const Polygon_2< typename ConicTraits::Rat_kernel, Container > & | P, |
const typename ConicTraits::Rat_kernel::FT & | r, | ||
const DecompositionStrategy & | decomp, | ||
const ConicTraits & | traits | ||
) |
Computes the exact representation of the offset of the given polygon P
by a radius r
, as described above.
If P
is not convex, the function decomposes it into convex sub-polygons \( P_1, \ldots, P_k\) and computes the union of sub-offsets (namely \( \bigcup_{i}{(P_i \oplus B_r)}\)). The decomposition is performed using the given decomposition strategy decomp
, which must be an instance of a class that models the concept PolygonConvexDecomposition
.
P
is a simple polygon. #include <CGAL/offset_polygon_2.h>