25 #ifndef __CheckUtils_hh__
26 #define __CheckUtils_hh__
28 #include <Base/Math/Vector2.hh>
29 #include <Base/Geometry/HomgPoint2D.hh>
39 const unsigned int& height,
41 const T w =
static_cast<T
>(width-1);
42 const T h =
static_cast<T
>(height-1);
43 return (pt[0] >= 0 && pt[1] >= 0 &&
44 pt[0] <= w && pt[1] <= h);
48 const unsigned int& height,
50 const double w =
static_cast<double>(width-1);
51 const double h =
static_cast<double>(height-1);
52 return (pt[0] >= 0 && pt[1] >= 0 &&
53 pt[0] <= w && pt[1] <= h &&
59 const unsigned int& height,
62 const T w =
static_cast<T
>(width-1);
63 const T h =
static_cast<T
>(height-1);
64 return (x >= 0 && y >= 0 &&
79 const unsigned int& height,
81 const unsigned int hwSize,
91 const double w =
static_cast<double>(width-1);
92 const double h =
static_cast<double>(height-1);
93 float hw =
static_cast<float>(hwSize);
95 float xMinTmp = float(std::max(rint(pt[0])-hw, 0.0));
96 float yMinTmp = float(std::max(rint(pt[1])-hw, 0.0));
97 float xMaxTmp = float(std::min(rint(pt[0])+hw, w));
98 float yMaxTmp = float(std::min(rint(pt[1])+hw, h));
100 if(xMaxTmp < xMinTmp || yMaxTmp < yMinTmp)
return false;
102 xMin =
static_cast<unsigned int>(xMinTmp);
103 yMin =
static_cast<unsigned int>(yMinTmp);
104 xMax =
static_cast<unsigned int>(xMaxTmp);
105 yMax =
static_cast<unsigned int>(yMaxTmp);
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
static bool InImageDisc(const unsigned int &width, const unsigned int &height, const Vector2< T > &pt)
static bool InImageDisc(const unsigned int &width, const unsigned int &height, const T x, const T y)
class Vector2 contains a Vector of dim.
static bool GetIntegerWindow(const unsigned int &width, const unsigned int &height, const HomgPoint2D &pt, const unsigned int hwSize, unsigned int &xMin, unsigned int &xMax, unsigned int &yMin, unsigned int &yMax)
Returns integer coordinate range for the window around pt which is in the image, pt also has to lie w...
static bool InImageDisc(const unsigned int &width, const unsigned int &height, const HomgPoint2D &pt)