Skip to content

CGAL::do_intersect asserts if polygons wont intersect #8873

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

Closed
mmertama opened this issue May 4, 2025 · 9 comments
Closed

CGAL::do_intersect asserts if polygons wont intersect #8873

mmertama opened this issue May 4, 2025 · 9 comments

Comments

@mmertama
Copy link

mmertama commented May 4, 2025

Issue Details

In case the polygons do not intersect (they are adjacent) like:

{
{{-832, 0},{-832, -192},{-768, -320},{-768, -400},{-736, -448},{-608, -448},{-576, -400},{-576, -344},{-475.6078, -24},{-480, -24},{-656, 48},{-720, 224},{-720, 288},{-720, 320},{-808, 352},{-808, 224},{-808, 128}}
and
{{-475.6078, -24},{-576, -344},{-256, -128},{-352, -24}}
};

Source Code

That is quite easy to spot:
... CGAL/Arr_segment_traits_2.h

line 722:

  // Intersect the two supporting lines.
  auto res = kernel.intersect_2_object()(cv1.line(), cv2.line());
  CGAL_assertion(bool(res)); 

Call stack:


std::__1::back_insert_iterator
std::__1::back_insert_iterator
CGAL::Surface_sweep_2::Random_access_output_iterator
CGAL::Surface_sweep_2::Surface_sweep_2
CGAL::Surface_sweep_2::Surface_sweep_2
CGAL::Surface_sweep_2::Surface_sweep_2
CGAL::Surface_sweep_2::No_intersection_surface_sweep_2
void CGAL::Surface_sweep_2::No_intersection_surface_sweep_2
void CGAL::overlay
CGAL::Gps_on_surface_base_2
CGAL::Gps_on_surface_base_2
bool CGAL::s_do_intersect
bool CGAL::s_do_intersect
bool CGAL::do_intersect

Environment

  • Mac
  • Compiler: Clang
  • debug
  • Specific flags:
  • CGAL version: 6.0.1
  • Boost version: 1.87.0
  • Other libraries versions if used (Eigen, TBB, etc.):
@mmertama
Copy link
Author

mmertama commented May 4, 2025

.... using CGAL::Exact_predicates_inexact_constructions_kernel, when using CGAL::Exact_predicates_exact_constructions_kernel it wont crash (at least with precision of numbers given above. )

@efifogel
Copy link
Member

efifogel commented May 4, 2025 via email

@mmertama
Copy link
Author

mmertama commented May 4, 2025

I did not spot that in the documentation, there should be a static_assert/concept/SFINAE to tell compile time that some template parameters are not working.

@mmertama mmertama closed this as completed May 4, 2025
@efifogel
Copy link
Member

efifogel commented May 4, 2025 via email

@afabri
Copy link
Member

afabri commented May 5, 2025

What about a static_warning ? I think we have that at some places.

@mmertama
Copy link
Author

mmertama commented May 5, 2025

I supposed that would be sufficient, I wasted hours to figure out the reason - the runtime error wont provide any hint why it asserted.

@efifogel
Copy link
Member

efifogel commented May 5, 2025 via email

@afabri
Copy link
Member

afabri commented May 5, 2025

And it is not only a question of kernel choice. If you use Simple_cartesian<Gmqp> it will be also ok.

@efifogel
Copy link
Member

efifogel commented May 5, 2025 via email

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

4 participants