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

Polygon_2 intersection precondition violation #7598

Closed
jdmarsh opened this issue Jul 14, 2023 · 2 comments
Closed

Polygon_2 intersection precondition violation #7598

jdmarsh opened this issue Jul 14, 2023 · 2 comments

Comments

@jdmarsh
Copy link

jdmarsh commented Jul 14, 2023

Issue Details

When performing an intersection of two Polygon_2 objects I get a precondition violation with no other information other than reporting the bug.

Source Code

void bug_repro()
{
	using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
	CGAL::Polygon_2<Kernel> polygon1;
	polygon1.push_back(Kernel::Point_2{-647.57122802734375, -96.856353759765625});
	polygon1.push_back(Kernel::Point_2{-649.41784667968750, -94.705856323242188});
	polygon1.push_back(Kernel::Point_2{-648.98065185546875, -96.118194580078125});
	polygon1.push_back(Kernel::Point_2{-648.97912597656250, -96.121437072753906});
	polygon1.push_back(Kernel::Point_2{-648.97521972656250, -96.124404907226562});
	CGAL::Polygon_2<Kernel> polygon2;
	polygon2.push_back(Kernel::Point_2{-649.41784667968750, -96.856353759765625});
	polygon2.push_back(Kernel::Point_2{-649.04852294921875, -96.856353759765625});
	polygon2.push_back(Kernel::Point_2{-649.04852294921875, -94.705856323242188});
	polygon2.push_back(Kernel::Point_2{-649.41784667968750, -94.705856323242188});
	std::vector<CGAL::Polygon_with_holes_2<Kernel>> intersecting;
	CGAL::intersection(polygon1, polygon2, std::back_inserter(intersecting));
}

Runtime output:

CGAL error: precondition violation!
Expression : (m_traits.compare_y_at_x_2_object()(p, cv) == EQUAL) && compare_xy(cv.left(), p) == SMALLER && compare_xy(cv.right(), p) == LARGER
File       : C:\repos\project\out\build\x64-debug\vcpkg_installed\x64-windows\include\CGAL\Arr_segment_traits_2.h
Line       : 610
Explanation:
Refer to the bug-reporting instructions at https://www.cgal.org/bug_report.html

Environment

  • Operating system: Windows 64bit
  • Compiler: MSVC in VS 2022 version 17.6.5
  • Release or debug mode: Debug
  • Specific flags used (if any): using C++latest
  • CGAL version: 5.5.1 (installed through vcpkg)
  • Boost version: 1.81 (installed as a dependency automatically through vcpkg)
  • Other libraries versions if used (Eigen, TBB, etc.): N/A
@efifogel
Copy link
Member

efifogel commented Jul 14, 2023 via email

@jdmarsh
Copy link
Author

jdmarsh commented Jul 14, 2023

Yeah that works. Would be nice having a proper error message though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants