24 #ifndef PXR_BASE_GF_RECT2I_H
25 #define PXR_BASE_GF_RECT2I_H
69 : _min(min), _max(max)
76 : _min(min), _max(min +
GfVec2i(width-1, height-1))
189 return (_min + _max) / 2;
194 _min += displacement;
195 _max += displacement;
213 return (_max[0] - _min[0]) + 1;
221 return (_max[1] - _min[1]) + 1;
232 GfMax(_min[1], that._min[1])),
234 GfMin(_max[1], that._max[1])));
251 GfMin(_min[1], that._min[1])),
253 GfMax(_max[1], that._max[1])));
264 return ((p[0] >= _min[0]) && (p[0] <= _max[0]) &&
265 (p[1] >= _min[1]) && (p[1] <= _max[1]));
274 return r1._min == r2._min && r1._max == r2._max;
void SetMax(const GfVec2i &max)
Sets the max corner of the rectangle.
GfRect2i(const GfVec2i &min, const GfVec2i &max)
Constructs a rectangle with min and max corners.
const GfVec2i & GetMax() const
Returns the max corner of the rectangle.
GfRect2i operator+=(const GfRect2i &that)
unsigned long GetArea() const
Return the area of the rectangle.
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
friend size_t hash_value(const GfRect2i &r)
friend bool operator!=(const GfRect2i &r1, const GfRect2i &r2)
Returns true if r1 and r2 are different.
void Translate(const GfVec2i &displacement)
Move the rectangle by displ.
GLint GLsizei GLsizei height
GfRect2i Intersect(const GfRect2i &that) const
GfRect2i()
Constructs an empty rectangle.
GfVec2i GetCenter() const
Returns the center point of the rectangle.
GF_API std::ostream & operator<<(std::ostream &, const GfRect2i &)
GfRect2i Union(const GfRect2i &that) const
static size_t Combine(Args &&...args)
Produce a hash code by combining the hash codes of several objects.
GfVec2i GetSize() const
Returns the size of the rectangle as a vector (width,height).
friend GfRect2i operator+(const GfRect2i r1, const GfRect2i &r2)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
GfRect2i GetUnion(const GfRect2i &that) const
Computes the union of two rectangles.
bool IsValid() const
Return true if the rectangle is valid (equivalently, not empty).
bool Contains(const GfVec2i &p) const
Returns true if the specified point in the rectangle.
void SetMaxX(int x)
Set the X value of the max corner.
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
#define PXR_NAMESPACE_CLOSE_SCOPE
friend bool operator==(const GfRect2i &r1, const GfRect2i &r2)
Returns true if r1 and r2 are equal.
const GfVec2i & GetMin() const
Returns the min corner of the rectangle.
GfRect2i GetIntersection(const GfRect2i &that) const
Computes the intersection of two rectangles.
void SetMaxY(int y)
Set the Y value of the max corner.
GF_API GfRect2i GetNormalized() const
void SetMin(const GfVec2i &min)
Sets the min corner of the rectangle.
GfRect2i(const GfVec2i &min, int width, int height)
int GetMaxY() const
Return the Y value of the max corner.