11 #ifndef PXR_BASE_GF_RANGE1D_H
12 #define PXR_BASE_GF_RANGE1D_H
68 : _min(min), _max(max)
78 double GetMin()
const {
return _min; }
81 double GetMax()
const {
return _max; }
84 double GetSize()
const {
return _max - _min; }
116 return (point >= _min && point <= _max);
145 return (range._max < _min || range._min > _max);
151 _FindMin(res._min,b._min);
152 _FindMax(res._max,b._max);
158 _FindMin(_min,b._min);
159 _FindMax(_max,b._max);
191 _FindMax(res._min,b._min);
192 _FindMin(res._max,b._max);
205 _FindMax(_min,b._min);
206 _FindMin(_max,b._max);
246 return *
this *= (1.0 / m);
251 return GfRange1d(_min + b._min, _max + b._max);
257 return GfRange1d(_min - b._max, _max - b._min);
276 return r * (1.0 / m);
286 return (_min == b._min && _max == b._max);
290 return !(*
this ==
b);
310 static void _FindMin(
double &dest,
double point) {
311 if (point < dest) dest = point;
315 static void _FindMax(
double &dest,
double point) {
316 if (point > dest) dest = point;
330 return _min == double(other.
GetMin()) &&
331 _max ==
double(other.
GetMax());
336 return !(*
this == other);
342 #endif // PXR_BASE_GF_RANGE1D_H
double MinMaxType
Helper typedef.
const GfRange1d & UnionWith(const GfRange1d &b)
Extend this to include b.
double GetMin() const
Returns the minimum value of the range.
bool Contains(double point) const
static const size_t dimension
static GfRange1d Union(const GfRange1d &a, const GfRange1d &b)
friend size_t hash_value(const GfRange1d &r)
hash.
*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
GLsizei const GLfloat * value
const GfRange1d & Union(double b)
void ExtendBy(double point)
GfRange1d & operator+=(const GfRange1d &b)
unary sum.
GLboolean GLboolean GLboolean GLboolean a
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
bool operator==(const GfRange1d &b) const
The min and max points must match exactly for equality.
GF_API std::ostream & operator<<(std::ostream &, GfRange1d const &)
GfRange1d & operator*=(double m)
unary multiply.
GfRange1d & operator/=(double m)
unary division.
bool operator!=(const GfRange1d &b) const
const GfRange1d & IntersectWith(const GfRange1d &b)
const GfRange1d & Intersection(const GfRange1d &b)
double GetMax() const
Returns the maximum value of the range.
friend GfRange1d operator*(double m, const GfRange1d &r)
scalar multiply.
double GetMidpoint() const
GfRange1d operator+(const GfRange1d &b) const
binary sum.
bool IsEmpty() const
Returns whether the range is empty (max < min).
void SetMax(double max)
Sets the maximum value of the range.
void SetEmpty()
Sets the range to an empty interval.
bool IsInside(const GfRange1d &range) const
GLboolean GLboolean GLboolean b
GF_API double GetDistanceSquared(double p) const
Compute the squared distance from a point to the range.
float GetMin() const
Returns the minimum value of the range.
static GfRange1d GetUnion(const GfRange1d &a, const GfRange1d &b)
Returns the smallest GfRange1d which contains both a and b.
void SetMin(double min)
Sets the minimum value of the range.
bool IsInside(double point) const
GfRange1d()
The default constructor creates an empty range.
double GetSize() const
Returns the size of the range.
static size_t Combine(Args &&...args)
Produce a hash code by combining the hash codes of several objects.
bool IsOutside(const GfRange1d &range) const
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
bool Contains(const GfRange1d &range) const
static GfRange1d GetIntersection(const GfRange1d &a, const GfRange1d &b)
Returns a GfRange1d that describes the intersection of a and b.
GfRange1d & operator-=(const GfRange1d &b)
unary difference.
float GetMax() const
Returns the maximum value of the range.
friend GfRange1d operator/(const GfRange1d &r, double m)
scalar divide.
GfRange1d(double min, double max)
This constructor initializes the minimum and maximum points.
GfRange1d operator-(const GfRange1d &b) const
binary difference.
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
#define PXR_NAMESPACE_CLOSE_SCOPE
static GfRange1d Intersection(const GfRange1d &a, const GfRange1d &b)
const GfRange1d & UnionWith(double b)
Extend this to include b.
void ExtendBy(const GfRange1d &range)
const GfRange1d & Union(const GfRange1d &b)