comparison Core/Images/ImageProcessing.h @ 3372:ff945b809067

added ImagePoint::ClipTo
author amazy
date Tue, 14 May 2019 12:06:25 +0200
parents 59a184cbb596
children c160eafc42a9
comparison
equal deleted inserted replaced
3371:fe73717105b6 3372:ff945b809067
35 35
36 #include "ImageAccessor.h" 36 #include "ImageAccessor.h"
37 #include <vector> 37 #include <vector>
38 38
39 #include <stdint.h> 39 #include <stdint.h>
40 #include <algorithm>
40 41
41 namespace Orthanc 42 namespace Orthanc
42 { 43 {
43 namespace ImageProcessing 44 namespace ImageProcessing
44 { 45 {
60 61
61 void Set(int32_t x, int32_t y) 62 void Set(int32_t x, int32_t y)
62 { 63 {
63 x_ = x; 64 x_ = x;
64 y_ = y; 65 y_ = y;
66 }
67
68 void ClipTo(int32_t minX, int32_t maxX, int32_t minY, int32_t maxY)
69 {
70 x_ = std::max(minX, std::min(maxX, x_));
71 y_ = std::max(minY, std::min(maxY, y_));
65 } 72 }
66 73
67 double GetDistanceTo(const ImagePoint& other) const; 74 double GetDistanceTo(const ImagePoint& other) const;
68 }; 75 };
69 76