28 #ifndef PXR_BASE_GF_RANGE1F_H
29 #define PXR_BASE_GF_RANGE1F_H
39 #include <hboost/functional/hash.hpp>
86 : _min(min), _max(max)
91 float GetMin()
const {
return _min; }
94 float GetMax()
const {
return _max; }
97 float GetSize()
const {
return _max - _min; }
129 return (point >= _min && point <= _max);
158 return (range._max < _min || range._min > _max);
164 _FindMin(res._min,b._min);
165 _FindMax(res._max,b._max);
171 _FindMin(_min,b._min);
172 _FindMax(_max,b._max);
204 _FindMax(res._min,b._min);
205 _FindMin(res._max,b._max);
218 _FindMax(_min,b._min);
219 _FindMin(_max,b._max);
259 return *
this *= (1.0 /
m);
264 return GfRange1f(_min + b._min, _max + b._max);
270 return GfRange1f(_min - b._max, _max - b._min);
289 return r * (1.0 /
m);
295 hboost::hash_combine(h, r._min);
296 hboost::hash_combine(h, r._max);
302 return (_min == b._min && _max == b._max);
306 return !(*
this ==
b);
326 static void _FindMin(
float &dest,
float point) {
327 if (point < dest) dest = point;
331 static void _FindMax(
float &dest,
float point) {
332 if (point > dest) dest = point;
346 return _min == float(other.
GetMin()) &&
347 _max ==
float(other.
GetMax());
352 return !(*
this == other);
358 #endif // PXR_BASE_GF_RANGE1F_H
void SetMax(float max)
Sets the maximum value of the range.
GLboolean GLboolean GLboolean b
double GetMin() const
Returns the minimum value of the range.
void ExtendBy(const GfRange1f &range)
bool IsInside(float point) const
*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
GfRange1f(float min, float max)
This constructor initializes the minimum and maximum points.
const GfRange1f & IntersectWith(const GfRange1f &b)
bool Contains(const GfRange1f &range) const
void ExtendBy(float point)
GfRange1f operator-(const GfRange1f &b) const
binary difference.
bool IsOutside(const GfRange1f &range) const
const GfRange1f & UnionWith(float b)
Extend this to include b.
static const size_t dimension
void SetMin(float min)
Sets the minimum value of the range.
GfRange1f operator+=(const GfRange1f &b)
unary sum.
static GfRange1f GetUnion(const GfRange1f &a, const GfRange1f &b)
Returns the smallest GfRange1f which contains both a and b.
static GfRange1f Intersection(const GfRange1f &a, const GfRange1f &b)
static GfRange1f GetIntersection(const GfRange1f &a, const GfRange1f &b)
Returns a GfRange1f that describes the intersection of a and b.
double GetMax() const
Returns the maximum value of the range.
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
const GfRange1f & Union(const GfRange1f &b)
GfRange1f operator+(const GfRange1f &b) const
binary sum.
float GetSize() const
Returns the size of the range.
GLboolean GLboolean GLboolean GLboolean a
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
bool operator!=(const GfRange1f &b) const
bool IsEmpty() const
Returns whether the range is empty (max < min).
GfRange1f operator/=(double m)
unary division.
GfRange1f()
The default constructor creates an empty range.
GfRange1f operator*=(double m)
unary multiply.
float GetMin() const
Returns the minimum value of the range.
void SetEmpty()
Sets the range to an empty interval.
friend size_t hash_value(const GfRange1f &r)
hash.
float MinMaxType
Helper typedef.
GLfloat GLfloat GLfloat GLfloat h
float GetMidpoint() const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
const GfRange1f & UnionWith(const GfRange1f &b)
Extend this to include b.
friend GfRange1f operator/(const GfRange1f &r, double m)
scalar divide.
GfRange1f operator-=(const GfRange1f &b)
unary difference.
float GetMax() const
Returns the maximum value of the range.
GF_API double GetDistanceSquared(float p) const
Compute the squared distance from a point to the range.
const GfRange1f & Intersection(const GfRange1f &b)
#define PXR_NAMESPACE_CLOSE_SCOPE
friend GfRange1f operator*(double m, const GfRange1f &r)
scalar multiply.
GLsizei const GLfloat * value
bool IsInside(const GfRange1f &range) const
bool Contains(float point) const
const GfRange1f & Union(float b)
GF_API std::ostream & operator<<(std::ostream &, GfRange1f const &)
static GfRange1f Union(const GfRange1f &a, const GfRange1f &b)
bool operator==(const GfRange1f &b) const
The min and max points must match exactly for equality.