mirror of https://github.com/CGAL/cgal
Merge pull request #3880 from sloriot/SS-update_utility_function
Change return type to avoid raising a precondition
This commit is contained in:
commit
6270d02dd4
|
|
@ -21,13 +21,13 @@ The set of input polygons are unique and interior disjoint. That is, given disti
|
||||||
bounded or unbounded side of `Q` (but not both).
|
bounded or unbounded side of `Q` (but not both).
|
||||||
\tparam OutputPolygonWithHolesPtrIterator must be an output iterator whose `value_type` is a smart pointer
|
\tparam OutputPolygonWithHolesPtrIterator must be an output iterator whose `value_type` is a smart pointer
|
||||||
(such as `boost::shared_ptr`) whose `element_type` is `Polygon_with_holes_2<K>`.
|
(such as `boost::shared_ptr`) whose `element_type` is `Polygon_with_holes_2<K>`.
|
||||||
|
\return `true` if no error was encountered, and `false` otherwise.
|
||||||
\sa `create_exterior_straight_skeleton_2()`
|
\sa `create_exterior_straight_skeleton_2()`
|
||||||
\sa `Straight_skeleton_builder_2`
|
\sa `Straight_skeleton_builder_2`
|
||||||
|
|
||||||
*/
|
*/
|
||||||
template<class K, class InputPolygonPtrIterator, class OutputPolygonWithHolesPtrIterator>
|
template<class K, class InputPolygonPtrIterator, class OutputPolygonWithHolesPtrIterator>
|
||||||
void arrange_offset_polygons_2 ( InputPolygonPtrIterator begin
|
bool arrange_offset_polygons_2 ( InputPolygonPtrIterator begin
|
||||||
, InputPolygonPtrIterator end
|
, InputPolygonPtrIterator end
|
||||||
, OutputPolygonWithHolesPtrIterator out
|
, OutputPolygonWithHolesPtrIterator out
|
||||||
, K const& k
|
, K const& k
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ namespace CGAL {
|
||||||
// Every hole is contained in one and only one outer polygon
|
// Every hole is contained in one and only one outer polygon
|
||||||
//
|
//
|
||||||
template<class K, class InputPolygonPtrIterator, class OutputPolygonWithHolesPtrIterator>
|
template<class K, class InputPolygonPtrIterator, class OutputPolygonWithHolesPtrIterator>
|
||||||
void arrange_offset_polygons_2 ( InputPolygonPtrIterator aBegin
|
bool arrange_offset_polygons_2 ( InputPolygonPtrIterator aBegin
|
||||||
, InputPolygonPtrIterator aEnd
|
, InputPolygonPtrIterator aEnd
|
||||||
, OutputPolygonWithHolesPtrIterator rOut
|
, OutputPolygonWithHolesPtrIterator rOut
|
||||||
, K const&
|
, K const&
|
||||||
|
|
@ -95,25 +95,36 @@ void arrange_offset_polygons_2 ( InputPolygonPtrIterator aBegin
|
||||||
lParent = lOuter ;
|
lParent = lOuter ;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGAL_assertion(lParent != NULL);
|
if (lParent == NULL)
|
||||||
|
return false;
|
||||||
|
|
||||||
lParent->add_hole(*lPoly);
|
lParent->add_hole(*lPoly);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class K, class C>
|
template<class K, class C>
|
||||||
std::vector< boost::shared_ptr< Polygon_with_holes_2<K,C> > >
|
std::vector< boost::shared_ptr< Polygon_with_holes_2<K,C> > >
|
||||||
inline
|
inline
|
||||||
arrange_offset_polygons_2 ( std::vector< boost::shared_ptr< Polygon_2<K,C> > > const& aPolygons )
|
arrange_offset_polygons_2 ( std::vector< boost::shared_ptr< Polygon_2<K,C> > > const& aPolygons, bool& no_error)
|
||||||
{
|
{
|
||||||
std::vector< boost::shared_ptr< Polygon_with_holes_2<K,C> > > rResult ;
|
std::vector< boost::shared_ptr< Polygon_with_holes_2<K,C> > > rResult ;
|
||||||
|
|
||||||
arrange_offset_polygons_2(aPolygons.begin(), aPolygons.end(), std::back_inserter(rResult), K() ) ;
|
no_error = arrange_offset_polygons_2(aPolygons.begin(), aPolygons.end(), std::back_inserter(rResult), K() ) ;
|
||||||
|
|
||||||
return rResult ;
|
return rResult ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class K, class C>
|
||||||
|
std::vector< boost::shared_ptr< Polygon_with_holes_2<K,C> > >
|
||||||
|
inline
|
||||||
|
arrange_offset_polygons_2 ( std::vector< boost::shared_ptr< Polygon_2<K,C> > > const& aPolygons)
|
||||||
|
{
|
||||||
|
bool no_error;
|
||||||
|
return arrange_offset_polygons_2(aPolygons, no_error);
|
||||||
|
}
|
||||||
|
|
||||||
} // end namespace CGAL
|
} // end namespace CGAL
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue