Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Fwd: CGAL::do_overlap for Iso_cuboid_3

Subject: CGAL users discussion list

List archive

[cgal-discuss] Fwd: CGAL::do_overlap for Iso_cuboid_3


Chronological Thread 
  • From: Giles Bathgate <>
  • To:
  • Subject: [cgal-discuss] Fwd: CGAL::do_overlap for Iso_cuboid_3
  • Date: Tue, 1 Apr 2014 20:00:29 +0100

It occurred to me that it would be useful to define a CGAL::do_overlap for Iso_cuboid_3. There already exists do_overlap functions that take two arguments for BBox_2, and BBox_3. (I just used the BBox_3 code as a template for the attached patch). According to the documentation, an object of the data type Iso_cuboid_3 is a cuboid in the Euclidean space. So I think the patch is valid. 


--- Iso_cuboid_3.h.orig	2013-02-08 15:38:18.000000000 +0000
+++ Iso_cuboid_3.h	2014-04-01 19:42:08.572486175 +0100
@@ -256,6 +256,20 @@
   return is;
 }
 
+template < class R >
+inline
+bool
+do_overlap(const CGAL::Iso_cuboid_3<R>& ic1, const CGAL::Iso_cuboid_3<R>& ic2)
+{
+	if(ic1.xmax() < ic2.xmin() || ic2.xmax() < ic1.xmin())
+		return false;
+	if(ic1.ymax() < ic2.ymin() || ic2.ymax() < ic1.ymin())
+		return false;
+	if(ic1.zmax() < ic2.zmin() || ic2.zmax() < ic1.zmin())
+		return false;
+	return true;
+}
+
 } //namespace CGAL
 
 #endif // CGAL_ISO_CUBOID_3_H


  • [cgal-discuss] Fwd: CGAL::do_overlap for Iso_cuboid_3, Giles Bathgate, 04/01/2014

Archive powered by MHonArc 2.6.18.

Top of Page