8 #ifndef __UT_Interval_h__
9 #define __UT_Interval_h__
47 if (order_them &&
min >
max)
74 return ((
min>=-tol) && (
min <= tol) && (
max >=-tol) && (
max <= tol));
123 SYShashCombine(h,
max);
159 template <
typename T>
166 template <
typename T>
171 if (order_them &&
min >
max)
179 template <
typename T>
188 template <
typename T>
197 template <
typename T>
207 template <
typename T>
216 template <
typename T>
226 if (t1 < t2) { tmin = t1; tmax = t2; }
227 else { tmin = t2; tmax = t1; }
228 if (tmax < t3) { tmax = t3; }
229 if (tmin > t3) { tmin = t3; }
230 if (tmax < t4) { tmax = t4; }
231 if (tmin > t4) { tmin = t4; }
237 template <
typename T>
249 template <
typename T>
253 if (rhs >= 0.0F) {
min *= rhs;
max *= rhs; }
257 template <
typename T>
263 template <
typename T>
271 template <
typename T>
279 template <
typename T>
289 template <
typename T>
297 template <
typename T>
306 template <
typename T>
316 template <
typename T>
329 tmax = (tmin < tmax) ? tmax : tmin;
354 tmax = (tmin < tmax) ? tmax : tmin;
367 template <
typename T>
374 else if (
min < 0.0F) {
383 template <
typename T>
391 template <
typename T>
401 else if (dmax < 0.0F)
406 template <
typename T>
416 if (dmin < dmax - wrap)
421 else if (dmax < 0.0F)
423 if (dmin - wrap < dmax)
434 template <
typename T>
443 template <
typename T>
447 return ((arg >=
min) && (arg <=
max));
450 template <
typename T>
454 return SYSisLessOrEqual(
min,
max, tol);
457 template <
typename T>
471 template <
typename T>
478 template <
typename T>
486 template <
typename T>
493 template <
typename T>
500 template <
typename T>
507 template <
typename T>
514 template <
typename T>
521 template <
typename T>
531 if (t1 < t2) { tmin = t1; tmax = t2; }
532 else { tmin = t2; tmax = t1; }
533 if (tmax < t3) { tmax = t3; }
534 if (tmin > t3) { tmin = t3; }
535 if (tmax < t4) { tmax = t4; }
536 if (tmin > t4) { tmin = t4; }
540 template <
typename T>
545 if (lhs > 0.0F) { tmin = lhs*rhs.
min; tmax = lhs*rhs.
max; }
546 else { tmin = lhs*rhs.
max; tmax = lhs*rhs.
min; }
550 template <
typename T>
555 if (rhs > 0.0F) { tmin = rhs*lhs.
min; tmax = rhs*lhs.
max; }
556 else { tmin = rhs*lhs.
max; tmax = rhs*lhs.
min; }
560 template <
typename T>
569 template <
typename T>
577 template <
typename T>
586 template <
typename T>
596 template <
typename T>
600 if (!rhs) rhs += 0.00001f;
605 template <
typename T>
614 template <
typename T>
625 template <
typename T>
632 #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
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
SYS_API float powf(float x, float y)
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 >
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
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
int contains(T arg) const
void invert(UT_IntervalT &v) const
void extendToContain(T a)