# HG changeset patch # User Alain Mazy # Date 1573230894 -3600 # Node ID ee508761d753e9891e2b17a0c48cfe1a10e105c0 # Parent 2999a6e9456b824acdded0190a798eeb5cd39284# Parent 4812825e69fc65fff8ef73ac6e56057e498553b6 merge diff -r 4812825e69fc -r ee508761d753 Core/Images/ImageProcessing.cpp --- a/Core/Images/ImageProcessing.cpp Thu Nov 07 15:35:18 2019 +0100 +++ b/Core/Images/ImageProcessing.cpp Fri Nov 08 17:34:54 2019 +0100 @@ -56,6 +56,11 @@ return sqrt(dx * dx + dy * dy); } + double ImageProcessing::ImagePoint::GetDistanceToLine(double a, double b, double c) const // where ax + by + c = 0 is the equation of the line + { + return std::abs(a * static_cast(GetX()) + b * static_cast(GetY()) + c) / pow(a * a + b * b, 0.5); + } + template static void ConvertInternal(ImageAccessor& target, const ImageAccessor& source) diff -r 4812825e69fc -r ee508761d753 Core/Images/ImageProcessing.h --- a/Core/Images/ImageProcessing.h Thu Nov 07 15:35:18 2019 +0100 +++ b/Core/Images/ImageProcessing.h Fri Nov 08 17:34:54 2019 +0100 @@ -72,6 +72,8 @@ } double GetDistanceTo(const ImagePoint& other) const; + + double GetDistanceToLine(double a, double b, double c) const; // where ax + by + c = 0 is the equation of the line }; void Copy(ImageAccessor& target,