Added minkowski_sum_by_decomposition_2()

This commit is contained in:
Efi Fogel 2015-06-29 16:47:53 +03:00
parent 91a79a7ff8
commit e006eaa6c6
3 changed files with 424 additions and 27 deletions

View File

@ -20,11 +20,12 @@
#include <CGAL/basic.h> #include <CGAL/basic.h>
#include <CGAL/Polygon_with_holes_2.h> #include <CGAL/Polygon_with_holes_2.h>
#include <CGAL/Minkowski_sum_2/Hole_filter_2.h> #include <CGAL/Minkowski_sum_2/Hole_filter_2.h>
#include <CGAL/Minkowski_sum_2/Minkowski_sum_by_reduced_convolution_2.h> #include <CGAL/Minkowski_sum_2/Minkowski_sum_by_reduced_convolution_2.h>
#include <CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h> #include <CGAL/Minkowski_sum_2/Minkowski_sum_conv_2.h>
#include <CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h> #include <CGAL/Minkowski_sum_2/Minkowski_sum_decomp_2.h>
#include <CGAL/Polygon_nop_decomposition_2.h>
#include <list> #include <list>
namespace CGAL { namespace CGAL {
@ -730,6 +731,387 @@ minkowski_sum_2(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
traits); traits);
} }
/*! Compute the Minkowski sum of two simple polygons by decomposing each
* polygon to convex sub-polygons and computing the union of the pairwise
* Minkowski sums of the sub-polygons.
* 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.
* \param[in] pgn1 The first polygon.
* \param[in] pgn2 The second polygon.
* \param[in] decomposition_strategy A functor for decomposing polygons.
* \return The resulting polygon with holes, representing the sum.
*/
template <typename Kernel_, typename Container_, typename Decomposition_>
Polygon_with_holes_2<Kernel_, Container_>
minkowski_sum_by_decomposition_2(const Polygon_2<Kernel_, Container_>& pgn1,
const Polygon_2<Kernel_, Container_>& pgn2,
const Decomposition_& decomp)
{
typename Minkowski_sum_by_decomposition_2<Decomposition_, Decomposition_,
Container_>::Traits_2 traits;
return minkowski_sum_by_decomposition_2(pgn1, pgn2, decomp, traits);
}
/*! Compute the Minkowski sum of two simple polygons by decomposing each
* polygon to convex sub-polygons and computing the union of the pairwise
* Minkowski sums of the sub-polygons.
* 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.
* \param[in] pgn1 The first polygon.
* \param[in] pgn2 The second polygon.
* \param[in] decomposition A functor for decomposing polygons.
* \param[in] traits The traits.
* \return The resulting polygon with holes, representing the sum.
*/
template <typename Kernel_, typename Container_, typename Decomposition_>
Polygon_with_holes_2<Kernel_, Container_>
minkowski_sum_by_decomposition_2
(const Polygon_2<Kernel_, Container_>& pgn1,
const Polygon_2<Kernel_, Container_>& pgn2,
const Decomposition_& decomp,
const typename Minkowski_sum_by_decomposition_2<Decomposition_, Decomposition_,
Container_>::Traits_2& traits)
{
typedef Kernel_ Kernel;
typedef Container_ Container;
typedef Decomposition_ Decomposition;
typedef Polygon_nop_decomposition_2<Kernel> Nop_decomposition;
if (pgn1.is_convex()) {
Nop_decomposition decomp_nop;
if (pgn2.is_convex()) {
Minkowski_sum_by_decomposition_2<Nop_decomposition, Nop_decomposition,
Container>
mink_sum(decomp_nop, decomp_nop, traits);
return mink_sum(pgn1, pgn2);
}
Minkowski_sum_by_decomposition_2<Nop_decomposition, Decomposition,
Container>
mink_sum(decomp_nop, decomp, traits);
return mink_sum(pgn1, pgn2);
}
if (pgn2.is_convex()) {
Nop_decomposition decomp_nop;
Minkowski_sum_by_decomposition_2<Decomposition, Nop_decomposition,
Container>
mink_sum(decomp, decomp_nop, traits);
return mink_sum(pgn1, pgn2);
}
Minkowski_sum_by_decomposition_2<Decomposition, Decomposition, Container>
mink_sum(decomp, decomp, traits);
return mink_sum(pgn1, pgn2);
}
/*! Compute the Minkowski sum of two polygon with holes by decomposing each
* polygon to convex sub-polygons and computing the union of the pairwise
* Minkowski sums of the sub-polygons.
* The result is also represented as a polygon with holes.
* \param[in] pgn1 The first polygon.
* \param[in] pgn2 The second polygon.
* \param[in] decomposition A functor for decomposing polygons.
* \return The resulting polygon with holes, representing the sum.
*/
template <typename Kernel_, typename Container_,
typename NoHolesDecomposition_, typename WithHolesDecomposition_>
Polygon_with_holes_2<Kernel_, Container_>
minkowski_sum_by_decomposition_2
(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
const NoHolesDecomposition_& decomp_no_holes,
const WithHolesDecomposition_& decomp_with_holes)
{
typename Minkowski_sum_by_decomposition_2<NoHolesDecomposition_,
WithHolesDecomposition_,
Container_>::Traits_2 traits;
return minkowski_sum_by_decomposition_2(pgn1, pgn2,
decomp_no_holes, decomp_with_holes,
traits);
}
/*! Compute the Minkowski sum of two polygon with holes by decomposing each
* polygon to convex sub-polygons and computing the union of the pairwise
* Minkowski sums of the sub-polygons.
* The result is also represented as a polygon with holes.
* \param[in] pgn1 The first polygon.
* \param[in] pgn2 The second polygon.
* \param[in] decomposition A functor for decomposing polygons.
* \param[in] traits The traits.
* \return The resulting polygon with holes, representing the sum.
*/
template <typename Kernel_, typename Container_,
typename NoHolesDecomposition_, typename WithHolesDecomposition_>
Polygon_with_holes_2<Kernel_, Container_>
minkowski_sum_by_decomposition_2
(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
const NoHolesDecomposition_& decomp_no_holes,
const WithHolesDecomposition_& decomp_with_holes,
const typename Minkowski_sum_by_decomposition_2<NoHolesDecomposition_,
WithHolesDecomposition_,
Container_>::Traits_2& traits)
{
typedef Kernel_ Kernel;
typedef Container_ Container;
typedef NoHolesDecomposition_ No_holes_decomposition;
typedef WithHolesDecomposition_ With_holes_decomposition;
typedef Polygon_nop_decomposition_2<Kernel> Nop_decomposition;
Hole_filter_2<Kernel, Container> hole_filter;
Polygon_with_holes_2<Kernel, Container> filtered_pgn1;
Polygon_with_holes_2<Kernel, Container> filtered_pgn2;
hole_filter(pgn1, pgn2, filtered_pgn1);
hole_filter(pgn2, pgn1, filtered_pgn2);
if (0 == filtered_pgn1.number_of_holes()) {
const Polygon_2<Kernel, Container>& pnh1 = filtered_pgn1.outer_boundary();
if (pnh1.is_convex()) {
// pnh1 is convex
Nop_decomposition decomp_nop;
if (0 == filtered_pgn2.number_of_holes()) {
const Polygon_2<Kernel, Container>& pnh2 =
filtered_pgn2.outer_boundary();
if (pnh2.is_convex()) {
// pnh2 is convex
Minkowski_sum_by_decomposition_2<Nop_decomposition, Nop_decomposition,
Container>
mink_sum(decomp_nop, decomp_nop, traits);
return mink_sum(pnh1, pnh2);
}
// pnh2 is concave
Minkowski_sum_by_decomposition_2<Nop_decomposition,
No_holes_decomposition,
Container>
mink_sum(decomp_nop, decomp_no_holes, traits);
return mink_sum(pnh1, pnh2);
}
// pnh2 has holes
Minkowski_sum_by_decomposition_2<Nop_decomposition,
With_holes_decomposition,
Container>
mink_sum(decomp_nop, decomp_with_holes, traits);
return mink_sum(pnh1, filtered_pgn2);
}
// pnh1 is concave
if (0 == filtered_pgn2.number_of_holes()) {
const Polygon_2<Kernel, Container>& pnh2 =
filtered_pgn2.outer_boundary();
if (pnh2.is_convex()) {
// pnh2 is convex
Nop_decomposition decomp_nop;
Minkowski_sum_by_decomposition_2<No_holes_decomposition,
Nop_decomposition,
Container>
mink_sum(decomp_no_holes, decomp_nop, traits);
return mink_sum(pnh1, pnh2);
}
// pnh2 is concave
Minkowski_sum_by_decomposition_2<No_holes_decomposition,
No_holes_decomposition,
Container>
mink_sum(decomp_no_holes, decomp_no_holes, traits);
return mink_sum(pnh1, pnh2);
}
// pnh2 has holes
Minkowski_sum_by_decomposition_2<No_holes_decomposition,
With_holes_decomposition,
Container>
mink_sum(decomp_no_holes, decomp_with_holes, traits);
return mink_sum(pnh1, filtered_pgn2);
}
// filtered_pgn1 has holes
if (0 == filtered_pgn2.number_of_holes()) {
const Polygon_2<Kernel, Container>& pnh2 =
filtered_pgn2.outer_boundary();
if (pnh2.is_convex()) {
// pnh2 is convex
Nop_decomposition decomp_nop;
Minkowski_sum_by_decomposition_2<Nop_decomposition,
With_holes_decomposition,
Container>
mink_sum(decomp_nop, decomp_with_holes, traits);
return mink_sum(pnh2, filtered_pgn1);
}
// pnh2 is concave
Minkowski_sum_by_decomposition_2<No_holes_decomposition,
With_holes_decomposition,
Container>
mink_sum(decomp_no_holes, decomp_with_holes, traits);
return mink_sum(pnh2, filtered_pgn1);
}
// pnh2 has holes
Minkowski_sum_by_decomposition_2<With_holes_decomposition,
With_holes_decomposition,
Container>
mink_sum(decomp_with_holes, decomp_with_holes, traits);
return mink_sum(filtered_pgn1, filtered_pgn2);
}
/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
* by decomposing each polygon to convex sub-polygons and computing the union
* of the pairwise Minkowski sums of the sub-polygons. The result is also
* represented as a polygon with holes.
* \param[in] pgn1 The first polygon.
* \param[in] pgn2 The second polygon.
* \param[in] decomposition A functor for decomposing polygons.
* \return The resulting polygon with holes, representing the sum.
*/
template <typename Kernel_, typename Container_,
typename NoHolesDecomposition_, typename WithHolesDecomposition_>
Polygon_with_holes_2<Kernel_, Container_>
minkowski_sum_by_decomposition_2
(const Polygon_2<Kernel_, Container_>& pgn1,
const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
const NoHolesDecomposition_& decomp_no_holes,
const WithHolesDecomposition_& decomp_with_holes)
{
typename Minkowski_sum_by_decomposition_2<NoHolesDecomposition_,
WithHolesDecomposition_,
Container_>::Traits_2 traits;
return minkowski_sum_by_decomposition_2(pgn1, pgn2,
decomp_no_holes, decomp_with_holes,
traits);
}
/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
* by decomposing each polygon to convex sub-polygons and computing the union
* of the pairwise Minkowski sums of the sub-polygons. The result is also
* represented as a polygon with holes.
* \param[in] pgn1 The simple polygon.
* \param[in] pgn2 The polygon with holes.
* \param[in] decomposition A functor for decomposing polygons.
* \param[in] traits The traits.
* \return The resulting polygon with holes, representing the sum.
*/
template <typename Kernel_, typename Container_,
typename NoHolesDecomposition_, typename WithHolesDecomposition_>
Polygon_with_holes_2<Kernel_, Container_>
minkowski_sum_by_decomposition_2
(const Polygon_2<Kernel_, Container_>& pgn1,
const Polygon_with_holes_2<Kernel_, Container_>& pgn2,
const NoHolesDecomposition_& decomp_no_holes,
const WithHolesDecomposition_& decomp_with_holes,
const typename Minkowski_sum_by_decomposition_2<NoHolesDecomposition_,
WithHolesDecomposition_,
Container_>::Traits_2& traits)
{
typedef Kernel_ Kernel;
typedef Container_ Container;
typedef NoHolesDecomposition_ No_holes_decomposition;
typedef WithHolesDecomposition_ With_holes_decomposition;
typedef Polygon_nop_decomposition_2<Kernel> Nop_decomposition;
Hole_filter_2<Kernel, Container> hole_filter;
Polygon_with_holes_2<Kernel,Container> filtered_pgn2;
hole_filter(pgn2, pgn1, filtered_pgn2);
if (pgn1.is_convex()) {
Nop_decomposition decomp_nop;
if (0 == filtered_pgn2.number_of_holes()) {
const Polygon_2<Kernel, Container>& pnh2 = filtered_pgn2.outer_boundary();
if (pnh2.is_convex()) {
Minkowski_sum_by_decomposition_2<Nop_decomposition, Nop_decomposition,
Container>
mink_sum(decomp_nop, decomp_nop, traits);
return mink_sum(pgn1, pnh2);
}
// pnh2 is concave
Minkowski_sum_by_decomposition_2<Nop_decomposition,
No_holes_decomposition,
Container>
mink_sum(decomp_nop, decomp_no_holes, traits);
return mink_sum(pgn1, pnh2);
}
// pnh2 has holes
Minkowski_sum_by_decomposition_2<Nop_decomposition,
With_holes_decomposition,
Container>
mink_sum(decomp_nop, decomp_with_holes, traits);
return mink_sum(pgn1, filtered_pgn2);
}
// pgn1 is concave
if (0 == filtered_pgn2.number_of_holes()) {
const Polygon_2<Kernel, Container>& pnh2 = filtered_pgn2.outer_boundary();
if (pnh2.is_convex()) {
// pnh2 is convex
Nop_decomposition decomp_nop;
Minkowski_sum_by_decomposition_2<No_holes_decomposition,
Nop_decomposition,
Container>
mink_sum(decomp_no_holes, decomp_nop, traits);
return mink_sum(pgn1, pnh2);
}
// pnh2 is concave
Minkowski_sum_by_decomposition_2<No_holes_decomposition,
No_holes_decomposition,
Container>
mink_sum(decomp_no_holes, decomp_no_holes, traits);
return mink_sum(pgn1, pnh2);
}
// pnh2 has holes
Minkowski_sum_by_decomposition_2<No_holes_decomposition,
With_holes_decomposition,
Container>
mink_sum(decomp_no_holes, decomp_with_holes, traits);
return mink_sum(pgn1, filtered_pgn2);
}
/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
* by decomposing each polygon to convex sub-polygons and computing the union
* of the pairwise Minkowski sums of the sub-polygons. The result is also
* represented as a polygon with holes.
* \param[in] pgn1 The second polygon.
* \param[in] pgn2 The first polygon.
* \param[in] decomposition A functor for decomposing polygons.
* \return The resulting polygon with holes, representing the sum.
*/
template <typename Kernel_, typename Container_,
typename NoHolesDecomposition_, typename WithHolesDecomposition_>
Polygon_with_holes_2<Kernel_, Container_>
minkowski_sum_by_decomposition_2
(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
const Polygon_2<Kernel_, Container_>& pgn2,
const NoHolesDecomposition_& decomp_no_holes,
const WithHolesDecomposition_& decomp_with_holes)
{
typename Minkowski_sum_by_decomposition_2<NoHolesDecomposition_,
WithHolesDecomposition_,
Container_>::Traits_2 traits;
return minkowski_sum_by_decomposition_2(pgn1, pgn2,
decomp_no_holes, decomp_with_holes,
traits);
}
/*! Compute the Minkowski sum of a simple polygon and a polygon with holes
* by decomposing each polygon to convex sub-polygons and computing the union
* of the pairwise Minkowski sums of the sub-polygons. The result is also
* represented as a polygon with holes.
* \param[in] pgn1 The polygon with holes.
* \param[in] pgn2 The simple polygon.
* \param[in] decomposition A functor for decomposing polygons.
* \param[in] traits The traits.
* \return The resulting polygon with holes, representing the sum.
*/
template <typename Kernel_, typename Container_,
typename NoHoleDecomposition_, typename WithHolesDecomposition_>
Polygon_with_holes_2<Kernel_, Container_>
minkowski_sum_by_decomposition_2
(const Polygon_with_holes_2<Kernel_, Container_>& pgn1,
const Polygon_2<Kernel_, Container_>& pgn2,
const NoHoleDecomposition_& decomp_no_holes,
const WithHolesDecomposition_& decomp_with_holes,
const typename Minkowski_sum_by_decomposition_2<NoHoleDecomposition_,
WithHolesDecomposition_,
Container_>::Traits_2& traits)
{
return minkowski_sum_by_decomposition_2(pgn2, pgn1,
decomp_no_holes, decomp_with_holes,
traits);
}
/*!@}*/ /*!@}*/

