8 #ifndef __UT_Interval_h__
9 #define __UT_Interval_h__
47 if (order_them &&
min >
max)
75 return ((
min>=-tol) && (
min <= tol) && (
max >=-tol) && (
max <= tol));
124 SYShashCombine(h,
max);
160 template <
typename T>
167 template <
typename T>
172 if (order_them &&
min >
max)
180 template <
typename T>
189 template <
typename T>
198 template <
typename T>
208 template <
typename T>
217 template <
typename T>
227 if (t1 < t2) { tmin = t1; tmax = t2; }
228 else { tmin = t2; tmax = t1; }
229 if (tmax < t3) { tmax = t3; }
230 if (tmin > t3) { tmin = t3; }
231 if (tmax < t4) { tmax = t4; }
232 if (tmin > t4) { tmin = t4; }
238 template <
typename T>
250 template <
typename T>
254 if (rhs >= 0.0F) {
min *= rhs;
max *= rhs; }
258 template <
typename T>
264 template <
typename T>
272 template <
typename T>
280 template <
typename T>
290 template <
typename T>
298 template <
typename T>
307 template <
typename T>
317 template <
typename T>
330 tmax = (tmin < tmax) ? tmax : tmin;
355 tmax = (tmin < tmax) ? tmax : tmin;
368 template <
typename T>
375 else if (
min < 0.0F) {
384 template <
typename T>
392 template <
typename T>
402 else if (dmax < 0.0F)
407 template <
typename T>
417 if (dmin < dmax - wrap)
422 else if (dmax < 0.0F)
424 if (dmin - wrap < dmax)
435 template <
typename T>
444 template <
typename T>
448 return ((arg >=
min) && (arg <=
max));
451 template <
typename T>
464 template <
typename T>
468 return SYSisLessOrEqual(
min,
max, tol);
471 template <
typename T>
485 template <
typename T>
492 template <
typename T>
500 template <
typename T>
507 template <
typename T>
514 template <
typename T>
521 template <
typename T>
528 template <
typename T>
535 template <
typename T>
545 if (t1 < t2) { tmin = t1; tmax = t2; }
546 else { tmin = t2; tmax = t1; }
547 if (tmax < t3) { tmax = t3; }
548 if (tmin > t3) { tmin = t3; }
549 if (tmax < t4) { tmax = t4; }
550 if (tmin > t4) { tmin = t4; }
554 template <
typename T>
559 if (lhs > 0.0F) { tmin = lhs*rhs.
min; tmax = lhs*rhs.
max; }
560 else { tmin = lhs*rhs.
max; tmax = lhs*rhs.
min; }
564 template <
typename T>
569 if (rhs > 0.0F) { tmin = rhs*lhs.
min; tmax = rhs*lhs.
max; }
570 else { tmin = rhs*lhs.
max; tmax = rhs*lhs.
min; }
574 template <
typename T>
583 template <
typename T>
591 template <
typename T>
600 template <
typename T>
610 template <
typename T>
614 if (!rhs) rhs += 0.00001f;
619 template <
typename T>
628 template <
typename T>
639 template <
typename T>
646 #endif // __UT_Interval_h__
Mat3< typename promote< S, T >::type > operator*(S scalar, const Mat3< T > &m)
Multiply each element of the given matrix by scalar and return the result.
void maxWith(const UT_IntervalT &rhs)
UT_IntervalT & operator+=(const UT_IntervalT &rhs)
friend std::size_t hash_value(const this_type &t)
int isValid(T tol=0.f) const
int equalZero(T tol=0.00001f) const
UT_IntervalT pow(T arg) const
constexpr size_t SYShash(const SYS_Flicks f)
UT_IntervalT< T > minOf(const UT_IntervalT< T > &arg0, const UT_IntervalT< T > &arg1)
auto printf(const S &fmt, const T &...args) -> int
bool operator!=(const UT_IntervalT &rhs) const
Mat3< typename promote< T0, T1 >::type > operator+(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Add corresponding elements of m0 and m1 and return the result.
UT_IntervalT & operator-=(const UT_IntervalT &rhs)
SYS_HashType hash() const
GLboolean GLboolean GLboolean GLboolean a
std::size_t SYS_HashType
Define the type for hash values.
int isEqual(const UT_IntervalT &v, T tol=0.00001f) const
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
UT_IntervalT< T > operator&(const UT_IntervalT< T > &lhs, const UT_IntervalT< T > &rhs)
auto arg(const Char *name, const T &arg) -> detail::named_arg< Char, T >
bool intersects(const UT_IntervalT &arg) const
UT_IntervalT< fpreal64 > UT_IntervalD
bool operator==(const UT_IntervalT &rhs) const
UT_IntervalT & operator&=(const UT_IntervalT &rhs)
UT_IntervalT< T > operator|(const UT_IntervalT< T > &lhs, const UT_IntervalT< T > &rhs)
Mat3< typename promote< T0, T1 >::type > operator-(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Subtract corresponding elements of m0 and m1 and return the result.
void minWith(const UT_IntervalT &rhs)
UT_IntervalT< T > maxOf(const UT_IntervalT< T > &arg0, const UT_IntervalT< T > &arg1)
UT_IntervalT & operator*=(const UT_IntervalT &rhs)
GLdouble GLdouble GLint GLint order
UT_IntervalT< T > operator/(const UT_IntervalT< T > &lhs, const UT_IntervalT< T > &rhs)
GLboolean GLboolean GLboolean b
UT_IntervalT & operator|=(const UT_IntervalT &rhs)
void clampZero(T tol=0.00001f)
UT_IntervalT< T > this_type
GLfloat GLfloat GLfloat GLfloat h
bool contains(T arg) const
UT_IntervalT< fpreal > UT_IntervalR
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
UT_IntervalT & operator/=(const UT_IntervalT &rhs)
void assign(T Min, T Max, bool order_them=false)
UT_IntervalT< float > UT_Interval
UT_IntervalT< fpreal32 > UT_IntervalF
void invert(UT_IntervalT &v) const
void extendToContain(T a)