# Intersecting conic arcs Classic List Threaded 4 messages Open this post in threaded view
|

## Intersecting conic arcs

 Hello everyone, I am working on an application that requires me to repeatedly compute the intersection points of two conic arcs in an exact manner. Currently, I am using CGAL's Arrangement_2 class in combination with Arr_conic_traits_2 to carry out this task. In particular, I compute the arrangement of two conics from which I extract the vertices that correspond to intersections. The following minimal example (which I derived from https://doc.cgal.org/latest/Arrangement_on_surface_2/Arrangement_on_surface_2_2conics_8cpp-example.html) reflects my current approach. #include #include #include #include #include typedef CGAL::CORE_algebraic_number_traits Nt_traits; typedef Nt_traits::Rational Rational; typedef Nt_traits::Algebraic Algebraic; typedef CGAL::Cartesian Rat_kernel; typedef Rat_kernel::Point_2 Rat_point_2; typedef Rat_kernel::Segment_2 Rat_segment_2; typedef Rat_kernel::Circle_2 Rat_circle_2; typedef Rat_kernel::Line_2 Rat_line_2; typedef CGAL::Cartesian Alg_kernel; typedef CGAL::Arr_conic_traits_2 Traits_2; typedef Traits_2::Point_2 Point_2; typedef Traits_2::Curve_2 Conic_arc_2; typedef CGAL::Arrangement_2 Arrangement_2; int main() {     Arrangement_2 arr;     Point_2 ps1(Rational(1, 4), 4);     Point_2 pt1(2, Rational(1, 2));     Conic_arc_2 c1(0, 0, 1, 0, 0, -1, CGAL::COUNTERCLOCKWISE, ps1, pt1);     insert(arr, c1);         Conic_arc_2 c2(58, 72, -48, 0, 0, -360);     insert(arr, c2);     for (auto vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) {         std::cout << "(" << vit->point() << ")";         if (vit->is_isolated()) {             std::cout << " - Isolated." << "\n";         } else {             std::cout << " - Degree " << vit->degree() << "\n";             if (vit->degree() == 4) {                 std::cout << "Found intersection at (" << vit->point() << ")\n";             }         }     }         return 0; } I was wondering if there exists a simpler way of achieving this with the tools that CGAL provides? Does there exist some variant of CGAL's intersection() method that is able to handle conic arcs? Any help is very appreciated! Thank you! -- Sent from: http://cgal-discuss.949826.n4.nabble.com/-- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
Open this post in threaded view
|

## Re: Intersecting conic arcs

 1. You need to compute the entire arrangement if you only need the intersection points of two curves---just use the traits directly.2. You can try using the Arr_algebraic_segment_traits_2 traits instead of the Arr_conic_traits_2. The latter is dedicated to conics, but a bit old.3. I don't see other options.   ____  _        ____             _  /_____/_) o    /__________  __  // (____ (   (    (    (_/ (_/-(-'_(/                         _/On Wed, 29 May 2019 at 10:46, Stefan <[hidden email]> wrote:Hello everyone, I am working on an application that requires me to repeatedly compute the intersection points of two conic arcs in an exact manner. Currently, I am using CGAL's Arrangement_2 class in combination with Arr_conic_traits_2 to carry out this task. In particular, I compute the arrangement of two conics from which I extract the vertices that correspond to intersections. The following minimal example (which I derived from https://doc.cgal.org/latest/Arrangement_on_surface_2/Arrangement_on_surface_2_2conics_8cpp-example.html) reflects my current approach. #include #include #include #include #include typedef CGAL::CORE_algebraic_number_traits Nt_traits; typedef Nt_traits::Rational Rational; typedef Nt_traits::Algebraic Algebraic; typedef CGAL::Cartesian Rat_kernel; typedef Rat_kernel::Point_2 Rat_point_2; typedef Rat_kernel::Segment_2 Rat_segment_2; typedef Rat_kernel::Circle_2 Rat_circle_2; typedef Rat_kernel::Line_2 Rat_line_2; typedef CGAL::Cartesian Alg_kernel; typedef CGAL::Arr_conic_traits_2 Traits_2; typedef Traits_2::Point_2 Point_2; typedef Traits_2::Curve_2 Conic_arc_2; typedef CGAL::Arrangement_2 Arrangement_2; int main() {     Arrangement_2 arr;     Point_2 ps1(Rational(1, 4), 4);     Point_2 pt1(2, Rational(1, 2));     Conic_arc_2 c1(0, 0, 1, 0, 0, -1, CGAL::COUNTERCLOCKWISE, ps1, pt1);     insert(arr, c1);     Conic_arc_2 c2(58, 72, -48, 0, 0, -360);     insert(arr, c2);     for (auto vit = arr.vertices_begin(); vit != arr.vertices_end(); ++vit) {         std::cout << "(" << vit->point() << ")";         if (vit->is_isolated()) {             std::cout << " - Isolated." << "\n";         } else {             std::cout << " - Degree " << vit->degree() << "\n";             if (vit->degree() == 4) {                 std::cout << "Found intersection at (" << vit->point() << ")\n";             }         }     }     return 0; } I was wondering if there exists a simpler way of achieving this with the tools that CGAL provides? Does there exist some variant of CGAL's intersection() method that is able to handle conic arcs? Any help is very appreciated! Thank you! -- Sent from: http://cgal-discuss.949826.n4.nabble.com/ -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss