Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

CGAL: Support for Triangle_3 & Segment_3 intersection

📅 2009-Nov-03 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cgal, intersections ⬩ 📚 Archive

CGAL 3.5 is the latest version of the library, but it still does not include support for intersection between Triangle_3 and Segment_3. I recently requested for this with the CGAL team on their cgal-discuss mailing list. Pierre Alliez, the INRIA researcher who is working on this was kind enough to share his WIP code on this with me. It supports intersection between the following entities:

  1. Triangle_3 and Segment_3

  2. Triangle_3 and Line_3

  3. Triangle_3 and Ray_3

  4. Triangle_3 and Plane_3

I have made available this code here. This code is still not release ready, so if you run into any problems please email Pierre with your feedback.

Here is how to use it:

  1. Unzip the 4 header files into your $(CGAL_DIR)\include\CGAL\Intersections_3 directory.

  2. Open your $(CGAL_DIR)\include\CGAL\intersection_3_1.h file in any editor.

  3. At the end of the file (just before the last #endif) add the following includes: cpp #include <CGAL/Intersections_3/Triangle_3_segment_3_intersection.h> #include <CGAL/Intersections_3/Triangle_3_line_3_intersection.h> #include <CGAL/Intersections_3/Triangle_3_ray_3_intersection.h> #include <CGAL/Intersections_3/Triangle_3_plane_3_intersection.h>

You should be able to successfully intersect these geometrical entities in your CGAL code after this.


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