28 #ifndef PXR_BASE_GF_RANGE3D_H
29 #define PXR_BASE_GF_RANGE3D_H
76 _min[0] = _min[1] = _min[2] = FLT_MAX;
77 _max[0] = _max[1] = _max[2] = -FLT_MAX;
87 : _min(min), _max(max)
121 return _min[0] > _max[0] || _min[1] > _max[1] || _min[2] > _max[2];
135 return (point[0] >= _min[0] && point[0] <= _max[0]
136 && point[1] >= _min[1] && point[1] <= _max[1]
137 && point[2] >= _min[2] && point[2] <= _max[2]);
166 return ((range._max[0] < _min[0] || range._min[0] > _max[0])
167 || (range._max[1] < _min[1] || range._min[1] > _max[1])
168 || (range._max[2] < _min[2] || range._min[2] > _max[2]));
174 _FindMin(res._min,b._min);
175 _FindMax(res._max,b._max);
181 _FindMin(_min,b._min);
182 _FindMax(_max,b._max);
214 _FindMax(res._min,b._min);
215 _FindMin(res._max,b._max);
228 _FindMax(_min,b._min);
229 _FindMin(_max,b._max);
269 return *
this *= (1.0 / m);
274 return GfRange3d(_min + b._min, _max + b._max);
280 return GfRange3d(_min - b._max, _max - b._min);
299 return r * (1.0 / m);
309 return (_min == b._min && _max == b._max);
313 return !(*
this ==
b);
349 if (point[0] < dest[0]) dest[0] = point[0];
350 if (point[1] < dest[1]) dest[1] = point[1];
351 if (point[2] < dest[2]) dest[2] = point[2];
356 if (point[0] > dest[0]) dest[0] = point[0];
357 if (point[1] > dest[1]) dest[1] = point[1];
358 if (point[2] > dest[2]) dest[2] = point[2];
378 return !(*
this == other);
384 #endif // PXR_BASE_GF_RANGE3D_H
GF_API GfRange3d GetOctant(size_t i) const
static GfRange3d GetUnion(const GfRange3d &a, const GfRange3d &b)
Returns the smallest GfRange3d which contains both 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
GfRange3d(const GfVec3d &min, const GfVec3d &max)
This constructor initializes the minimum and maximum points.
void SetMin(const GfVec3d &min)
Sets the minimum value of the range.
static GF_API const GfRange3d UnitCube
The unit cube.
double ScalarType
Scalar element type and dimension.
bool IsOutside(const GfRange3d &range) const
const GfVec3d & GetMin() const
Returns the minimum value of the range.
GLboolean GLboolean GLboolean GLboolean a
GfVec3d GetSize() const
Returns the size of the range.
static const size_t dimension
GfRange3d operator+(const GfRange3d &b) const
binary sum.
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
void ExtendBy(const GfVec3d &point)
GfRange3d & operator+=(const GfRange3d &b)
unary sum.
GF_API GfVec3d GetCorner(size_t i) const
GF_API double GetDistanceSquared(const GfVec3d &p) const
Compute the squared distance from a point to the range.
const GfVec3f & GetMin() const
Returns the minimum value of the range.
const GfRange3d & UnionWith(const GfVec3d &b)
Extend this to include b.
friend GfRange3d operator/(const GfRange3d &r, double m)
scalar divide.
GfRange3d & operator-=(const GfRange3d &b)
unary difference.
bool IsInside(const GfVec3d &point) const
bool Contains(const GfRange3d &range) const
void SetEmpty()
Sets the range to an empty interval.
const GfRange3d & Union(const GfVec3d &b)
bool IsEmpty() const
Returns whether the range is empty (max < min).
const GfRange3d & Union(const GfRange3d &b)
GF_API std::ostream & operator<<(std::ostream &, GfRange3d const &)
GfRange3d & operator/=(double m)
unary division.
static GfRange3d Intersection(const GfRange3d &a, const GfRange3d &b)
bool operator==(const GfRange3d &b) const
The min and max points must match exactly for equality.
static GfRange3d Union(const GfRange3d &a, const GfRange3d &b)
GLboolean GLboolean GLboolean b
GfRange3d()
The default constructor creates an empty range.
const GfVec3f & GetMax() const
Returns the maximum value of the range.
static const size_t dimension
const GfRange3d & IntersectWith(const GfRange3d &b)
static GfRange3d GetIntersection(const GfRange3d &a, const GfRange3d &b)
Returns a GfRange3d that describes the intersection of a and b.
bool IsInside(const GfRange3d &range) const
static size_t Combine(Args &&...args)
Produce a hash code by combining the hash codes of several objects.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
void ExtendBy(const GfRange3d &range)
const GfRange3d & UnionWith(const GfRange3d &b)
Extend this to include b.
void SetMax(const GfVec3d &max)
Sets the maximum value of the range.
bool Contains(const GfVec3d &point) const
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
#define PXR_NAMESPACE_CLOSE_SCOPE
friend size_t hash_value(const GfRange3d &r)
hash.
GfVec3d::ScalarType ScalarType
const GfVec3d & GetMax() const
Returns the maximum value of the range.
friend GfRange3d operator*(double m, const GfRange3d &r)
scalar multiply.
GfRange3d & operator*=(double m)
unary multiply.
const GfRange3d & Intersection(const GfRange3d &b)
GfVec3d MinMaxType
Helper typedef.
GfVec3d GetMidpoint() const
bool operator!=(const GfRange3d &b) const
GfRange3d operator-(const GfRange3d &b) const
binary difference.