Skip to content

Conversation

@efifogel
Copy link
Member

@efifogel efifogel commented Jan 29, 2026

Summary of Changes

Enhanced curve-intersection detection:

  1. Made it robust (can be safely used now with a limited precision kernel)
  2. Optimize it for linear curves
  3. Added support for both x-monotone and general curves

Release Management

TODO:

  • move Surface_sweep_2/include/CGAL/variant_output_iterator.h to STL_extension
  • Check if the new do-intersect should replace the one in the kernel:

You can find a small benchmark program Arrangement_on_surface_2/
benchmark/Arrangement_on_surface_2/do_intersect.cpp that compares the
do_intersect functionality:

  1. The Do_intersect functor of the Arr_non_caching_segment_traits_2
  2. The Do_intersect functor of thekernel
  3. The do_intersect() free function of the kernel
    Naturally, the performance of (2.) and (3.) are comparable. However, (1)
    is the best.
    The code resides under Arrangement_on_surface_2/include/CGAL/
    Arrangement_2/do_segments_intersect.h
    This code should somehow replace the code in the kernel...

@sloriot sloriot force-pushed the Ss2-do_intersect-efif branch from b277e45 to ae33c8d Compare January 29, 2026 18:14
@sloriot sloriot added Enhancement Not yet approved The feature or pull-request has not yet been approved. Pkg::Arrangement_on_surface_2 TODO labels Jan 29, 2026
template <typename Point_2, typename Traits>
bool do_closed_segment_intersect(const Point_2& l1, const Point_2& r1, const Point_2& l2, const Point_2& r2,
const Traits& traits) {
auto cmpare_xy = traits.compare_xy_2_object();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the missing letter o on purpose?

cmake_minimum_required(VERSION 3.12...3.31)
project(do_intersect)
find_package(Boost CONFIG ${BOOST_MIN_VERSION} REQUIRED COMPONENTS program_options)
find_package(CGAL REQUIRED COMPONENTS Core OPTIONAL_COMPONENTS Qt6)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
find_package(CGAL REQUIRED COMPONENTS Core OPTIONAL_COMPONENTS Qt6)
find_package(CGAL OPTIONAL_COMPONENTS Qt6)

because Core is no longer conditional

Comment on lines 18 to 33
/* A compatible output iterator that accepts a std::variant and dispatches its
* alternatives to different sinks via a visitor.
*
* Designed to replace boost::function_output_iterator when the algorithm emits
* heterogeneous output (e.g., `Point_2` or `X_monotone_curve_2`).
*
* Many CGAL concepts (e.g., Make_x_monotone_2) require an operation that writes
* results to an `OutputIterator` whose value type is:
*
* `std::variant<T1, T2, ...>`
*
* However:
* 1. `boost::function_output_iterator` receives one type
* 2. Visitors (operator()) are invoked after assignment
* 3. CGAL freely copies, assigns, and default-constructs output iterators
* `variant_output_iterator` bridges this gap.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/* A compatible output iterator that accepts a std::variant and dispatches its
* alternatives to different sinks via a visitor.
*
* Designed to replace boost::function_output_iterator when the algorithm emits
* heterogeneous output (e.g., `Point_2` or `X_monotone_curve_2`).
*
* Many CGAL concepts (e.g., Make_x_monotone_2) require an operation that writes
* results to an `OutputIterator` whose value type is:
*
* `std::variant<T1, T2, ...>`
*
* However:
* 1. `boost::function_output_iterator` receives one type
* 2. Visitors (operator()) are invoked after assignment
* 3. CGAL freely copies, assigns, and default-constructs output iterators
* `variant_output_iterator` bridges this gap.
/* A compatible output iterator that accepts a `std::variant` and dispatches its
* alternatives to different sinks via a visitor.
*
* Designed to replace `boost::function_output_iterator` when the algorithm emits
* heterogeneous output (e.g., `Point_2` or `X_monotone_curve_2`).
*
* Many \cgal concepts (e.g., `Make_x_monotone_2`) require an operation that writes
* results to an `OutputIterator` whose value type is:
*
* `std::variant<T1, T2, ...>`
*
* However:
* 1. `boost::function_output_iterator` receives one type
* 2. Visitors (operator()) are invoked after assignment
* 3. \cgal freely copies, assigns, and default-constructs output iterators
* `variant_output_iterator` bridges this gap.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make_x_monotone_2 is not a concept. CamelCase ?

@efifogel
Copy link
Member Author

efifogel commented Feb 5, 2026 via email

@efifogel
Copy link
Member Author

efifogel commented Feb 5, 2026 via email

@efifogel
Copy link
Member Author

efifogel commented Feb 5, 2026 via email

@efifogel
Copy link
Member Author

efifogel commented Feb 5, 2026 via email

@sloriot
Copy link
Member

sloriot commented Feb 10, 2026

Several runtime errors in CGAL-6.2-Ic-106

@afabri
Copy link
Member

afabri commented Feb 10, 2026

@efifogel
Copy link
Member Author

efifogel commented Feb 10, 2026 via email

@efifogel
Copy link
Member Author

efifogel commented Feb 10, 2026 via email

* \param xc2 The second \f$x\f$-monotone curve.
* \param consider_common_endpoints indicates whether common endpoints should be counted as intersections.
* \return `true` if `consider_common_endpoints` is true and `xcv1` and `xcv2` intersect or if
* `consider_common_endpoints` is `false and at least one of the interiors of `xcv1` and `xcv2` intersect,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* `consider_common_endpoints` is `false and at least one of the interiors of `xcv1` and `xcv2` intersect,
* `consider_common_endpoints` is `false` and at least one of the interiors of `xcv1` and `xcv2` intersect,

@efifogel
Copy link
Member Author

efifogel commented Feb 10, 2026 via email

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants