changeset 3265:59a184cbb596

ImagePoint::Set + GetDistanceTo
author Alain Mazy <alain@mazy.be>
date Wed, 20 Feb 2019 14:17:52 +0100
parents 3af3b74fbd5c
children 25df9eae8891
files Core/Images/ImageProcessing.cpp Core/Images/ImageProcessing.h
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Core/Images/ImageProcessing.cpp	Wed Feb 20 12:34:33 2019 +0100
+++ b/Core/Images/ImageProcessing.cpp	Wed Feb 20 14:17:52 2019 +0100
@@ -47,6 +47,13 @@
 
 namespace Orthanc
 {
+  double ImageProcessing::ImagePoint::GetDistanceTo(const ImagePoint& other) const
+  {
+    double dx = (double)(other.GetX() - GetX());
+    double dy = (double)(other.GetY() - GetY());
+    return sqrt(dx * dx + dy * dy);
+  }
+
   template <typename TargetType, typename SourceType>
   static void ConvertInternal(ImageAccessor& target,
                               const ImageAccessor& source)
--- a/Core/Images/ImageProcessing.h	Wed Feb 20 12:34:33 2019 +0100
+++ b/Core/Images/ImageProcessing.h	Wed Feb 20 14:17:52 2019 +0100
@@ -55,7 +55,16 @@
       }
 
       int32_t GetX() const {return x_;}
+
       int32_t GetY() const {return y_;}
+
+      void Set(int32_t x, int32_t y)
+      {
+        x_ = x;
+        y_ = y;
+      }
+
+      double GetDistanceTo(const ImagePoint& other) const;
     };
 
     void Copy(ImageAccessor& target,