Subject: CGAL users discussion list
List archive
- From: "Rasal Raj, Anish" <>
- To: "" <>
- Subject: [cgal-discuss] Speeding up Intersection
- Date: Mon, 3 May 2021 20:17:06 +0000
- Accept-language: en-US, de-DE
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=Pass
- Ironport-hdrordr: A9a23:YNp64qs2+8KQOu/B4T42pSI87skCNoMji2hD6mlwRA09T+Wykd yolvgAkQLz4QxhPU0Is9aGJaWGXDfg5Yd4iLNhXouKcSvHnC+TLI9k5Zb/2DGIIUaVysdx3b ptGpIObuHYIlR3gM3z6gv9M/tI+qj/zImGnuHbpk0BcShPS4VNqzh0ERyaFEoefml7LL40Do CV6MYChxfIQxoqR/+2DHUEQOTPzuej/K7OWhIeAg5i1Q/mt1+VwYTnGBuV1Ap2aVJy6IolmF KrryXJoo2Gm8Kc7Vv5/0/3q697vfPQjuZyPeDksLl2Fhzczi6NTLdGfPmnkA0cjcmTwD8R4b 3xiiZlGd9y5XPXdmTwhRf2wQHv3BYCgkWSrmOwsD/Yjfa8Yi4mBcxAgowxSGqg13Yd
- Ironport-phdr: A9a23:6Rh53xZ3UW366wPvOWss6KH/LTHD14qcDmYuwqpisKpHd+GZx7+nAna3zctkgFKBZ4jH8fUM07OQ7/mxHzZbvd3Y6i5KWacPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3wOgVvO+v6BJPZgdip2OCu4Z3TZBhDiCagbb9oIxi6sAHcutMIjYZsJas9xQbFrmVJdu9L2W5mOFWfkgrm6Myt5pBj6SNQu/wg985ET6r3erkzQKJbAjo7LW07/dXnuhbfQwSB4HscSXgWnQFTAwfZ9hH6X4z+vTX8u+FgxSSVJ8z2TbQzWTS/86dmTQLjhSkbOzIl9mzcl8p9h79Zrh28vRxy247abp+IOvpicK3TftIaSnZOUctKUixNHoG8YpETA+YdIOpVqZT2qVsUrRu5AAmhHO3jxCNSiX/tx6I61/kqHx3c0w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085ywbiR0ho1r7w/QMJwKDaSu8YmKgbpCdkojx/HFu7md7bWYPomg==
- Ironport-sdr: 6c0DHgf6R9Kp2T76Gu6PYQQPJ4dB2nndsbXc5dfL1qvspG4Au5G4/M8dS5T9GVcHf1yhtBdB9z K4qU+wTxGLP8gUcnv0T3jRlnfpVcxTIYQ1yLDNzEMpFPuscFaUfGlTqQ4JnahrF8kFQQBl4B9J ozGx9lNOo/5arzV8bcbT4M0CXpCbitejOpL0pKdGyehnmdHybPDVg4hesaq975dMtZ6rAdau5l Xkthw3ZR/a9QStpYlT14E1t0Z5fxXEaYvt7t1szJpoo0DfvEY6w3DtudEz8RxGq8jXUpfsQfGR nwI=
Hello Guys,
I have recently started working with CGAL. I have a doubt.
I am using CGAL intersection operation on a list of triangles. currently, it takes some time to complete the information. What are the possible ways to improve the execution time?
Note: the list of triangles contains around 25k triangles. I have attached a sample code with this e-mail. I am using
Exact_predicates_exact_constructions_kernel kernel.
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel; typedef Kernel::Point_3 Point; typedef Kernel::Segment_3 Segment_3; typedef Kernel::Triangle_3 Triangle; typedef CGAL::Cartesian<double> tc; struct Ternion { Triangle triangle; int unique_id; std::list<Segment_3> intersection_lines; } void cgal_intersect(std::list<Ternion> &list_of_ternions) { for(auto &i : list_of_ternions) { for (auto &j : list_of_ternions) { if(i.unique_id == j.unique_id) continue; if(CGAL::do_intersect(i.triangle, j.triangle)) { CGAL::cpp11::result_of<Kernel::Intersect_3(Triangle, Triangle)>::type result; result = CGAL::intersection(i.triangle, j.triangle); if (result) { if (Segment_3* s = boost::get<Segment_3>(&*result)) { Segment_3 seg = *s; Point P1(seg.vertex(0).x(), seg.vertex(0).y(), seg.vertex(0).z()); Point P2(seg.vertex(1).x(), seg.vertex(1).y(), seg.vertex(1).z()); i.intersecting_lines.emplace_back(P1, P2); j.intersecting_lines.emplace_back(P1, P2); } else if (Triangle* t = boost::get<Triangle>(&*result)) { Triangle tri = *t; Point P1(tri.vertex(0).x(), tri.vertex(0).y(), tri.vertex(0).z()); Point P2(tri.vertex(1).x(), tri.vertex(1).y(), tri.vertex(1).z()); Point P3(tri.vertex(2).x(), tri.vertex(2).y(), tri.vertex(2).z()); auto dist = CGAL::squared_distance(P1, P2); if (CGAL::to_double(dist) >= (25e-14)) { i.intersecting_lines.emplace_back(P1, P2); j.intersecting_lines.emplace_back(P1, P2); } auto dist1 = CGAL::squared_distance(P2, P3); if (CGAL::to_double(dist1) >= (25e-14)) { i.intersecting_lines.emplace_back(P2, P3); j.intersecting_lines.emplace_back(P2, P3); } auto dist2 = CGAL::squared_distance(P1,P3); if (CGAL::to_double(dist2) >= (25e-14)) { i.intersecting_lines.emplace_back(P3, P1); j.intersecting_lines.emplace_back(P3, P1); } } else if (boost::get<std::vector <Point>>(&*result)) { std::cout << "[WARNING] vector of points, unhandles" << std::endl; } else if (boost::get<Point>(&*result)) { std::cout << "[WARNING] point intersection, unhandled " << std::endl; } else { std::cout << "[WARNING] Unknown intersection, unhandled " << std::endl; } } } } } }
- [cgal-discuss] Speeding up Intersection, Rasal Raj, Anish, 05/03/2021
- Re: [cgal-discuss] Speeding up Intersection, Andrew Cunningham, 05/04/2021
- Re[2]: [cgal-discuss] Speeding up Intersection, jana jelenki, 05/04/2021
- Re: [cgal-discuss] Speeding up Intersection, Sebastien Loriot, 05/05/2021
- Re[2]: [cgal-discuss] Speeding up Intersection, jana jelenki, 05/05/2021
- Re: [cgal-discuss] Speeding up Intersection, Sebastien Loriot, 05/05/2021
- Re[2]: [cgal-discuss] Speeding up Intersection, jana jelenki, 05/05/2021
- Re: [cgal-discuss] Speeding up Intersection, Sebastien Loriot, 05/05/2021
- Re[2]: [cgal-discuss] Speeding up Intersection, jana jelenki, 05/05/2021
- Re: [cgal-discuss] Speeding up Intersection, Sebastien Loriot, 05/05/2021
- Re[2]: [cgal-discuss] Speeding up Intersection, jana jelenki, 05/05/2021
- Re: [cgal-discuss] Speeding up Intersection, Sebastien Loriot, 05/05/2021
- Re[2]: [cgal-discuss] Speeding up Intersection, jana jelenki, 05/04/2021
- Re: [cgal-discuss] Speeding up Intersection, Andrew Cunningham, 05/04/2021
Archive powered by MHonArc 2.6.19+.