changeset 168:62964bfbbc00 wasm

Extent2D::Contains
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 02 Mar 2018 11:21:12 +0100
parents 0ee144f8f75a
children 7105e51e4907
files Framework/Toolbox/Extent2D.cpp Framework/Toolbox/Extent2D.h
diffstat 2 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Framework/Toolbox/Extent2D.cpp	Thu Mar 01 16:27:10 2018 +0100
+++ b/Framework/Toolbox/Extent2D.cpp	Fri Mar 02 11:21:12 2018 +0100
@@ -121,4 +121,19 @@
               y2_ <= y1_ + 10 * std::numeric_limits<double>::epsilon());
     }
   }
+
+
+  bool Extent2D::Contains(double x,
+                          double y) const
+  {
+    if (empty_)
+    {
+      return false;
+    }
+    else
+    {
+      return (x >= x1_ && x <= x2_ &&
+              y >= y1_ && y <= y2_);
+    }
+  }
 }
--- a/Framework/Toolbox/Extent2D.h	Thu Mar 01 16:27:10 2018 +0100
+++ b/Framework/Toolbox/Extent2D.h	Fri Mar 02 11:21:12 2018 +0100
@@ -91,5 +91,8 @@
     {
       return (y1_ + y2_) / 2.0;
     }
+
+    bool Contains(double x,
+                  double y) const;
   };
 }