# HG changeset patch # User Alain Mazy # Date 1550668672 -3600 # Node ID 59a184cbb5962378d4eab17e9f90e6dedfe41010 # Parent 3af3b74fbd5c62f74e0ea9d8e01edd4f5eab9f36 ImagePoint::Set + GetDistanceTo diff -r 3af3b74fbd5c -r 59a184cbb596 Core/Images/ImageProcessing.cpp --- 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 static void ConvertInternal(ImageAccessor& target, const ImageAccessor& source) diff -r 3af3b74fbd5c -r 59a184cbb596 Core/Images/ImageProcessing.h --- 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,