28 #ifndef PXR_BASE_GF_RANGE2F_H
29 #define PXR_BASE_GF_RANGE2F_H
76 _min[0] = _min[1] = FLT_MAX;
77 _max[0] = _max[1] = -FLT_MAX;
87 : _min(min), _max(max)
121 return _min[0] > _max[0] || _min[1] > _max[1];
135 return (point[0] >= _min[0] && point[0] <= _max[0]
136 && point[1] >= _min[1] && point[1] <= _max[1]);
165 return ((range._max[0] < _min[0] || range._min[0] > _max[0])
166 || (range._max[1] < _min[1] || range._min[1] > _max[1]));
172 _FindMin(res._min,b._min);
173 _FindMax(res._max,b._max);
179 _FindMin(_min,b._min);
180 _FindMax(_max,b._max);
212 _FindMax(res._min,b._min);
213 _FindMin(res._max,b._max);
226 _FindMax(_min,b._min);
227 _FindMin(_max,b._max);
267 return *
this *= (1.0 / m);
272 return GfRange2f(_min + b._min, _max + b._max);
278 return GfRange2f(_min - b._max, _max - b._min);
297 return r * (1.0 / m);
307 return (_min == b._min && _max == b._max);
311 return !(*
this ==
b);
345 if (point[0] < dest[0]) dest[0] = point[0];
346 if (point[1] < dest[1]) dest[1] = point[1];
351 if (point[0] > dest[0]) dest[0] = point[0];
352 if (point[1] > dest[1]) dest[1] = point[1];
372 return !(*
this == other);
378 #endif // PXR_BASE_GF_RANGE2F_H
static const size_t dimension
const GfVec2d & GetMax() const
Returns the maximum value of the range.
const GfRange2f & UnionWith(const GfVec2f &b)
Extend this to include b.
GfRange2f operator-(const GfRange2f &b) const
binary difference.
static GfRange2f GetIntersection(const GfRange2f &a, const GfRange2f &b)
Returns a GfRange2f that describes the intersection of a and b.
*get result *(waiting if necessary)*A common idiom is to fire a bunch of sub tasks at the and then *wait for them to all complete We provide a helper class
GF_API GfVec2f GetCorner(size_t i) const
void SetEmpty()
Sets the range to an empty interval.
void ExtendBy(const GfVec2f &point)
const GfRange2f & Intersection(const GfRange2f &b)
GLboolean GLboolean GLboolean GLboolean a
void SetMax(const GfVec2f &max)
Sets the maximum value of the range.
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GfRange2f & operator-=(const GfRange2f &b)
unary difference.
const GfRange2f & Union(const GfVec2f &b)
const GfRange2f & Union(const GfRange2f &b)
bool IsInside(const GfVec2f &point) const
GfVec2f::ScalarType ScalarType
static const size_t dimension
GfRange2f & operator*=(double m)
unary multiply.
static GfRange2f Union(const GfRange2f &a, const GfRange2f &b)
GfRange2f & operator+=(const GfRange2f &b)
unary sum.
GF_API std::ostream & operator<<(std::ostream &, GfRange2f const &)
friend size_t hash_value(const GfRange2f &r)
hash.
static GfRange2f GetUnion(const GfRange2f &a, const GfRange2f &b)
Returns the smallest GfRange2f which contains both a and b.
GfRange2f(const GfVec2f &min, const GfVec2f &max)
This constructor initializes the minimum and maximum points.
static GF_API const GfRange2f UnitSquare
The unit square.
bool Contains(const GfRange2f &range) const
GfVec2f MinMaxType
Helper typedef.
friend GfRange2f operator*(double m, const GfRange2f &r)
scalar multiply.
bool operator!=(const GfRange2f &b) const
const GfVec2f & GetMax() const
Returns the maximum value of the range.
bool IsInside(const GfRange2f &range) const
GfRange2f & operator/=(double m)
unary division.
bool operator==(const GfRange2f &b) const
The min and max points must match exactly for equality.
float ScalarType
Scalar element type and dimension.
GLboolean GLboolean GLboolean b
void SetMin(const GfVec2f &min)
Sets the minimum value of the range.
GfVec2f GetSize() const
Returns the size of the range.
static GfRange2f Intersection(const GfRange2f &a, const GfRange2f &b)
static size_t Combine(Args &&...args)
Produce a hash code by combining the hash codes of several objects.
GfRange2f operator+(const GfRange2f &b) const
binary sum.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
GfVec2f GetMidpoint() const
void ExtendBy(const GfRange2f &range)
const GfVec2d & GetMin() const
Returns the minimum value of the range.
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GfRange2f()
The default constructor creates an empty range.
#define PXR_NAMESPACE_CLOSE_SCOPE
const GfRange2f & IntersectWith(const GfRange2f &b)
GF_API double GetDistanceSquared(const GfVec2f &p) const
Compute the squared distance from a point to the range.
const GfRange2f & UnionWith(const GfRange2f &b)
Extend this to include b.
GF_API GfRange2f GetQuadrant(size_t i) const
friend GfRange2f operator/(const GfRange2f &r, double m)
scalar divide.
bool IsEmpty() const
Returns whether the range is empty (max < min).
const GfVec2f & GetMin() const
Returns the minimum value of the range.
bool IsOutside(const GfRange2f &range) const
bool Contains(const GfVec2f &point) const