Open mptangtang opened 1 year ago
void operator()(const Polygon_with_holes_2& pgn1,
const Polygon_2& pgn2,
Polygon_with_holes_2& filtered_pgn1) const
{
filtered_pgn1 = pgn1;
Hole_iterator_vector to_erase;
Bbox_2 boundary_bbox = pgn2.bbox();
Hole_iterator it = filtered_pgn1.holes_begin();
while (it != filtered_pgn1.holes_end()) {
Bbox_2 hole_bbox = (*it).bbox();
if ((hole_bbox.ymax()-hole_bbox.ymin() <
boundary_bbox.ymax()-boundary_bbox.ymin()) ||
(hole_bbox.xmax()-hole_bbox.xmin() <
boundary_bbox.xmax()-boundary_bbox.xmin()))
{
to_erase.push_back(it);
}
++it;
}
typename Hole_iterator_vector::iterator it2 = to_erase.begin();
while (it2 != to_erase.end()) filtered_pgn1.erase_hole(*it2++);
}
The implemtation of hole container is deque. How can we delete the iterator in this way?
Holes_container m_holes;
Please use the following template to help us solving your issue.
Issue Details
When I am using minkowski_sum_2 to calculate the minkowski sum of two polygons. The error jump out and interrupt the program.
It seems that the deque object is erasing an empty iterator.
Since I use the debug mode, I would like to update the vs2019 watch figure.
The local watch
The call stack
It seems that the to_erase variables contain error data.
class Hole_filter2 { private: typedef Kernel Kernel; typedef Container_ Container;
typedef CGAL::Polygon_2<Kernel, Container> Polygon_2; typedef CGAL::Polygon_with_holes_2<Kernel, Container> Polygon_with_holes_2; typedef typename Polygon_with_holes_2::Hole_iterator Hole_iterator; typedef std::vector Hole_iterator_vector;
public: /*! Filter out holes of a polygon with holes.
}
It seems the function operator() does not handle erase properly.
Source Code
Environment