Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polyline_simplification: Fix Detection of Unremovable Vertices #8736

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,11 @@ class Polyline_simplification_2
(*it)->set_removable(false);
++it;
for(; it != ite; ++it){
if((boost::next(it) != ite) && (boost::prior(it)== boost::next(it))){
(*it)->set_removable(false);
if(std::next(it) != ite){
Vertex_handle vp = *std::prev(it), vn = *std::next(it);
if(vp == vn){
(*it)->set_removable(false);
}
}
}
it = boost::prior(it);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ project(Polyline_simplification_2_Tests)
find_package(CGAL REQUIRED)

create_single_source_cgal_program( "issue-5774.cpp" )
create_single_source_cgal_program( "issue-8735.cpp" )
create_single_source_cgal_program( "simplify_polygon_test.cpp" )
create_single_source_cgal_program( "simplify_polyline_with_duplicate_points.cpp" )
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Polyline_simplification_2/simplify.h>
#include <vector>

namespace PS = CGAL::Polyline_simplification_2;
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
typedef PS::Vertex_base_2<K> Vb;
typedef CGAL::Constrained_triangulation_face_base_2<K> Fb;
typedef CGAL::Triangulation_data_structure_2<Vb, Fb> TDS;
typedef CGAL::Constrained_Delaunay_triangulation_2<K, TDS , CGAL::Exact_predicates_tag> CDT;
typedef CGAL::Constrained_triangulation_plus_2<CDT> CT;
typedef CT::Point Point;
typedef PS::Stop_above_cost_threshold Stop;
typedef PS::Squared_distance_cost Cost;

int main()
{
double tolerance = 100;
CT ct;
std::vector<CT::Point> pts;

pts.push_back(CT::Point(0, 0));
pts.push_back(CT::Point(2, 0));
pts.push_back(CT::Point(1, 0));
pts.push_back(CT::Point(3, 0));
pts.push_back(CT::Point(4, 1));
tolerance = 100;
ct.insert_constraint(pts.begin(), pts.end(), false);

PS::simplify(ct, Cost(), Stop(tolerance * tolerance), false);

return 0;
}
4 changes: 2 additions & 2 deletions STL_Extension/include/CGAL/Skiplist.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Skiplist
all_iterator
, typename all_list::iterator
, T
>
, std::bidirectional_iterator_tag>
{
public:
all_iterator() {}
Expand All @@ -91,7 +91,7 @@ class Skiplist
skip_iterator
, typename skip_list::iterator
, T
>
, std::bidirectional_iterator_tag>
{
public:
skip_iterator() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Polyline_constraint_hierarchy_2
Vertex_it
, typename Vertex_list::skip_iterator
, Vertex_handle
, boost::use_default
, std::bidirectional_iterator_tag
, Vertex_handle>
{
public:
Expand Down