mirror of https://github.com/CGAL/cgal
Consistency between doc & code, use OutPolygon if provided, factorize code
This commit is contained in:
parent
06e970d886
commit
2f7db1db74
|
|
@ -24,9 +24,8 @@
|
||||||
|
|
||||||
#include <CGAL/assertions.h>
|
#include <CGAL/assertions.h>
|
||||||
#include <CGAL/Cartesian_converter.h>
|
#include <CGAL/Cartesian_converter.h>
|
||||||
|
#include <CGAL/Default.h>
|
||||||
#include <CGAL/Kernel_traits.h>
|
#include <CGAL/Kernel_traits.h>
|
||||||
#include <CGAL/Polygon_2.h>
|
|
||||||
#include <CGAL/Polygon_with_holes_2.h>
|
|
||||||
#include <CGAL/tags.h>
|
#include <CGAL/tags.h>
|
||||||
|
|
||||||
#include <boost/optional/optional.hpp>
|
#include <boost/optional/optional.hpp>
|
||||||
|
|
@ -142,6 +141,8 @@ template<class OutPolygon, class FT, class Skeleton, class K>
|
||||||
std::vector< boost::shared_ptr<OutPolygon> >
|
std::vector< boost::shared_ptr<OutPolygon> >
|
||||||
create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& , Tag_false )
|
create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& , Tag_false )
|
||||||
{
|
{
|
||||||
|
static_assert(!std::is_same_v<OutPolygon, CGAL::Default>);
|
||||||
|
|
||||||
typedef boost::shared_ptr<OutPolygon> OutPolygonPtr ;
|
typedef boost::shared_ptr<OutPolygon> OutPolygonPtr ;
|
||||||
typedef std::vector<OutPolygonPtr> OutPolygonPtrVector ;
|
typedef std::vector<OutPolygonPtr> OutPolygonPtrVector ;
|
||||||
|
|
||||||
|
|
@ -166,6 +167,8 @@ template<class OutPolygon, class FT, class Skeleton, class K>
|
||||||
std::vector< boost::shared_ptr<OutPolygon> >
|
std::vector< boost::shared_ptr<OutPolygon> >
|
||||||
create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& /*k*/, Tag_true )
|
create_offset_polygons_2 ( FT const& aOffset, Skeleton const& aSs, K const& /*k*/, Tag_true )
|
||||||
{
|
{
|
||||||
|
static_assert(!std::is_same_v<OutPolygon, CGAL::Default>);
|
||||||
|
|
||||||
typedef boost::shared_ptr<OutPolygon> OutPolygonPtr ;
|
typedef boost::shared_ptr<OutPolygon> OutPolygonPtr ;
|
||||||
typedef std::vector<OutPolygonPtr> OutPolygonPtrVector ;
|
typedef std::vector<OutPolygonPtr> OutPolygonPtrVector ;
|
||||||
|
|
||||||
|
|
@ -190,43 +193,39 @@ Skeleton const& dereference ( boost::shared_ptr<Skeleton> const& ss )
|
||||||
|
|
||||||
} // namespace CGAL_SS_i
|
} // namespace CGAL_SS_i
|
||||||
|
|
||||||
template<class OutPolygon, class FT, class Skeleton, class K>
|
template<class OutPolygon, class FT, class Skeleton,
|
||||||
|
class K = Exact_predicates_inexact_constructions_kernel>
|
||||||
std::vector< boost::shared_ptr<OutPolygon> >
|
std::vector< boost::shared_ptr<OutPolygon> >
|
||||||
inline
|
inline
|
||||||
create_offset_polygons_2(const FT& aOffset,
|
create_offset_polygons_2(const FT& aOffset,
|
||||||
const Skeleton& aSs,
|
const Skeleton& aSs,
|
||||||
const K& k)
|
const K& k = K())
|
||||||
{
|
{
|
||||||
typename CGAL_SS_i::Is_same_type<K, typename Skeleton::Traits>::type same_kernel;
|
typename CGAL_SS_i::Is_same_type<K, typename Skeleton::Traits>::type same_kernel;
|
||||||
return CGAL_SS_i::create_offset_polygons_2<OutPolygon>(aOffset, aSs, k, same_kernel);
|
return CGAL_SS_i::create_offset_polygons_2<OutPolygon>(aOffset, aSs, k, same_kernel);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Polygon = Polygon_2<Exact_predicates_inexact_constructions_kernel>,
|
|
||||||
class FT, class Skeleton>
|
|
||||||
std::vector< boost::shared_ptr<Polygon> >
|
|
||||||
inline
|
|
||||||
create_offset_polygons_2(const FT& aOffset,
|
|
||||||
const Skeleton& aSs)
|
|
||||||
{
|
|
||||||
return create_offset_polygons_2<Polygon>(aOffset, aSs, Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// INTERIOR
|
/// INTERIOR
|
||||||
|
|
||||||
template<class FT, class APolygon, class HoleIterator, class OfK, class SsK,
|
template <class OutPolygon_ = CGAL::Default,
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<APolygon, OfK>::type>
|
class FT, class APolygon, class HoleIterator,
|
||||||
std::vector< boost::shared_ptr<OutPolygon> >
|
class OfK = Exact_predicates_inexact_constructions_kernel,
|
||||||
|
class SsK = Exact_predicates_inexact_constructions_kernel>
|
||||||
|
std::vector< boost::shared_ptr<CGAL_SS_i::Polygon_return_type<OutPolygon_, APolygon, OfK> > >
|
||||||
inline
|
inline
|
||||||
create_interior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
create_interior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
const APolygon& aOuterBoundary,
|
const APolygon& aOuterBoundary,
|
||||||
HoleIterator aHolesBegin,
|
HoleIterator aHolesBegin,
|
||||||
HoleIterator aHolesEnd,
|
HoleIterator aHolesEnd,
|
||||||
const OfK& ofk,
|
const OfK& ofk = OfK(),
|
||||||
const SsK& ssk)
|
const SsK& ssk = SsK(),
|
||||||
|
std::enable_if_t<CGAL::is_iterator<HoleIterator>::value>* = 0)
|
||||||
{
|
{
|
||||||
|
using OutPolygon = CGAL_SS_i::Polygon_return_type<OutPolygon_, APolygon, OfK>;
|
||||||
|
|
||||||
return create_offset_polygons_2<OutPolygon>(
|
return create_offset_polygons_2<OutPolygon>(
|
||||||
aOffset,
|
aOffset,
|
||||||
CGAL_SS_i::dereference(
|
CGAL_SS_i::dereference(
|
||||||
|
|
@ -240,65 +239,28 @@ create_interior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
ofk);
|
ofk);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class FT, class APolygon, class HoleIterator, class OfK,
|
// Overload where APolygon is a simple polygon (no holes)
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<APolygon, OfK>::type>
|
template <class OutPolygon_ = CGAL::Default,
|
||||||
std::vector< boost::shared_ptr<OutPolygon> >
|
class FT, class APolygon,
|
||||||
inline
|
class OfK = Exact_predicates_inexact_constructions_kernel,
|
||||||
create_interior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
class SsK = Exact_predicates_inexact_constructions_kernel>
|
||||||
const APolygon& aOuterBoundary,
|
std::vector< boost::shared_ptr<CGAL_SS_i::Polygon_return_type<OutPolygon_, APolygon, OfK> > >
|
||||||
HoleIterator aHolesBegin,
|
|
||||||
HoleIterator aHolesEnd,
|
|
||||||
const OfK& ofk)
|
|
||||||
{
|
|
||||||
return create_interior_skeleton_and_offset_polygons_2(aOffset, aOuterBoundary,
|
|
||||||
aHolesBegin, aHolesEnd,
|
|
||||||
ofk,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Overload where Polygon actually is a simple polygon (no holes)
|
|
||||||
template<class FT, class APolygon, class OfK, class SsK,
|
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<APolygon, OfK>::type>
|
|
||||||
std::vector< boost::shared_ptr<OutPolygon> >
|
|
||||||
inline
|
inline
|
||||||
create_interior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
create_interior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
const APolygon& aPoly,
|
const APolygon& aPoly,
|
||||||
const OfK& ofk,
|
const OfK& ofk = OfK(),
|
||||||
const SsK& ssk,
|
const SsK& ssk = SsK(),
|
||||||
std::enable_if_t<
|
std::enable_if_t<
|
||||||
! CGAL_SS_i::has_Hole_const_iterator<APolygon>::value>* = nullptr)
|
! CGAL_SS_i::has_Hole_const_iterator<APolygon>::value>* = nullptr)
|
||||||
{
|
{
|
||||||
|
using OutPolygon = CGAL_SS_i::Polygon_return_type<OutPolygon_, APolygon, OfK>;
|
||||||
|
|
||||||
std::vector<APolygon> no_holes;
|
std::vector<APolygon> no_holes;
|
||||||
return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly,
|
return create_interior_skeleton_and_offset_polygons_2<OutPolygon>(aOffset, aPoly,
|
||||||
no_holes.begin(), no_holes.end(),
|
no_holes.begin(), no_holes.end(),
|
||||||
ofk, ssk);
|
ofk, ssk);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overloads common to both polygons with and without holes, a simple polygon is returned in any case
|
|
||||||
template<class FT, class APolygon, class OfK,
|
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<APolygon, OfK>::type>
|
|
||||||
std::vector<boost::shared_ptr<OutPolygon> >
|
|
||||||
inline
|
|
||||||
create_interior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
|
||||||
const APolygon& aPoly,
|
|
||||||
const OfK& ofk)
|
|
||||||
{
|
|
||||||
return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class FT, class APolygon,
|
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<
|
|
||||||
APolygon, Exact_predicates_inexact_constructions_kernel>::type>
|
|
||||||
std::vector<boost::shared_ptr<OutPolygon> >
|
|
||||||
inline
|
|
||||||
create_interior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
|
||||||
const APolygon& aPoly)
|
|
||||||
{
|
|
||||||
return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -307,17 +269,21 @@ create_interior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
/*! create_exterior_skeleton_and_offset_polygons_2 (no sorting of the result) */
|
/*! create_exterior_skeleton_and_offset_polygons_2 (no sorting of the result) */
|
||||||
|
|
||||||
// Overload where Polygon actually is a simple polygon (no holes)
|
// Overload where Polygon actually is a simple polygon (no holes)
|
||||||
template<class FT, class APolygon, class OfK, class SsK,
|
template <class OutPolygon_ = CGAL::Default,
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<APolygon, OfK>::type>
|
class FT, class APolygon,
|
||||||
std::vector< boost::shared_ptr<OutPolygon> >
|
class OfK = Exact_predicates_inexact_constructions_kernel,
|
||||||
|
class SsK = Exact_predicates_inexact_constructions_kernel>
|
||||||
|
std::vector< boost::shared_ptr<CGAL_SS_i::Polygon_return_type<OutPolygon_, APolygon, OfK> > >
|
||||||
inline
|
inline
|
||||||
create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
const APolygon& aPoly,
|
const APolygon& aPoly,
|
||||||
const OfK& ofk,
|
const OfK& ofk = OfK(),
|
||||||
const SsK& ssk,
|
const SsK& ssk = SsK(),
|
||||||
std::enable_if_t<
|
std::enable_if_t<
|
||||||
! CGAL_SS_i::has_Hole_const_iterator<APolygon>::value>* = nullptr)
|
! CGAL_SS_i::has_Hole_const_iterator<APolygon>::value>* = nullptr)
|
||||||
{
|
{
|
||||||
|
using OutPolygon = CGAL_SS_i::Polygon_return_type<OutPolygon_, APolygon, OfK>;
|
||||||
|
|
||||||
return create_offset_polygons_2<OutPolygon>(
|
return create_offset_polygons_2<OutPolygon>(
|
||||||
aOffset,
|
aOffset,
|
||||||
CGAL_SS_i::dereference(
|
CGAL_SS_i::dereference(
|
||||||
|
|
@ -329,31 +295,6 @@ create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
ofk);
|
ofk);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overloads common to both polygons with and without holes, a simple polygons is returned in any case
|
|
||||||
template<class FT, class APolygon, class OfK,
|
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<APolygon, OfK>::type>
|
|
||||||
std::vector< boost::shared_ptr<OutPolygon> >
|
|
||||||
inline
|
|
||||||
create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
|
||||||
const APolygon& aPoly,
|
|
||||||
const OfK& ofk)
|
|
||||||
{
|
|
||||||
return create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class FT, class APolygon,
|
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<
|
|
||||||
APolygon, Exact_predicates_inexact_constructions_kernel>::type>
|
|
||||||
std::vector< boost::shared_ptr<OutPolygon> >
|
|
||||||
inline
|
|
||||||
create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
|
||||||
const APolygon& aPoly)
|
|
||||||
{
|
|
||||||
return create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif // CGAL_CREATE_OFFSET_POLYGONS_2_H
|
#endif // CGAL_CREATE_OFFSET_POLYGONS_2_H
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,9 @@
|
||||||
|
|
||||||
#include <CGAL/license/Straight_skeleton_2.h>
|
#include <CGAL/license/Straight_skeleton_2.h>
|
||||||
|
|
||||||
|
#include <CGAL/Straight_skeleton_2/Straight_skeleton_aux.h>
|
||||||
#include <CGAL/arrange_offset_polygons_2.h>
|
#include <CGAL/arrange_offset_polygons_2.h>
|
||||||
#include <CGAL/create_offset_polygons_2.h>
|
#include <CGAL/create_offset_polygons_2.h>
|
||||||
#include <CGAL/Polygon_2.h>
|
|
||||||
#include <CGAL/Polygon_with_holes_2.h>
|
|
||||||
|
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
|
|
@ -36,60 +35,45 @@ namespace CGAL {
|
||||||
/*! create_interior_skeleton_and_offset_polygons_2 (no sorting of the result) */
|
/*! create_interior_skeleton_and_offset_polygons_2 (no sorting of the result) */
|
||||||
|
|
||||||
// overload where PolygonWithHoles actually is a type of Polygon that supports holes
|
// overload where PolygonWithHoles actually is a type of Polygon that supports holes
|
||||||
template<class FT, class PolygonWithHoles, class OfK, class SsK,
|
template <class OutPolygon_ = CGAL::Default,
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<PolygonWithHoles, OfK>::type> // Hole-less polygon type
|
class FT, class PolygonWithHoles,
|
||||||
std::vector<boost::shared_ptr<OutPolygon> >
|
class OfK = Exact_predicates_inexact_constructions_kernel,
|
||||||
|
class SsK = Exact_predicates_inexact_constructions_kernel>
|
||||||
|
std::vector<boost::shared_ptr<CGAL_SS_i::Polygon_return_type<OutPolygon_, PolygonWithHoles, OfK> > >
|
||||||
inline
|
inline
|
||||||
create_interior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
create_interior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
const PolygonWithHoles& aPoly,
|
const PolygonWithHoles& aPoly,
|
||||||
const OfK& ofk,
|
const OfK& ofk = OfK(),
|
||||||
const SsK& ssk,
|
const SsK& ssk = SsK(),
|
||||||
std::enable_if_t<
|
std::enable_if_t<
|
||||||
CGAL_SS_i::has_Hole_const_iterator<PolygonWithHoles>::value>* = nullptr)
|
CGAL_SS_i::has_Hole_const_iterator<PolygonWithHoles>::value>* = nullptr)
|
||||||
{
|
{
|
||||||
return create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(),
|
using OutPolygon = CGAL_SS_i::Polygon_return_type<OutPolygon_, PolygonWithHoles, OfK>;
|
||||||
|
|
||||||
|
return create_interior_skeleton_and_offset_polygons_2<OutPolygon>(aOffset, aPoly.outer_boundary(),
|
||||||
aPoly.holes_begin(), aPoly.holes_end(),
|
aPoly.holes_begin(), aPoly.holes_end(),
|
||||||
ofk, ssk);
|
ofk, ssk);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! create_interior_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */
|
/*! create_interior_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */
|
||||||
|
|
||||||
// Polygon might be a Polygon with holes or not, but it returns a Polygon with holes
|
// 'Polygon' might be a polygon with holes or not, but it returns a polygon with holes
|
||||||
template<class FT, class Polygon, class OfK, class SsK,
|
template <class OutPolygonWithHoles_ = CGAL::Default,
|
||||||
class OutPolygonWithHoles = typename CGAL_SS_i::Default_return_polygon_with_holes_type<Polygon, OfK>::type>
|
class FT, class Polygon,
|
||||||
std::vector<boost::shared_ptr<OutPolygonWithHoles> >
|
class OfK = Exact_predicates_inexact_constructions_kernel,
|
||||||
|
class SsK = Exact_predicates_inexact_constructions_kernel>
|
||||||
|
std::vector<boost::shared_ptr<CGAL_SS_i::Polygon_with_holes_return_type<OutPolygonWithHoles_, Polygon, OfK> > >
|
||||||
inline
|
inline
|
||||||
create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
||||||
const Polygon& aPoly,
|
const Polygon& aPoly,
|
||||||
const OfK& ofk,
|
const OfK& ofk = OfK(),
|
||||||
const SsK& ssk)
|
const SsK& ssk = SsK())
|
||||||
{
|
{
|
||||||
|
using OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<Polygon, OfK>::type;
|
||||||
|
using OutPolygonWithHoles = CGAL_SS_i::Polygon_with_holes_return_type<OutPolygonWithHoles_, Polygon, OfK>;
|
||||||
|
|
||||||
return arrange_offset_polygons_2<OutPolygonWithHoles>(
|
return arrange_offset_polygons_2<OutPolygonWithHoles>(
|
||||||
create_interior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, ssk));
|
create_interior_skeleton_and_offset_polygons_2<OutPolygon>(aOffset, aPoly, ofk, ssk));
|
||||||
}
|
|
||||||
|
|
||||||
template<class FT, class Polygon, class OfK,
|
|
||||||
class OutPolygonWithHoles = typename CGAL_SS_i::Default_return_polygon_with_holes_type<Polygon, OfK>::type>
|
|
||||||
std::vector<boost::shared_ptr<OutPolygonWithHoles> >
|
|
||||||
inline
|
|
||||||
create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
|
||||||
const Polygon& aPoly,
|
|
||||||
const OfK& ofk)
|
|
||||||
{
|
|
||||||
return create_interior_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, ofk,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class FT, class Polygon,
|
|
||||||
class OutPolygonWithHoles = typename CGAL_SS_i::Default_return_polygon_with_holes_type<
|
|
||||||
Polygon, Exact_predicates_inexact_constructions_kernel>::type>
|
|
||||||
std::vector<boost::shared_ptr<OutPolygonWithHoles> >
|
|
||||||
inline
|
|
||||||
create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
|
||||||
const Polygon& aPoly)
|
|
||||||
{
|
|
||||||
return create_interior_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -100,18 +84,22 @@ create_interior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
||||||
/*! create_exterior_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */
|
/*! create_exterior_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */
|
||||||
|
|
||||||
// Polygon might be a Polygon with holes or not, but it returns a Polygon with holes
|
// Polygon might be a Polygon with holes or not, but it returns a Polygon with holes
|
||||||
template<class FT, class Polygon, class OfK, class SsK,
|
template <class OutPolygonWithHoles_ = CGAL::Default,
|
||||||
class OutPolygonWithHoles = typename CGAL_SS_i::Default_return_polygon_with_holes_type<Polygon, OfK>::type>
|
class FT, class Polygon,
|
||||||
std::vector<boost::shared_ptr<OutPolygonWithHoles> >
|
class OfK = Exact_predicates_inexact_constructions_kernel,
|
||||||
|
class SsK = Exact_predicates_inexact_constructions_kernel>
|
||||||
|
std::vector<boost::shared_ptr<CGAL_SS_i::Polygon_with_holes_return_type<OutPolygonWithHoles_, Polygon, OfK> > >
|
||||||
inline
|
inline
|
||||||
create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
||||||
const Polygon& aPoly,
|
const Polygon& aPoly,
|
||||||
const OfK& ofk,
|
const OfK& ofk = OfK(),
|
||||||
const SsK& ssk)
|
const SsK& ssk = SsK())
|
||||||
{
|
{
|
||||||
typedef typename CGAL_SS_i::Default_return_polygon_type<Polygon, OfK>::type Polygon_;
|
using OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<Polygon, OfK>::type;
|
||||||
std::vector<boost::shared_ptr<Polygon_> > raw_output =
|
using OutPolygonWithHoles = CGAL_SS_i::Polygon_with_holes_return_type<OutPolygonWithHoles_, Polygon, OfK>;
|
||||||
create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, ssk);
|
|
||||||
|
std::vector<boost::shared_ptr<OutPolygon> > raw_output =
|
||||||
|
create_exterior_skeleton_and_offset_polygons_2<OutPolygon>(aOffset, aPoly, ofk, ssk);
|
||||||
|
|
||||||
// filter offset of the outer frame
|
// filter offset of the outer frame
|
||||||
std::swap(raw_output[0], raw_output.back());
|
std::swap(raw_output[0], raw_output.back());
|
||||||
|
|
@ -131,26 +119,30 @@ create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
||||||
/*! create_interior_skeleton_and_offset_polygons_2 with a polygon with holes */
|
/*! create_interior_skeleton_and_offset_polygons_2 with a polygon with holes */
|
||||||
|
|
||||||
// overload where PolygonWithHoles actually is a type of Polygon that supports holes
|
// overload where PolygonWithHoles actually is a type of Polygon that supports holes
|
||||||
template<class FT, class PolygonWithHoles, class OfK, class SsK,
|
template <class OutPolygon_ = CGAL::Default,
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<PolygonWithHoles, OfK>::type>
|
class FT, class PolygonWithHoles,
|
||||||
std::vector<boost::shared_ptr<OutPolygon> >
|
class OfK = Exact_predicates_inexact_constructions_kernel,
|
||||||
|
class SsK = Exact_predicates_inexact_constructions_kernel>
|
||||||
|
std::vector<boost::shared_ptr<CGAL_SS_i::Polygon_return_type<OutPolygon_, PolygonWithHoles, OfK> > >
|
||||||
inline
|
inline
|
||||||
create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
const PolygonWithHoles& aPoly,
|
const PolygonWithHoles& aPoly,
|
||||||
const OfK& ofk,
|
const OfK& ofk = OfK(),
|
||||||
const SsK& ssk,
|
const SsK& ssk = SsK(),
|
||||||
std::enable_if_t<
|
std::enable_if_t<
|
||||||
CGAL_SS_i::has_Hole_const_iterator<PolygonWithHoles>::value>* = nullptr)
|
CGAL_SS_i::has_Hole_const_iterator<PolygonWithHoles>::value>* = nullptr)
|
||||||
{
|
{
|
||||||
|
using OutPolygon = CGAL_SS_i::Polygon_return_type<OutPolygon_, PolygonWithHoles, OfK>;
|
||||||
|
|
||||||
std::vector<boost::shared_ptr<OutPolygon> > polygons =
|
std::vector<boost::shared_ptr<OutPolygon> > polygons =
|
||||||
create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), ofk, ssk);
|
create_exterior_skeleton_and_offset_polygons_2<OutPolygon>(aOffset, aPoly.outer_boundary(), ofk, ssk);
|
||||||
|
|
||||||
for (typename PolygonWithHoles::Hole_const_iterator hit=aPoly.holes_begin(); hit!=aPoly.holes_end(); ++hit)
|
for (typename PolygonWithHoles::Hole_const_iterator hit=aPoly.holes_begin(); hit!=aPoly.holes_end(); ++hit)
|
||||||
{
|
{
|
||||||
typename PolygonWithHoles::Polygon_2 hole = *hit;
|
typename PolygonWithHoles::Polygon_2 hole = *hit;
|
||||||
hole.reverse_orientation();
|
hole.reverse_orientation();
|
||||||
std::vector<boost::shared_ptr<OutPolygon> > hole_polygons =
|
std::vector<boost::shared_ptr<OutPolygon> > hole_polygons =
|
||||||
create_interior_skeleton_and_offset_polygons_2(aOffset,
|
create_interior_skeleton_and_offset_polygons_2<OutPolygon>(aOffset,
|
||||||
hole,
|
hole,
|
||||||
ofk, ssk);
|
ofk, ssk);
|
||||||
polygons.insert(polygons.end(), hole_polygons.begin(), hole_polygons.end());
|
polygons.insert(polygons.end(), hole_polygons.begin(), hole_polygons.end());
|
||||||
|
|
@ -159,30 +151,6 @@ create_exterior_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
return polygons;
|
return polygons;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class FT, class Polygon, class OfK,
|
|
||||||
class OutPolygonWithHoles = typename CGAL_SS_i::Default_return_polygon_with_holes_type<Polygon, OfK>::type>
|
|
||||||
std::vector<boost::shared_ptr<OutPolygonWithHoles> >
|
|
||||||
inline
|
|
||||||
create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
|
||||||
const Polygon& aPoly,
|
|
||||||
const OfK& ofk)
|
|
||||||
{
|
|
||||||
return create_exterior_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, ofk,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class FT, class Polygon,
|
|
||||||
class OutPolygonWithHoles = typename CGAL_SS_i::Default_return_polygon_with_holes_type<
|
|
||||||
Polygon, Exact_predicates_inexact_constructions_kernel>::type>
|
|
||||||
std::vector<boost::shared_ptr<OutPolygonWithHoles> >
|
|
||||||
inline
|
|
||||||
create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
|
||||||
const Polygon& aPoly)
|
|
||||||
{
|
|
||||||
return create_exterior_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif // CGAL_CREATE_OFFSET_POLYGONS_FROM_POLYGON_WITH_HOLES_2_H
|
#endif // CGAL_CREATE_OFFSET_POLYGONS_FROM_POLYGON_WITH_HOLES_2_H
|
||||||
|
|
|
||||||
|
|
@ -32,14 +32,14 @@
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
template<class PointIterator, class HoleIterator, class K>
|
template<class PointIterator, class HoleIterator,
|
||||||
|
class K = Exact_predicates_inexact_constructions_kernel>
|
||||||
boost::shared_ptr< Straight_skeleton_2<K> >
|
boost::shared_ptr< Straight_skeleton_2<K> >
|
||||||
create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin
|
create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin
|
||||||
, PointIterator aOuterContour_VerticesEnd
|
, PointIterator aOuterContour_VerticesEnd
|
||||||
, HoleIterator aHolesBegin
|
, HoleIterator aHolesBegin
|
||||||
, HoleIterator aHolesEnd
|
, HoleIterator aHolesEnd
|
||||||
, K const&
|
, const K& = K())
|
||||||
)
|
|
||||||
{
|
{
|
||||||
typedef Straight_skeleton_2<K> Ss ;
|
typedef Straight_skeleton_2<K> Ss ;
|
||||||
|
|
||||||
|
|
@ -62,30 +62,13 @@ create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin
|
||||||
return ssb.construct_skeleton();
|
return ssb.construct_skeleton();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class PointIterator, class HoleIterator>
|
template<class PointIterator,
|
||||||
boost::shared_ptr< Straight_skeleton_2< Exact_predicates_inexact_constructions_kernel > >
|
class K = Exact_predicates_inexact_constructions_kernel>
|
||||||
inline
|
|
||||||
create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin
|
|
||||||
, PointIterator aOuterContour_VerticesEnd
|
|
||||||
, HoleIterator aHolesBegin
|
|
||||||
, HoleIterator aHolesEnd
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return create_interior_straight_skeleton_2(aOuterContour_VerticesBegin
|
|
||||||
,aOuterContour_VerticesEnd
|
|
||||||
,aHolesBegin
|
|
||||||
,aHolesEnd
|
|
||||||
,Exact_predicates_inexact_constructions_kernel()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class PointIterator, class K>
|
|
||||||
boost::shared_ptr< Straight_skeleton_2<K> >
|
boost::shared_ptr< Straight_skeleton_2<K> >
|
||||||
inline
|
inline
|
||||||
create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin
|
create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin
|
||||||
, PointIterator aOuterContour_VerticesEnd
|
, PointIterator aOuterContour_VerticesEnd
|
||||||
, K const& k
|
, const K& k = K())
|
||||||
)
|
|
||||||
{
|
{
|
||||||
typedef typename std::iterator_traits<PointIterator>::value_type InputPoint ;
|
typedef typename std::iterator_traits<PointIterator>::value_type InputPoint ;
|
||||||
typedef typename Kernel_traits<InputPoint>::Kernel InputKernel ;
|
typedef typename Kernel_traits<InputPoint>::Kernel InputKernel ;
|
||||||
|
|
@ -99,24 +82,12 @@ create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class PointIterator>
|
template<class Polygon,
|
||||||
boost::shared_ptr< Straight_skeleton_2<Exact_predicates_inexact_constructions_kernel> >
|
class K = Exact_predicates_inexact_constructions_kernel>
|
||||||
inline
|
|
||||||
create_interior_straight_skeleton_2 ( PointIterator aOuterContour_VerticesBegin
|
|
||||||
, PointIterator aOuterContour_VerticesEnd
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return create_interior_straight_skeleton_2(aOuterContour_VerticesBegin
|
|
||||||
,aOuterContour_VerticesEnd
|
|
||||||
,Exact_predicates_inexact_constructions_kernel()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class Polygon, class K>
|
|
||||||
boost::shared_ptr< Straight_skeleton_2<K> >
|
boost::shared_ptr< Straight_skeleton_2<K> >
|
||||||
inline
|
inline
|
||||||
create_interior_straight_skeleton_2 ( Polygon const& aOutContour,
|
create_interior_straight_skeleton_2 ( const Polygon& aOutContour,
|
||||||
K const& k,
|
const K& k = K(),
|
||||||
std::enable_if_t<
|
std::enable_if_t<
|
||||||
! CGAL_SS_i::has_Hole_const_iterator<Polygon>::value>* = nullptr)
|
! CGAL_SS_i::has_Hole_const_iterator<Polygon>::value>* = nullptr)
|
||||||
{
|
{
|
||||||
|
|
@ -126,26 +97,18 @@ create_interior_straight_skeleton_2 ( Polygon const& aOutContour,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class Polygon>
|
|
||||||
boost::shared_ptr< Straight_skeleton_2< Exact_predicates_inexact_constructions_kernel > >
|
|
||||||
inline
|
|
||||||
create_interior_straight_skeleton_2 ( Polygon const& aOutContour )
|
|
||||||
{
|
|
||||||
return create_interior_straight_skeleton_2(aOutContour, Exact_predicates_inexact_constructions_kernel() );
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// EXTERIOR
|
/// EXTERIOR
|
||||||
|
|
||||||
template<class FT, class PointIterator, class K>
|
template<class FT, class PointIterator,
|
||||||
|
class K = Exact_predicates_inexact_constructions_kernel>
|
||||||
boost::shared_ptr< Straight_skeleton_2<K> >
|
boost::shared_ptr< Straight_skeleton_2<K> >
|
||||||
create_exterior_straight_skeleton_2 ( FT const& aMaxOffset
|
create_exterior_straight_skeleton_2 ( FT const& aMaxOffset
|
||||||
, PointIterator aVerticesBegin
|
, PointIterator aVerticesBegin
|
||||||
, PointIterator aVerticesEnd
|
, PointIterator aVerticesEnd
|
||||||
, K const& k
|
, const K& k = K())
|
||||||
)
|
|
||||||
{
|
{
|
||||||
CGAL_precondition( aMaxOffset > 0 ) ;
|
CGAL_precondition( aMaxOffset > 0 ) ;
|
||||||
|
|
||||||
|
|
@ -195,25 +158,13 @@ create_exterior_straight_skeleton_2 ( FT const& aMaxOffset
|
||||||
return rSkeleton ;
|
return rSkeleton ;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class FT, class PointIterator>
|
template<class FT, class Polygon,
|
||||||
boost::shared_ptr< Straight_skeleton_2<Exact_predicates_inexact_constructions_kernel> >
|
class K = Exact_predicates_inexact_constructions_kernel>
|
||||||
inline
|
|
||||||
create_exterior_straight_skeleton_2 ( FT const& aMaxOffset
|
|
||||||
, PointIterator aVerticesBegin
|
|
||||||
, PointIterator aVerticesEnd
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return create_exterior_straight_skeleton_2(aMaxOffset
|
|
||||||
,aVerticesBegin
|
|
||||||
,aVerticesEnd
|
|
||||||
,Exact_predicates_inexact_constructions_kernel()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class FT, class Polygon, class K>
|
|
||||||
boost::shared_ptr< Straight_skeleton_2<K> >
|
boost::shared_ptr< Straight_skeleton_2<K> >
|
||||||
inline
|
inline
|
||||||
create_exterior_straight_skeleton_2 ( FT const& aMaxOffset, Polygon const& aPoly, K const& k )
|
create_exterior_straight_skeleton_2(const FT& aMaxOffset,
|
||||||
|
const Polygon& aPoly,
|
||||||
|
const K& k = K())
|
||||||
{
|
{
|
||||||
return create_exterior_straight_skeleton_2(aMaxOffset
|
return create_exterior_straight_skeleton_2(aMaxOffset
|
||||||
,CGAL_SS_i::vertices_begin(aPoly)
|
,CGAL_SS_i::vertices_begin(aPoly)
|
||||||
|
|
@ -222,17 +173,6 @@ create_exterior_straight_skeleton_2 ( FT const& aMaxOffset, Polygon const& aPoly
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class FT, class Polygon>
|
|
||||||
boost::shared_ptr< Straight_skeleton_2<Exact_predicates_inexact_constructions_kernel> >
|
|
||||||
inline
|
|
||||||
create_exterior_straight_skeleton_2 ( FT const& aMaxOffset, Polygon const& aPoly )
|
|
||||||
{
|
|
||||||
return create_exterior_straight_skeleton_2(aMaxOffset
|
|
||||||
,aPoly
|
|
||||||
,Exact_predicates_inexact_constructions_kernel()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif // CGAL_CREATE_STRAIGHT_SKELETON_2_H
|
#endif // CGAL_CREATE_STRAIGHT_SKELETON_2_H
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,6 @@
|
||||||
#include <CGAL/assertions.h>
|
#include <CGAL/assertions.h>
|
||||||
#include <CGAL/Cartesian_converter.h>
|
#include <CGAL/Cartesian_converter.h>
|
||||||
#include <CGAL/Kernel_traits.h>
|
#include <CGAL/Kernel_traits.h>
|
||||||
#include <CGAL/Polygon_2.h>
|
|
||||||
#include <CGAL/Polygon_with_holes_2.h>
|
|
||||||
#include <CGAL/tags.h>
|
#include <CGAL/tags.h>
|
||||||
|
|
||||||
#include <boost/optional/optional.hpp>
|
#include <boost/optional/optional.hpp>
|
||||||
|
|
@ -202,10 +200,11 @@ create_partial_exterior_weighted_straight_skeleton_2(const FT& aMaxOffset,
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// INTERIOR
|
/// INTERIOR
|
||||||
|
|
||||||
template<class FT, class APolygon, class HoleIterator, class Weights, class HoleWeightsIterator,
|
template <class OutPolygon_ = CGAL::Default,
|
||||||
class OfK, class SsK,
|
class FT, class APolygon, class HoleIterator, class Weights, class HoleWeightsIterator,
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<APolygon, OfK>::type>
|
class OfK = Exact_predicates_inexact_constructions_kernel,
|
||||||
std::vector< boost::shared_ptr<OutPolygon> >
|
class SsK = Exact_predicates_inexact_constructions_kernel>
|
||||||
|
std::vector< boost::shared_ptr<CGAL_SS_i::Polygon_return_type<OutPolygon_, APolygon, OfK> > >
|
||||||
inline
|
inline
|
||||||
create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
const APolygon& aOuterBoundary,
|
const APolygon& aOuterBoundary,
|
||||||
|
|
@ -214,9 +213,11 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
const Weights& aWeights,
|
const Weights& aWeights,
|
||||||
HoleWeightsIterator aHoles_WeightsBegin,
|
HoleWeightsIterator aHoles_WeightsBegin,
|
||||||
HoleWeightsIterator aHoles_WeightsEnd,
|
HoleWeightsIterator aHoles_WeightsEnd,
|
||||||
const OfK& ofk,
|
const OfK& ofk = OfK(),
|
||||||
const SsK& ssk)
|
const SsK& ssk = SsK())
|
||||||
{
|
{
|
||||||
|
using OutPolygon = CGAL_SS_i::Polygon_return_type<OutPolygon_, APolygon, OfK>;
|
||||||
|
|
||||||
if(aHolesBegin == aHolesEnd) // see @partial_wsls_pwh
|
if(aHolesBegin == aHolesEnd) // see @partial_wsls_pwh
|
||||||
{
|
{
|
||||||
return create_offset_polygons_2<OutPolygon>(
|
return create_offset_polygons_2<OutPolygon>(
|
||||||
|
|
@ -254,71 +255,35 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class FT, class APolygon, class HoleIterator, class Weights, class OfK,
|
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<APolygon, OfK>::type>
|
|
||||||
std::vector< boost::shared_ptr<OutPolygon> >
|
|
||||||
inline
|
|
||||||
create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
|
||||||
const APolygon& aOuterBoundary,
|
|
||||||
HoleIterator aHolesBegin,
|
|
||||||
HoleIterator aHolesEnd,
|
|
||||||
const Weights& aWeights,
|
|
||||||
const OfK& ofk)
|
|
||||||
{
|
|
||||||
return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aOuterBoundary,
|
|
||||||
aHolesBegin, aHolesEnd,
|
|
||||||
aWeights,
|
|
||||||
ofk,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Overload where Polygon actually is a simple polygon (no holes)
|
// Overload where Polygon actually is a simple polygon (no holes)
|
||||||
template<class FT, class APolygon, class Weights, class OfK, class SsK,
|
template <class OutPolygon_ = CGAL::Default,
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<APolygon, OfK>::type>
|
class FT, class APolygon, class Weights,
|
||||||
std::vector< boost::shared_ptr<OutPolygon> >
|
class OfK = Exact_predicates_inexact_constructions_kernel,
|
||||||
|
class SsK = Exact_predicates_inexact_constructions_kernel>
|
||||||
|
std::vector< boost::shared_ptr<CGAL_SS_i::Polygon_return_type<OutPolygon_, APolygon, OfK> > >
|
||||||
inline
|
inline
|
||||||
create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
const APolygon& aPoly,
|
const APolygon& aPoly,
|
||||||
const Weights& aWeights,
|
const Weights& aWeights,
|
||||||
const OfK& ofk,
|
const OfK& ofk = OfK(),
|
||||||
const SsK& ssk,
|
const SsK& ssk = SsK(),
|
||||||
std::enable_if_t<
|
std::enable_if_t<
|
||||||
! CGAL_SS_i::has_Hole_const_iterator<APolygon>::value>* = nullptr)
|
! CGAL_SS_i::has_Hole_const_iterator<APolygon>::value>* = nullptr)
|
||||||
{
|
{
|
||||||
|
using OutPolygon = CGAL_SS_i::Polygon_return_type<OutPolygon_, APolygon, OfK>;
|
||||||
|
|
||||||
|
using IFT = typename boost::range_value<typename boost::range_value<Weights>::type>::type;
|
||||||
|
|
||||||
std::vector<APolygon> no_holes;
|
std::vector<APolygon> no_holes;
|
||||||
return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly,
|
std::vector<std::vector<IFT> > no_hole_weights;
|
||||||
|
|
||||||
|
return create_interior_weighted_skeleton_and_offset_polygons_2<OutPolygon>(aOffset, aPoly,
|
||||||
no_holes.begin(), no_holes.end(),
|
no_holes.begin(), no_holes.end(),
|
||||||
aWeights,
|
aWeights[0],
|
||||||
|
no_hole_weights.begin(), no_hole_weights.end(),
|
||||||
ofk, ssk);
|
ofk, ssk);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overloads common to both polygons with and without holes, a simple polygon is returned in any case
|
|
||||||
template<class FT, class APolygon, class Weights, class OfK,
|
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<APolygon, OfK>::type>
|
|
||||||
std::vector<boost::shared_ptr<OutPolygon> >
|
|
||||||
inline
|
|
||||||
create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
|
||||||
const APolygon& aPoly,
|
|
||||||
const Weights& aWeights,
|
|
||||||
const OfK& ofk)
|
|
||||||
{
|
|
||||||
return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class FT, class APolygon, class Weights,
|
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<
|
|
||||||
APolygon, Exact_predicates_inexact_constructions_kernel>::type>
|
|
||||||
std::vector<boost::shared_ptr<OutPolygon> >
|
|
||||||
inline
|
|
||||||
create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
|
||||||
const APolygon& aPoly,
|
|
||||||
const Weights& aWeights)
|
|
||||||
{
|
|
||||||
return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -327,18 +292,22 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
/*! create_exterior_skeleton_and_offset_polygons_2 (no sorting of the result) */
|
/*! create_exterior_skeleton_and_offset_polygons_2 (no sorting of the result) */
|
||||||
|
|
||||||
// Overload where Polygon actually is a simple polygon (no holes)
|
// Overload where Polygon actually is a simple polygon (no holes)
|
||||||
template<class FT, class APolygon, class Weights, class OfK, class SsK,
|
template <class OutPolygon_ = CGAL::Default,
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<APolygon, OfK>::type>
|
class FT, class APolygon, class Weights,
|
||||||
std::vector< boost::shared_ptr<OutPolygon> >
|
class OfK = Exact_predicates_inexact_constructions_kernel,
|
||||||
|
class SsK = Exact_predicates_inexact_constructions_kernel>
|
||||||
|
std::vector<boost::shared_ptr<CGAL_SS_i::Polygon_return_type<OutPolygon_, APolygon, OfK> > >
|
||||||
inline
|
inline
|
||||||
create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
const APolygon& aPoly,
|
const APolygon& aPoly,
|
||||||
const Weights& aWeights,
|
const Weights& aWeights,
|
||||||
const OfK& ofk,
|
const OfK& ofk = OfK(),
|
||||||
const SsK& ssk,
|
const SsK& ssk = SsK(),
|
||||||
std::enable_if_t<
|
std::enable_if_t<
|
||||||
! CGAL_SS_i::has_Hole_const_iterator<APolygon>::value>* = nullptr)
|
! CGAL_SS_i::has_Hole_const_iterator<APolygon>::value>* = nullptr)
|
||||||
{
|
{
|
||||||
|
using OutPolygon = CGAL_SS_i::Polygon_return_type<OutPolygon_, APolygon, OfK>;
|
||||||
|
|
||||||
return create_offset_polygons_2<OutPolygon>(
|
return create_offset_polygons_2<OutPolygon>(
|
||||||
aOffset,
|
aOffset,
|
||||||
CGAL_SS_i::dereference(
|
CGAL_SS_i::dereference(
|
||||||
|
|
@ -346,39 +315,12 @@ create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
aOffset,
|
aOffset,
|
||||||
CGAL_SS_i::vertices_begin(aPoly),
|
CGAL_SS_i::vertices_begin(aPoly),
|
||||||
CGAL_SS_i::vertices_end (aPoly),
|
CGAL_SS_i::vertices_end (aPoly),
|
||||||
aWeights[0].begin(),
|
std::begin(aWeights[0]),
|
||||||
aWeights[0].end(),
|
std::end(aWeights[0]),
|
||||||
ssk)),
|
ssk)),
|
||||||
ofk);
|
ofk);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overloads common to both polygons with and without holes, a simple polygons is returned in any case
|
|
||||||
template<class FT, class APolygon, class Weights, class OfK,
|
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<APolygon, OfK>::type>
|
|
||||||
std::vector< boost::shared_ptr<OutPolygon> >
|
|
||||||
inline
|
|
||||||
create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
|
||||||
const APolygon& aPoly,
|
|
||||||
const Weights& aWeights,
|
|
||||||
const OfK& ofk)
|
|
||||||
{
|
|
||||||
return create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class FT, class APolygon, class Weights,
|
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<
|
|
||||||
APolygon, Exact_predicates_inexact_constructions_kernel>::type>
|
|
||||||
std::vector< boost::shared_ptr<OutPolygon> >
|
|
||||||
inline
|
|
||||||
create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
|
||||||
const APolygon& aPoly,
|
|
||||||
const Weights& aWeights)
|
|
||||||
{
|
|
||||||
return create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif // CGAL_CREATE_WEIGHTED_OFFSET_POLYGONS_2_H
|
#endif // CGAL_CREATE_WEIGHTED_OFFSET_POLYGONS_2_H
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,9 @@
|
||||||
|
|
||||||
#include <CGAL/license/Straight_skeleton_2.h>
|
#include <CGAL/license/Straight_skeleton_2.h>
|
||||||
|
|
||||||
|
#include <CGAL/Straight_skeleton_2/Straight_skeleton_aux.h>
|
||||||
#include <CGAL/arrange_offset_polygons_2.h>
|
#include <CGAL/arrange_offset_polygons_2.h>
|
||||||
#include <CGAL/create_offset_polygons_2.h>
|
#include <CGAL/create_weighted_offset_polygons_2.h>
|
||||||
#include <CGAL/Polygon_2.h>
|
|
||||||
#include <CGAL/Polygon_with_holes_2.h>
|
|
||||||
|
|
||||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
|
|
@ -36,19 +35,23 @@ namespace CGAL {
|
||||||
/*! create_interior_skeleton_and_offset_polygons_2 (no sorting of the result) */
|
/*! create_interior_skeleton_and_offset_polygons_2 (no sorting of the result) */
|
||||||
|
|
||||||
// overload where PolygonWithHoles actually is a type of Polygon that supports holes
|
// overload where PolygonWithHoles actually is a type of Polygon that supports holes
|
||||||
template<class FT, class PolygonWithHoles, class Weights, class OfK, class SsK,
|
template <class OutPolygon_ = CGAL::Default, // Hole-less polygon type
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<PolygonWithHoles, OfK>::type> // Hole-less polygon type
|
class FT, class PolygonWithHoles, class Weights,
|
||||||
std::vector<boost::shared_ptr<OutPolygon> >
|
class OfK = Exact_predicates_inexact_constructions_kernel,
|
||||||
|
class SsK = Exact_predicates_inexact_constructions_kernel>
|
||||||
|
std::vector<boost::shared_ptr<CGAL_SS_i::Polygon_return_type<OutPolygon_, PolygonWithHoles, OfK> > >
|
||||||
inline
|
inline
|
||||||
create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
const PolygonWithHoles& aPoly,
|
const PolygonWithHoles& aPoly,
|
||||||
const Weights& aWeights,
|
const Weights& aWeights,
|
||||||
const OfK& ofk,
|
const OfK& ofk = OfK(),
|
||||||
const SsK& ssk,
|
const SsK& ssk = SsK(),
|
||||||
std::enable_if_t<
|
std::enable_if_t<
|
||||||
CGAL_SS_i::has_Hole_const_iterator<PolygonWithHoles>::value>* = nullptr)
|
CGAL_SS_i::has_Hole_const_iterator<PolygonWithHoles>::value>* = nullptr)
|
||||||
{
|
{
|
||||||
return create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(),
|
using OutPolygon = CGAL_SS_i::Polygon_return_type<OutPolygon_, PolygonWithHoles, OfK>;
|
||||||
|
|
||||||
|
return create_interior_weighted_skeleton_and_offset_polygons_2<OutPolygon>(aOffset, aPoly.outer_boundary(),
|
||||||
aPoly.holes_begin(), aPoly.holes_end(),
|
aPoly.holes_begin(), aPoly.holes_end(),
|
||||||
aWeights[0],
|
aWeights[0],
|
||||||
std::next(std::begin(aWeights)),
|
std::next(std::begin(aWeights)),
|
||||||
|
|
@ -59,44 +62,23 @@ create_interior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
/*! create_interior_weighted_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */
|
/*! create_interior_weighted_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */
|
||||||
|
|
||||||
// Polygon might be a Polygon with holes or not, but it returns a Polygon with holes
|
// Polygon might be a Polygon with holes or not, but it returns a Polygon with holes
|
||||||
template<class FT, class Polygon, class Weights, class OfK, class SsK,
|
template <class OutPolygonWithHoles_ = CGAL::Default,
|
||||||
class OutPolygonWithHoles = typename CGAL_SS_i::Default_return_polygon_with_holes_type<Polygon, OfK>::type>
|
class FT, class Polygon, class Weights,
|
||||||
std::vector<boost::shared_ptr<OutPolygonWithHoles> >
|
class OfK = Exact_predicates_inexact_constructions_kernel,
|
||||||
|
class SsK = Exact_predicates_inexact_constructions_kernel>
|
||||||
|
std::vector<boost::shared_ptr<CGAL_SS_i::Polygon_with_holes_return_type<OutPolygonWithHoles_, Polygon, OfK> > >
|
||||||
inline
|
inline
|
||||||
create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
||||||
const Polygon& aPoly,
|
const Polygon& aPoly,
|
||||||
const Weights& aWeights,
|
const Weights& aWeights,
|
||||||
const OfK& ofk,
|
const OfK& ofk = OfK(),
|
||||||
const SsK& ssk)
|
const SsK& ssk = SsK())
|
||||||
{
|
{
|
||||||
|
using OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<Polygon, OfK>::type;
|
||||||
|
using OutPolygonWithHoles = CGAL_SS_i::Polygon_with_holes_return_type<OutPolygonWithHoles_, Polygon, OfK>;
|
||||||
|
|
||||||
return arrange_offset_polygons_2<OutPolygonWithHoles>(
|
return arrange_offset_polygons_2<OutPolygonWithHoles>(
|
||||||
create_interior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, ssk));
|
create_interior_weighted_skeleton_and_offset_polygons_2<OutPolygon>(aOffset, aPoly, aWeights, ofk, ssk));
|
||||||
}
|
|
||||||
|
|
||||||
template<class FT, class Polygon, class Weights, class OfK,
|
|
||||||
class OutPolygonWithHoles = typename CGAL_SS_i::Default_return_polygon_with_holes_type<Polygon, OfK>::type>
|
|
||||||
std::vector<boost::shared_ptr<OutPolygonWithHoles> >
|
|
||||||
inline
|
|
||||||
create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
|
||||||
const Polygon& aPoly,
|
|
||||||
const Weights& aWeights,
|
|
||||||
const OfK& ofk)
|
|
||||||
{
|
|
||||||
return create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, aWeights, ofk,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class FT, class Polygon, class Weights,
|
|
||||||
class OutPolygonWithHoles = typename CGAL_SS_i::Default_return_polygon_with_holes_type<
|
|
||||||
Polygon, Exact_predicates_inexact_constructions_kernel>::type>
|
|
||||||
std::vector<boost::shared_ptr<OutPolygonWithHoles> >
|
|
||||||
inline
|
|
||||||
create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
|
||||||
const Polygon& aPoly,
|
|
||||||
const Weights& aWeights)
|
|
||||||
{
|
|
||||||
return create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, aWeights,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -104,21 +86,25 @@ create_interior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOf
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// EXTERIOR
|
/// EXTERIOR
|
||||||
|
|
||||||
/*! create_exterior_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */
|
/*! create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2 (orders the resulting polygons) */
|
||||||
|
|
||||||
// Polygon might be a Polygon with holes or not, but it returns a Polygon with holes
|
// Polygon might be a Polygon with holes or not, but it returns a Polygon with holes
|
||||||
template<class FT, class Polygon, class Weights, class OfK, class SsK,
|
template <class OutPolygonWithHoles_ = CGAL::Default,
|
||||||
class OutPolygonWithHoles = typename CGAL_SS_i::Default_return_polygon_with_holes_type<Polygon, OfK>::type>
|
class FT, class Polygon, class Weights,
|
||||||
std::vector<boost::shared_ptr<OutPolygonWithHoles> >
|
class OfK = Exact_predicates_inexact_constructions_kernel,
|
||||||
|
class SsK = Exact_predicates_inexact_constructions_kernel>
|
||||||
|
std::vector<boost::shared_ptr<CGAL_SS_i::Polygon_with_holes_return_type<OutPolygonWithHoles_, Polygon, OfK> > >
|
||||||
create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
||||||
const Polygon& aPoly,
|
const Polygon& aPoly,
|
||||||
const Weights& aWeights,
|
const Weights& aWeights,
|
||||||
const OfK& ofk,
|
const OfK& ofk = OfK(),
|
||||||
const SsK& ssk)
|
const SsK& ssk = SsK())
|
||||||
{
|
{
|
||||||
typedef typename CGAL_SS_i::Default_return_polygon_type<Polygon, OfK>::type Polygon_;
|
using OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<Polygon, OfK>::type;
|
||||||
std::vector<boost::shared_ptr<Polygon_> > raw_output =
|
using OutPolygonWithHoles = CGAL_SS_i::Polygon_with_holes_return_type<OutPolygonWithHoles_, Polygon, OfK>;
|
||||||
create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, ssk);
|
|
||||||
|
std::vector<boost::shared_ptr<OutPolygon> > raw_output =
|
||||||
|
create_exterior_weighted_skeleton_and_offset_polygons_2<OutPolygon>(aOffset, aPoly, aWeights, ofk, ssk);
|
||||||
|
|
||||||
// filter offset of the outer frame
|
// filter offset of the outer frame
|
||||||
std::swap(raw_output[0], raw_output.back());
|
std::swap(raw_output[0], raw_output.back());
|
||||||
|
|
@ -138,22 +124,26 @@ create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOf
|
||||||
/*! create_interior_skeleton_and_offset_polygons_2 with a polygon with holes */
|
/*! create_interior_skeleton_and_offset_polygons_2 with a polygon with holes */
|
||||||
|
|
||||||
// overload where PolygonWithHoles actually is a type of Polygon that supports holes
|
// overload where PolygonWithHoles actually is a type of Polygon that supports holes
|
||||||
template<class FT, class PolygonWithHoles, class Weights, class OfK, class SsK,
|
template <class OutPolygon_ = CGAL::Default,
|
||||||
class OutPolygon = typename CGAL_SS_i::Default_return_polygon_type<PolygonWithHoles, OfK>::type>
|
class FT, class PolygonWithHoles, class Weights,
|
||||||
std::vector<boost::shared_ptr<OutPolygon> >
|
class OfK = Exact_predicates_inexact_constructions_kernel,
|
||||||
|
class SsK = Exact_predicates_inexact_constructions_kernel>
|
||||||
|
std::vector<boost::shared_ptr<CGAL_SS_i::Polygon_return_type<OutPolygon_, PolygonWithHoles, OfK> > >
|
||||||
inline
|
inline
|
||||||
create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
const PolygonWithHoles& aPoly,
|
const PolygonWithHoles& aPoly,
|
||||||
const Weights& aWeights,
|
const Weights& aWeights,
|
||||||
const OfK& ofk,
|
const OfK& ofk = OfK(),
|
||||||
const SsK& ssk,
|
const SsK& ssk = SsK(),
|
||||||
std::enable_if_t<
|
std::enable_if_t<
|
||||||
CGAL_SS_i::has_Hole_const_iterator<PolygonWithHoles>::value>* = nullptr)
|
CGAL_SS_i::has_Hole_const_iterator<PolygonWithHoles>::value>* = nullptr)
|
||||||
{
|
{
|
||||||
|
using OutPolygon = CGAL_SS_i::Polygon_return_type<OutPolygon_, PolygonWithHoles, OfK>;
|
||||||
|
|
||||||
CGAL_precondition(aWeights.size() == aPoly.number_of_holes() + 1);
|
CGAL_precondition(aWeights.size() == aPoly.number_of_holes() + 1);
|
||||||
|
|
||||||
std::vector<boost::shared_ptr<OutPolygon> > polygons =
|
std::vector<boost::shared_ptr<OutPolygon> > polygons =
|
||||||
create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly.outer_boundary(), {aWeights[0]}, ofk, ssk);
|
create_exterior_weighted_skeleton_and_offset_polygons_2<OutPolygon>(aOffset, aPoly.outer_boundary(), aWeights, ofk, ssk);
|
||||||
|
|
||||||
std::size_t weight_pos = 1;
|
std::size_t weight_pos = 1;
|
||||||
for(typename PolygonWithHoles::Hole_const_iterator hit=aPoly.holes_begin(); hit!=aPoly.holes_end(); ++hit, ++weight_pos)
|
for(typename PolygonWithHoles::Hole_const_iterator hit=aPoly.holes_begin(); hit!=aPoly.holes_end(); ++hit, ++weight_pos)
|
||||||
|
|
@ -161,7 +151,7 @@ create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
typename PolygonWithHoles::Polygon_2 hole = *hit;
|
typename PolygonWithHoles::Polygon_2 hole = *hit;
|
||||||
hole.reverse_orientation();
|
hole.reverse_orientation();
|
||||||
std::vector<boost::shared_ptr<OutPolygon> > hole_polygons =
|
std::vector<boost::shared_ptr<OutPolygon> > hole_polygons =
|
||||||
create_interior_skeleton_and_offset_polygons_2(aOffset,
|
create_interior_weighted_skeleton_and_offset_polygons_2<OutPolygon>(aOffset,
|
||||||
hole,
|
hole,
|
||||||
{aWeights[weight_pos]},
|
{aWeights[weight_pos]},
|
||||||
ofk, ssk);
|
ofk, ssk);
|
||||||
|
|
@ -171,32 +161,6 @@ create_exterior_weighted_skeleton_and_offset_polygons_2(const FT& aOffset,
|
||||||
return polygons;
|
return polygons;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class FT, class Polygon, class Weights, class OfK,
|
|
||||||
class OutPolygonWithHoles = typename CGAL_SS_i::Default_return_polygon_with_holes_type<Polygon, OfK>::type>
|
|
||||||
std::vector<boost::shared_ptr<OutPolygonWithHoles> >
|
|
||||||
inline
|
|
||||||
create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
|
||||||
const Polygon& aPoly,
|
|
||||||
const Weights& aWeights,
|
|
||||||
const OfK& ofk)
|
|
||||||
{
|
|
||||||
return create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, aWeights, ofk,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class FT, class Polygon, class Weights,
|
|
||||||
class OutPolygonWithHoles = typename CGAL_SS_i::Default_return_polygon_with_holes_type<
|
|
||||||
Polygon, Exact_predicates_inexact_constructions_kernel>::type>
|
|
||||||
std::vector<boost::shared_ptr<OutPolygonWithHoles> >
|
|
||||||
inline
|
|
||||||
create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
|
||||||
const Polygon& aPoly,
|
|
||||||
const Weights& aWeights)
|
|
||||||
{
|
|
||||||
return create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(aOffset, aPoly, aWeights,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif // CGAL_CREATE_WEIGHTED_OFFSET_POLYGONS_FROM_POLYGON_WITH_HOLES_2_H
|
#endif // CGAL_CREATE_WEIGHTED_OFFSET_POLYGONS_FROM_POLYGON_WITH_HOLES_2_H
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ namespace CGAL {
|
||||||
|
|
||||||
template <typename PointIterator, typename HoleIterator,
|
template <typename PointIterator, typename HoleIterator,
|
||||||
typename WeightIterator, typename HoleWeightsIterator,
|
typename WeightIterator, typename HoleWeightsIterator,
|
||||||
typename K>
|
typename K = Exact_predicates_inexact_constructions_kernel>
|
||||||
boost::shared_ptr<Straight_skeleton_2<K> >
|
boost::shared_ptr<Straight_skeleton_2<K> >
|
||||||
create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin,
|
create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin,
|
||||||
PointIterator outer_contour_vertices_end,
|
PointIterator outer_contour_vertices_end,
|
||||||
|
|
@ -43,7 +43,7 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice
|
||||||
WeightIterator outer_contour_weights_end,
|
WeightIterator outer_contour_weights_end,
|
||||||
HoleWeightsIterator holes_weights_begin,
|
HoleWeightsIterator holes_weights_begin,
|
||||||
HoleWeightsIterator holes_weights_end,
|
HoleWeightsIterator holes_weights_end,
|
||||||
const K&)
|
const K& = K())
|
||||||
{
|
{
|
||||||
using Skeleton = Straight_skeleton_2<K>;
|
using Skeleton = Straight_skeleton_2<K>;
|
||||||
|
|
||||||
|
|
@ -77,37 +77,16 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice
|
||||||
return ssb.construct_skeleton();
|
return ssb.construct_skeleton();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename PointIterator, typename HoleIterator,
|
|
||||||
typename WeightIterator, typename HoleWeightsIterator,
|
|
||||||
typename Weights>
|
|
||||||
boost::shared_ptr<Straight_skeleton_2<Exact_predicates_inexact_constructions_kernel> >
|
|
||||||
inline
|
|
||||||
create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin,
|
|
||||||
PointIterator outer_contour_vertices_end,
|
|
||||||
HoleIterator holes_begin,
|
|
||||||
HoleIterator holes_end,
|
|
||||||
WeightIterator outer_contour_weights_begin,
|
|
||||||
WeightIterator outer_contour_weights_end,
|
|
||||||
HoleWeightsIterator holes_weights_begin,
|
|
||||||
HoleWeightsIterator holes_weights_end)
|
|
||||||
{
|
|
||||||
return create_interior_weighted_straight_skeleton_2(outer_contour_vertices_begin, outer_contour_vertices_end,
|
|
||||||
holes_begin, holes_end,
|
|
||||||
outer_contour_weights_begin, outer_contour_weights_end,
|
|
||||||
holes_weights_begin, holes_weights_end,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename PointIterator,
|
template <typename PointIterator,
|
||||||
typename WeightIterator,
|
typename WeightIterator,
|
||||||
typename K>
|
typename K = Exact_predicates_inexact_constructions_kernel>
|
||||||
boost::shared_ptr<Straight_skeleton_2<K> >
|
boost::shared_ptr<Straight_skeleton_2<K> >
|
||||||
inline
|
inline
|
||||||
create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin,
|
create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin,
|
||||||
PointIterator outer_contour_vertices_end,
|
PointIterator outer_contour_vertices_end,
|
||||||
WeightIterator outer_contour_weights_begin,
|
WeightIterator outer_contour_weights_begin,
|
||||||
WeightIterator outer_contour_weights_end,
|
WeightIterator outer_contour_weights_end,
|
||||||
const K& k)
|
const K& k = K())
|
||||||
{
|
{
|
||||||
using InputPoint = typename std::iterator_traits<PointIterator>::value_type;
|
using InputPoint = typename std::iterator_traits<PointIterator>::value_type;
|
||||||
using InputKernel = typename Kernel_traits<InputPoint>::Kernel;
|
using InputKernel = typename Kernel_traits<InputPoint>::Kernel;
|
||||||
|
|
@ -127,51 +106,23 @@ create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertice
|
||||||
k);
|
k);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename PointIterator,
|
|
||||||
typename WeightIterator>
|
|
||||||
boost::shared_ptr<Straight_skeleton_2<Exact_predicates_inexact_constructions_kernel> >
|
|
||||||
inline
|
|
||||||
create_interior_weighted_straight_skeleton_2(PointIterator outer_contour_vertices_begin,
|
|
||||||
PointIterator outer_contour_vertices_end,
|
|
||||||
WeightIterator outer_contour_weights_begin,
|
|
||||||
WeightIterator outer_contour_weights_end)
|
|
||||||
{
|
|
||||||
return create_interior_weighted_straight_skeleton_2(outer_contour_vertices_begin,
|
|
||||||
outer_contour_vertices_end,
|
|
||||||
outer_contour_weights_begin,
|
|
||||||
outer_contour_weights_end,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Polygon,
|
template <typename Polygon,
|
||||||
typename Weights,
|
typename Weights,
|
||||||
typename K>
|
typename K = Exact_predicates_inexact_constructions_kernel>
|
||||||
boost::shared_ptr<Straight_skeleton_2<K> >
|
boost::shared_ptr<Straight_skeleton_2<K> >
|
||||||
inline
|
inline
|
||||||
create_interior_weighted_straight_skeleton_2(const Polygon& out_contour,
|
create_interior_weighted_straight_skeleton_2(const Polygon& out_contour,
|
||||||
const Weights& weights,
|
const Weights& weights,
|
||||||
const K& k,
|
const K& k = K(),
|
||||||
std::enable_if_t<! CGAL_SS_i::has_Hole_const_iterator<Polygon>::value>* = nullptr)
|
std::enable_if_t<! CGAL_SS_i::has_Hole_const_iterator<Polygon>::value>* = nullptr)
|
||||||
{
|
{
|
||||||
return create_interior_weighted_straight_skeleton_2(CGAL_SS_i::vertices_begin(out_contour),
|
return create_interior_weighted_straight_skeleton_2(CGAL_SS_i::vertices_begin(out_contour),
|
||||||
CGAL_SS_i::vertices_end(out_contour),
|
CGAL_SS_i::vertices_end(out_contour),
|
||||||
weights.begin(),
|
weights[0].begin(),
|
||||||
weights.end(),
|
weights[0].end(),
|
||||||
k);
|
k);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Polygon,
|
|
||||||
typename Weights>
|
|
||||||
boost::shared_ptr<Straight_skeleton_2<Exact_predicates_inexact_constructions_kernel> >
|
|
||||||
inline
|
|
||||||
create_interior_weighted_straight_skeleton_2(const Polygon& out_contour,
|
|
||||||
const Weights& weights)
|
|
||||||
{
|
|
||||||
return create_interior_weighted_straight_skeleton_2(out_contour,
|
|
||||||
weights,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -180,14 +131,14 @@ create_interior_weighted_straight_skeleton_2(const Polygon& out_contour,
|
||||||
template <typename FT,
|
template <typename FT,
|
||||||
typename PointIterator,
|
typename PointIterator,
|
||||||
typename WeightIterator,
|
typename WeightIterator,
|
||||||
typename K>
|
typename K = Exact_predicates_inexact_constructions_kernel>
|
||||||
boost::shared_ptr<Straight_skeleton_2<K> >
|
boost::shared_ptr<Straight_skeleton_2<K> >
|
||||||
create_exterior_weighted_straight_skeleton_2(const FT& max_offset,
|
create_exterior_weighted_straight_skeleton_2(const FT& max_offset,
|
||||||
PointIterator vertices_begin,
|
PointIterator vertices_begin,
|
||||||
PointIterator vertices_end,
|
PointIterator vertices_end,
|
||||||
WeightIterator weights_begin,
|
WeightIterator weights_begin,
|
||||||
WeightIterator weights_end,
|
WeightIterator weights_end,
|
||||||
const K& k)
|
const K& k = K())
|
||||||
{
|
{
|
||||||
CGAL_precondition(max_offset > 0);
|
CGAL_precondition(max_offset > 0);
|
||||||
CGAL_precondition(std::distance(weights_begin, weights_end) == std::distance(vertices_begin, vertices_end));
|
CGAL_precondition(std::distance(weights_begin, weights_end) == std::distance(vertices_begin, vertices_end));
|
||||||
|
|
@ -259,59 +210,25 @@ create_exterior_weighted_straight_skeleton_2(const FT& max_offset,
|
||||||
return skeleton;
|
return skeleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FT,
|
|
||||||
typename PointIterator,
|
|
||||||
typename WeightIterator>
|
|
||||||
boost::shared_ptr<Straight_skeleton_2<Exact_predicates_inexact_constructions_kernel> >
|
|
||||||
inline
|
|
||||||
create_exterior_weighted_straight_skeleton_2(const FT& max_offset,
|
|
||||||
PointIterator vertices_begin,
|
|
||||||
PointIterator vertices_end,
|
|
||||||
WeightIterator weights_begin,
|
|
||||||
WeightIterator weights_end)
|
|
||||||
{
|
|
||||||
return create_exterior_weighted_straight_skeleton_2(max_offset,
|
|
||||||
vertices_begin,
|
|
||||||
vertices_end,
|
|
||||||
weights_begin,
|
|
||||||
weights_end,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename FT,
|
template <typename FT,
|
||||||
typename Polygon,
|
typename Polygon,
|
||||||
typename Weights,
|
typename Weights,
|
||||||
typename K>
|
typename K = Exact_predicates_inexact_constructions_kernel>
|
||||||
boost::shared_ptr<Straight_skeleton_2<K> >
|
boost::shared_ptr<Straight_skeleton_2<K> >
|
||||||
inline
|
inline
|
||||||
create_exterior_weighted_straight_skeleton_2(const FT& max_offset,
|
create_exterior_weighted_straight_skeleton_2(const FT& max_offset,
|
||||||
const Polygon& aPoly,
|
const Polygon& aPoly,
|
||||||
Weights& weights,
|
Weights& weights,
|
||||||
const K& k)
|
const K& k = K())
|
||||||
{
|
{
|
||||||
return create_exterior_weighted_straight_skeleton_2(max_offset,
|
return create_exterior_weighted_straight_skeleton_2(max_offset,
|
||||||
CGAL_SS_i::vertices_begin(aPoly),
|
CGAL_SS_i::vertices_begin(aPoly),
|
||||||
CGAL_SS_i::vertices_end(aPoly),
|
CGAL_SS_i::vertices_end(aPoly),
|
||||||
weights.begin(),
|
weights[0].begin(),
|
||||||
weights.end(),
|
weights[0].end(),
|
||||||
k);
|
k);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename FT,
|
|
||||||
typename Weights,
|
|
||||||
typename Polygon>
|
|
||||||
boost::shared_ptr<Straight_skeleton_2<Exact_predicates_inexact_constructions_kernel> >
|
|
||||||
inline
|
|
||||||
create_exterior_weighted_straight_skeleton_2(const FT& max_offset,
|
|
||||||
Weights& weights,
|
|
||||||
const Polygon& aPoly)
|
|
||||||
{
|
|
||||||
return create_exterior_weighted_straight_skeleton_2(max_offset,
|
|
||||||
aPoly,
|
|
||||||
weights,
|
|
||||||
Exact_predicates_inexact_constructions_kernel());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif // CGAL_CREATE_WEIGHTED_STRAIGHT_SKELETON_2_H
|
#endif // CGAL_CREATE_WEIGHTED_STRAIGHT_SKELETON_2_H
|
||||||
|
|
|
||||||
|
|
@ -28,12 +28,12 @@ namespace CGAL {
|
||||||
|
|
||||||
template <typename Polygon,
|
template <typename Polygon,
|
||||||
typename Weights,
|
typename Weights,
|
||||||
typename K>
|
typename K = Exact_predicates_inexact_constructions_kernel>
|
||||||
boost::shared_ptr< Straight_skeleton_2<K> >
|
boost::shared_ptr< Straight_skeleton_2<K> >
|
||||||
inline
|
inline
|
||||||
create_interior_weighted_straight_skeleton_2(const Polygon& poly_with_holes,
|
create_interior_weighted_straight_skeleton_2(const Polygon& poly_with_holes,
|
||||||
const Weights& weights,
|
const Weights& weights,
|
||||||
const K& k,
|
const K& k = K(),
|
||||||
std::enable_if_t<
|
std::enable_if_t<
|
||||||
CGAL_SS_i::has_Hole_const_iterator<Polygon>::value>* = nullptr)
|
CGAL_SS_i::has_Hole_const_iterator<Polygon>::value>* = nullptr)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue