Mercurial > hg > orthanc
comparison Core/Images/ImageProcessing.cpp @ 3565:2999a6e9456b
ImageProcessing::ImagePoint::GetDistanceToLine
author | Alain Mazy <alain@mazy.be> |
---|---|
date | Thu, 07 Nov 2019 17:02:19 +0100 |
parents | 0f5f9a5eed25 |
children | 113a9643e8bb |
comparison
equal
deleted
inserted
replaced
3562:f47149cdc048 | 3565:2999a6e9456b |
---|---|
54 double dx = (double)(other.GetX() - GetX()); | 54 double dx = (double)(other.GetX() - GetX()); |
55 double dy = (double)(other.GetY() - GetY()); | 55 double dy = (double)(other.GetY() - GetY()); |
56 return sqrt(dx * dx + dy * dy); | 56 return sqrt(dx * dx + dy * dy); |
57 } | 57 } |
58 | 58 |
59 double ImageProcessing::ImagePoint::GetDistanceToLine(double a, double b, double c) const // where ax + by + c = 0 is the equation of the line | |
60 { | |
61 return std::abs(a * static_cast<double>(GetX()) + b * static_cast<double>(GetY()) + c) / pow(a * a + b * b, 0.5); | |
62 } | |
63 | |
59 template <typename TargetType, typename SourceType> | 64 template <typename TargetType, typename SourceType> |
60 static void ConvertInternal(ImageAccessor& target, | 65 static void ConvertInternal(ImageAccessor& target, |
61 const ImageAccessor& source) | 66 const ImageAccessor& source) |
62 { | 67 { |
63 // WARNING - "::min()" should be replaced by "::lowest()" if | 68 // WARNING - "::min()" should be replaced by "::lowest()" if |