10 #ifndef INCLUDED_IMATHBOX_H
11 #define INCLUDED_IMATHBOX_H
18 IMATH_INTERNAL_NAMESPACE_HEADER_ENTER
73 operator== (const
Box<V>&
src) const IMATH_NOEXCEPT;
77 operator!= (const
Box<V>&
src) const IMATH_NOEXCEPT;
114 intersects (const V& point) const IMATH_NOEXCEPT;
123 majorAxis () const IMATH_NOEXCEPT;
220 min = V (V::baseTypeMax ());
221 max = V (V::baseTypeLowest ());
228 min = V (V::baseTypeLowest ());
229 max = V (V::baseTypeMax ());
236 for (
unsigned int i = 0; i <
min.dimensions (); i++)
238 if (point[i] <
min[i])
min[i] = point[i];
240 if (point[i] >
max[i])
max[i] = point[i];
248 for (
unsigned int i = 0; i <
min.dimensions (); i++)
250 if (box.min[i] <
min[i])
min[i] = box.min[i];
252 if (box.max[i] >
max[i])
max[i] = box.max[i];
260 for (
unsigned int i = 0; i <
min.dimensions (); i++)
262 if (point[i] <
min[i] || point[i] >
max[i])
return false;
272 for (
unsigned int i = 0; i <
min.dimensions (); i++)
274 if (box.max[i] <
min[i] || box.min[i] >
max[i])
return false;
284 if (isEmpty ())
return V (0);
300 for (
unsigned int i = 0; i <
min.dimensions (); i++)
302 if (
max[i] <
min[i])
return true;
312 for (
unsigned int i = 0; i <
min.dimensions (); i++)
314 if (
min[i] != V::baseTypeLowest () ||
max[i] != V::baseTypeMax ())
325 for (
unsigned int i = 0; i <
min.dimensions (); i++)
327 if (
max[i] <=
min[i])
return false;
337 unsigned int major = 0;
340 for (
unsigned int i = 1; i <
min.dimensions (); i++)
342 if (s[i] > s[major]) major = i;
354 template <
typename V>
class Box;
388 Box (const
Vec2<
T>& minT, const
Vec2<
T>& maxT) IMATH_NOEXCEPT;
397 operator== (const
Box<
Vec2<
T>>&
src) const IMATH_NOEXCEPT;
401 operator!= (const
Box<
Vec2<
T>>&
src) const IMATH_NOEXCEPT;
447 majorAxis () const IMATH_NOEXCEPT;
544 return (point.x >=
min.x) && (point.x <=
max.x) &&
545 (point.y >=
min.y) && (point.y <=
max.y);
552 return (box.min.x <=
max.x) && (box.max.x >=
min.x) &&
553 (box.min.y <=
max.y) && (box.max.y >=
min.y);
560 if (isEmpty ())
return Vec2<T> (0);
583 if (
min.x != std::numeric_limits<T>::lowest () ||
585 min.y != std::numeric_limits<T>::lowest () ||
607 return (s.
x >= s.
y) ? 0 : 1;
640 Box (const
Vec3<
T>& minT, const
Vec3<
T>& maxT) IMATH_NOEXCEPT;
646 operator== (const
Box<
Vec3<
T>>&
src) const IMATH_NOEXCEPT;
650 operator!= (const
Box<
Vec3<
T>>&
src) const IMATH_NOEXCEPT;
686 majorAxis () const IMATH_NOEXCEPT;
785 return (point.x >=
min.x) && (point.x <=
max.x) &&
786 (point.y >=
min.y) && (point.y <=
max.y) &&
787 (point.z >=
min.z) && (point.z <=
max.z);
794 return (box.min.x <=
max.x) && (box.max.x >=
min.x) &&
795 (box.min.y <=
max.y) && (box.max.y >=
min.y) &&
796 (box.min.z <=
max.z) && (box.max.z >=
min.z);
803 if (isEmpty ())
return Vec3<T> (0);
826 if (
min.x != std::numeric_limits<T>::lowest () ||
828 min.y != std::numeric_limits<T>::lowest () ||
830 min.z != std::numeric_limits<T>::lowest () ||
853 return (s.
x >= s.
z) ? 0 : 2;
854 return (s.
y >= s.
z) ? 1 : 2;
857 IMATH_INTERNAL_NAMESPACE_HEADER_EXIT
859 #endif // INCLUDED_IMATHBOX_H
IMATH_HOSTDEVICE constexpr bool operator!=(const Box< V > &src) const IMATH_NOEXCEPT
Inequality.
Vec2< T > max
The maximum value of the box.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 V size() const IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersects(const V &point) const IMATH_NOEXCEPT
Return true if the given point is inside the box, false otherwise.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Box() IMATH_NOEXCEPT
*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
Vec2< T > min
The minimum value of the box.
IMATH_HOSTDEVICE void makeEmpty() IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isEmpty() const IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 unsigned int majorAxis() const IMATH_NOEXCEPT
IMATH_HOSTDEVICE void extendBy(const V &point) IMATH_NOEXCEPT
Extend the box to include the given point.
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
IMATH_HOSTDEVICE void makeInfinite() IMATH_NOEXCEPT
Make the box include the entire range of V.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool isInfinite() const IMATH_NOEXCEPT
V max
The maximum value of the box.
bool isInfinite(const float x)
Return true if x is an infinity value (either positive infinity or negative infinity).
Vec3< T > max
The maximum value of the box.
V min
The minimum value of the box.
Vec3< T > min
The minimum value of the box.
IMATH_HOSTDEVICE static constexpr T baseTypeMax() IMATH_NOEXCEPT
Largest possible positive value.
IMATH_HOSTDEVICE static constexpr T baseTypeMax() IMATH_NOEXCEPT
Largest possible positive value.
IMATH_HOSTDEVICE static constexpr T baseTypeLowest() IMATH_NOEXCEPT
Largest possible negative value.
IMATH_HOSTDEVICE constexpr bool operator==(const Box< V > &src) const IMATH_NOEXCEPT
Equality.
IMATH_HOSTDEVICE static constexpr T baseTypeLowest() IMATH_NOEXCEPT
Largest possible negative value.
#define IMATH_EXPORT_TEMPLATE_TYPE
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
IMATH_HOSTDEVICE constexpr V center() const IMATH_NOEXCEPT
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool hasVolume() const IMATH_NOEXCEPT
Return true if the box is larger than a single point, false otherwise.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersects(const Box< Vec3< T >> &b, const Line3< T > &r, Vec3< T > &ip) IMATH_NOEXCEPT