View File

@ -1,4 +1,4 @@
rvtwu rvtwud
data/pwh1.dat data/pwh1.dat data/pwh1.dat data/pwh1.dat
data/pwh2.dat data/pwh2.dat data/pwh2.dat data/pwh2.dat
data/pwh1.dat data/pwh2.dat data/pwh1.dat data/pwh2.dat

View File

@ -26,10 +26,11 @@ bool are_equal(const Polygon_with_holes_2& ph1,
typedef enum { typedef enum {
REDUCED_CONVOLUTION, REDUCED_CONVOLUTION,
VERTICAL_DECOMP, VERTICAL_DECOMPOSITION,
TRIANGULATION_DECOMP, TRIANGULATION_DECOMPOSITION,
VERTICAL_AND_ANGLE_BISECTOR_DECOMP, VERTICAL_AND_ANGLE_BISECTOR_DECOMPOSITION,
TRIANGULATION_AND_ANGLE_BISECTOR_DECOMP TRIANGULATION_AND_ANGLE_BISECTOR_DECOMPOSITION,
OPTIMAL_DECOMPOSITION,
} Strategy; } Strategy;
static const char* strategy_names[] = { static const char* strategy_names[] = {
@ -37,7 +38,8 @@ static const char* strategy_names[] = {
"vertical decomposition", "vertical decomposition",
"constrained triangulation decomposition", "constrained triangulation decomposition",
"vertical and angle bisector decomposition", "vertical and angle bisector decomposition",
"constrained triangulation and angle bisector decomposition" "constrained triangulation and angle bisector decomposition",
"optimal decomposition"
}; };
Polygon_with_holes_2 compute_minkowski_sum_2(Polygon_with_holes_2& p, Polygon_with_holes_2 compute_minkowski_sum_2(Polygon_with_holes_2& p,
@ -49,43 +51,43 @@ Polygon_with_holes_2 compute_minkowski_sum_2(Polygon_with_holes_2& p,
{ {
return CGAL::minkowski_sum_reduced_convolution_2(p, q); return CGAL::minkowski_sum_reduced_convolution_2(p, q);
} }
case VERTICAL_DECOMP: case VERTICAL_DECOMPOSITION:
{ {
CGAL::Polygon_vertical_decomposition_2<Kernel> decomp; CGAL::Polygon_vertical_decomposition_2<Kernel> decomp;
return CGAL::minkowski_sum_2(p, q, decomp); return CGAL::minkowski_sum_2(p, q, decomp);
} }
case TRIANGULATION_DECOMP: case TRIANGULATION_DECOMPOSITION:
{ {
CGAL::Polygon_triangulation_decomposition_2<Kernel> decomp; CGAL::Polygon_triangulation_decomposition_2<Kernel> decomp;
return CGAL::minkowski_sum_2(p, q, decomp); return CGAL::minkowski_sum_2(p, q, decomp);
} }
case VERTICAL_AND_ANGLE_BISECTOR_DECOMP: case VERTICAL_AND_ANGLE_BISECTOR_DECOMPOSITION:
{ {
typedef CGAL::Small_side_angle_bisector_decomposition_2<Kernel> typedef CGAL::Small_side_angle_bisector_decomposition_2<Kernel>
No_hole_decomposition; No_holes_decomposition;
typedef CGAL::Polygon_vertical_decomposition_2<Kernel> typedef CGAL::Polygon_vertical_decomposition_2<Kernel>
With_hole_decomposition; With_holes_decomposition;
if (0 == p.number_of_holes()) { if (0 == p.number_of_holes()) {
const Polygon_2& pnh = p.outer_boundary(); const Polygon_2& pnh = p.outer_boundary();
No_hole_decomposition decomp_no_holes; No_holes_decomposition decomp_no_holes;
if (0 == q.number_of_holes()) { if (0 == q.number_of_holes()) {
const Polygon_2& qnh = q.outer_boundary(); const Polygon_2& qnh = q.outer_boundary();
return CGAL::minkowski_sum_2(pnh, qnh, return CGAL::minkowski_sum_2(pnh, qnh,
decomp_no_holes, decomp_no_holes); decomp_no_holes, decomp_no_holes);
} }
else { else {
With_hole_decomposition decomp_with_holes; With_holes_decomposition decomp_with_holes;
return return
CGAL::minkowski_sum_2(pnh, q, decomp_no_holes, decomp_with_holes); CGAL::minkowski_sum_2(pnh, q, decomp_no_holes, decomp_with_holes);
} }
} }
else { else {
With_hole_decomposition decomp_with_holes; With_holes_decomposition decomp_with_holes;
if (0 == q.number_of_holes()) { if (0 == q.number_of_holes()) {
const Polygon_2& qnh = q.outer_boundary(); const Polygon_2& qnh = q.outer_boundary();
No_hole_decomposition decomp_no_holes; No_holes_decomposition decomp_no_holes;
return return
CGAL::minkowski_sum_2(p, qnh, decomp_with_holes, decomp_no_holes); CGAL::minkowski_sum_2(p, qnh, decomp_with_holes, decomp_no_holes);
} }
@ -96,31 +98,31 @@ Polygon_with_holes_2 compute_minkowski_sum_2(Polygon_with_holes_2& p,
} }
} }
case TRIANGULATION_AND_ANGLE_BISECTOR_DECOMP: case TRIANGULATION_AND_ANGLE_BISECTOR_DECOMPOSITION:
{ {
typedef CGAL::Small_side_angle_bisector_decomposition_2<Kernel> typedef CGAL::Small_side_angle_bisector_decomposition_2<Kernel>
No_hole_decomposition; No_holes_decomposition;
typedef CGAL::Polygon_triangulation_decomposition_2<Kernel> typedef CGAL::Polygon_triangulation_decomposition_2<Kernel>
With_hole_decomposition; With_holes_decomposition;
if (0 == p.number_of_holes()) { if (0 == p.number_of_holes()) {
const Polygon_2& pnh = p.outer_boundary(); const Polygon_2& pnh = p.outer_boundary();
No_hole_decomposition decomp_no_holes; No_holes_decomposition decomp_no_holes;
if (0 == q.number_of_holes()) { if (0 == q.number_of_holes()) {
const Polygon_2& qnh = q.outer_boundary(); const Polygon_2& qnh = q.outer_boundary();
return CGAL::minkowski_sum_2(pnh, qnh, return CGAL::minkowski_sum_2(pnh, qnh,
decomp_no_holes, decomp_no_holes); decomp_no_holes, decomp_no_holes);
} }
else { else {
With_hole_decomposition decomp_with_holes; With_holes_decomposition decomp_with_holes;
return return
CGAL::minkowski_sum_2(pnh, q, decomp_no_holes, decomp_with_holes); CGAL::minkowski_sum_2(pnh, q, decomp_no_holes, decomp_with_holes);
} }
} }
else { else {
With_hole_decomposition decomp_with_holes; With_holes_decomposition decomp_with_holes;
if (0 == q.number_of_holes()) { if (0 == q.number_of_holes()) {
const Polygon_2& qnh = q.outer_boundary(); const Polygon_2& qnh = q.outer_boundary();
No_hole_decomposition decomp_no_holes; No_holes_decomposition decomp_no_holes;
return return
CGAL::minkowski_sum_2(p, qnh, decomp_with_holes, decomp_no_holes); CGAL::minkowski_sum_2(p, qnh, decomp_with_holes, decomp_no_holes);
} }
@ -131,6 +133,15 @@ Polygon_with_holes_2 compute_minkowski_sum_2(Polygon_with_holes_2& p,
} }
} }
case OPTIMAL_DECOMPOSITION:
{
CGAL::Small_side_angle_bisector_decomposition_2<Kernel> decomp_no_holes;
CGAL::Polygon_triangulation_decomposition_2<Kernel> decomp_with_holes;
return CGAL::minkowski_sum_by_decomposition_2(p, q,
decomp_no_holes,
decomp_with_holes);
}
default: default:
std::cerr << "Invalid strategy" << std::endl; std::cerr << "Invalid strategy" << std::endl;
return Polygon_with_holes_2(); return Polygon_with_holes_2();
@ -161,19 +172,23 @@ int main(int argc, char* argv[])
break; break;
case 'v': case 'v':
strategies.push_back(VERTICAL_DECOMP); strategies.push_back(VERTICAL_DECOMPOSITION);
break; break;
case 't': case 't':
strategies.push_back(TRIANGULATION_DECOMP); strategies.push_back(TRIANGULATION_DECOMPOSITION);
break; break;
case 'w': case 'w':
strategies.push_back(VERTICAL_AND_ANGLE_BISECTOR_DECOMP); strategies.push_back(VERTICAL_AND_ANGLE_BISECTOR_DECOMPOSITION);
break; break;
case 'u': case 'u':
strategies.push_back(TRIANGULATION_AND_ANGLE_BISECTOR_DECOMP); strategies.push_back(TRIANGULATION_AND_ANGLE_BISECTOR_DECOMPOSITION);
break;
case 'd':
strategies.push_back(OPTIMAL_DECOMPOSITION);
break; break;
default: default: