mirror of https://github.com/CGAL/cgal
Simplify outer frame offset removal: the outerframe is always at [0]
This commit is contained in:
parent
13cdc1004e
commit
6a44bf6244
|
|
@ -1060,25 +1060,7 @@ bool outward_construction(const Polygon_with_holes_2& pwh,
|
||||||
ob.construct_offset_contours(offset, std::back_inserter(raw_output));
|
ob.construct_offset_contours(offset, std::back_inserter(raw_output));
|
||||||
|
|
||||||
// Manually filter the offset of the outer frame
|
// Manually filter the offset of the outer frame
|
||||||
Point_2 xtrm_pt = *(raw_output[0]->begin());
|
std::swap(raw_output[0], raw_output.back());
|
||||||
std::size_t outer_id = 0;
|
|
||||||
for(std::size_t i=0; i<raw_output.size(); ++i)
|
|
||||||
{
|
|
||||||
if(raw_output[i]->orientation() == CGAL::COUNTERCLOCKWISE)
|
|
||||||
{
|
|
||||||
for(const Point_2& p : raw_output[i]->container())
|
|
||||||
{
|
|
||||||
if(p < xtrm_pt)
|
|
||||||
{
|
|
||||||
xtrm_pt = p;
|
|
||||||
outer_id = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(outer_id != (raw_output.size()-1))
|
|
||||||
std::swap(raw_output[outer_id], raw_output.back());
|
|
||||||
raw_output.pop_back();
|
raw_output.pop_back();
|
||||||
|
|
||||||
#ifdef CGAL_SLS_SNAP_TO_VERTICAL_SLABS
|
#ifdef CGAL_SLS_SNAP_TO_VERTICAL_SLABS
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,9 @@
|
||||||
#include <CGAL/Polygon_with_holes_2.h>
|
#include <CGAL/Polygon_with_holes_2.h>
|
||||||
#include <CGAL/create_offset_polygons_from_polygon_with_holes_2.h>
|
#include <CGAL/create_offset_polygons_from_polygon_with_holes_2.h>
|
||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
|
|
||||||
#include <CGAL/draw_polygon_with_holes_2.h>
|
#include <CGAL/draw_polygon_with_holes_2.h>
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
@ -61,21 +60,9 @@ exterior_offset_of_disjoint_polygons_with_holes(double lOffset, const std::vecto
|
||||||
PolygonPtrVector off_polys = CGAL::create_interior_skeleton_and_offset_polygons_2(lOffset,pwh);
|
PolygonPtrVector off_polys = CGAL::create_interior_skeleton_and_offset_polygons_2(lOffset,pwh);
|
||||||
|
|
||||||
// filter outer frame
|
// filter outer frame
|
||||||
Point xtrm_pt = *(off_polys[0]->begin());
|
std::swap(off_polys[0], off_polys.back());
|
||||||
std::size_t outer_id=0;
|
|
||||||
for(std::size_t i=0; i<off_polys.size(); ++i)
|
|
||||||
if (off_polys[i]->orientation() == CGAL::COUNTERCLOCKWISE)
|
|
||||||
{
|
|
||||||
for (const Point& p : off_polys[i]->container())
|
|
||||||
if (p < xtrm_pt)
|
|
||||||
{
|
|
||||||
xtrm_pt=p;
|
|
||||||
outer_id=i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (outer_id != (off_polys.size()-1))
|
|
||||||
std::swap(off_polys[outer_id], off_polys.back());
|
|
||||||
off_polys.pop_back();
|
off_polys.pop_back();
|
||||||
|
|
||||||
for (PolygonPtr ptr : off_polys)
|
for (PolygonPtr ptr : off_polys)
|
||||||
ptr->reverse_orientation();
|
ptr->reverse_orientation();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,21 +114,9 @@ create_exterior_skeleton_and_offset_polygons_with_holes_2(const FT& aOffset,
|
||||||
create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, ssk);
|
create_exterior_skeleton_and_offset_polygons_2(aOffset, aPoly, ofk, ssk);
|
||||||
|
|
||||||
// filter offset of the outer frame
|
// filter offset of the outer frame
|
||||||
typename OfK::Point_2 xtrm_pt = *(raw_output[0]->begin());
|
std::swap(raw_output[0], raw_output.back());
|
||||||
std::size_t outer_id=0;
|
|
||||||
for(std::size_t i=0; i<raw_output.size(); ++i)
|
|
||||||
if (raw_output[i]->orientation() == COUNTERCLOCKWISE)
|
|
||||||
{
|
|
||||||
for (const typename OfK::Point_2& p : raw_output[i]->container())
|
|
||||||
if (p < xtrm_pt)
|
|
||||||
{
|
|
||||||
xtrm_pt=p;
|
|
||||||
outer_id=i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (outer_id != (raw_output.size()-1))
|
|
||||||
std::swap(raw_output[outer_id], raw_output.back());
|
|
||||||
raw_output.pop_back();
|
raw_output.pop_back();
|
||||||
|
|
||||||
for (boost::shared_ptr<Polygon_> ptr : raw_output)
|
for (boost::shared_ptr<Polygon_> ptr : raw_output)
|
||||||
ptr->reverse_orientation();
|
ptr->reverse_orientation();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -118,25 +118,7 @@ create_exterior_weighted_skeleton_and_offset_polygons_with_holes_2(const FT& aOf
|
||||||
create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, ssk);
|
create_exterior_weighted_skeleton_and_offset_polygons_2(aOffset, aPoly, aWeights, ofk, ssk);
|
||||||
|
|
||||||
// filter offset of the outer frame
|
// filter offset of the outer frame
|
||||||
typename OfK::Point_2 xtrm_pt = *(raw_output[0]->begin());
|
std::swap(raw_output[0], raw_output.back());
|
||||||
std::size_t outer_id=0;
|
|
||||||
for(std::size_t i=0; i<raw_output.size(); ++i)
|
|
||||||
{
|
|
||||||
if(raw_output[i]->orientation() == COUNTERCLOCKWISE)
|
|
||||||
{
|
|
||||||
for(const typename OfK::Point_2& p : raw_output[i]->container())
|
|
||||||
{
|
|
||||||
if(p < xtrm_pt)
|
|
||||||
{
|
|
||||||
xtrm_pt=p;
|
|
||||||
outer_id=i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(outer_id != (raw_output.size()-1))
|
|
||||||
std::swap(raw_output[outer_id], raw_output.back());
|
|
||||||
raw_output.pop_back();
|
raw_output.pop_back();
|
||||||
|
|
||||||
for(boost::shared_ptr<Polygon_> ptr : raw_output)
|
for(boost::shared_ptr<Polygon_> ptr : raw_output)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue