11 #ifndef __UT_BoundingRect_H__
12 #define __UT_BoundingRect_H__
73 return (
vals[0][0] == brect.
vals[0][0] &&
80 return !(*
this == brect);
85 if (
vals[0][0] > pt.
x() ||
vals[0][1] < pt.
x())
return 0;
86 if (
vals[1][0] > pt.
y() ||
vals[1][1] < pt.
y())
return 0;
91 if (
vals[0][0] > pt.
x() + tol ||
92 vals[0][1] < pt.
x() - tol)
94 if (
vals[1][0] > pt.
y() + tol ||
95 vals[1][1] < pt.
y() - tol)
101 return (x >=
vals[0][0] && x <=
vals[0][1] &&
102 y >=
vals[1][0] && y <=
vals[1][1] );
108 if (closest_pt.x() <
xmin())
109 closest_pt.
x() =
xmin();
110 else if (closest_pt.x() >
xmax())
111 closest_pt.x() =
xmax();
113 if (closest_pt.y() <
ymin())
114 closest_pt.y() =
ymin();
115 else if (closest_pt.y() >
ymax())
116 closest_pt.y() =
ymax();
124 return (
vals[0][0] >= brect.
vals[0][0] &&
149 if (
vals[0][0] > rect.
vals[0][1] + tol ||
152 if (
vals[1][0] > rect.
vals[1][1] + tol ||
187 vals[1][0] <= vals[1][1];
288 vals[0][0] *= xscale;
vals[0][1] *= xscale;
289 vals[1][0] *= yscale;
vals[1][1] *= yscale;
319 inline void project(
T &
x,
T &
y,
int *touchx=0,
int *touchy=0)
const;
409 template <
typename T>
int intersects(const UT_BoundingRectT< T > &rect, T tol) const
void stretch(T percent=0.001, T min=0.001)
UT_BoundingRectT(const UT_BoundingRectT< U > &src)
UT_BoundingRectT< fpreal > UT_BoundingRectR
GLenum GLuint GLenum GLsizei const GLchar * buf
UT_BoundingRectT< int64 > UT_BoundingRectI
GLenum GLuint GLsizei bufsize
void initBounds(T xmin, T xmax, T ymin, T ymax)
const T * getSerialized() const
bool intersectIfOverlapping(const UT_BoundingRectT< T > &src)
void scale(T xscale, T yscale)
UT_API bool save(UT_JSONWriter &w) const
JSON reader class which handles parsing of JSON or bJSON files.
uint8 cohenSutherland(const UT_BoundingRectT< T > &box) const
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
Class which writes ASCII or binary JSON streams.
void enlargeBounds(const UT_BoundingRectT< T > &rect)
GLfloat GLfloat GLfloat v2
unsigned long long uint64
void enlargeBounds(const UT_Vector2T< T > &pt)
constexpr SYS_FORCE_INLINE T & x() noexcept
int contains(const UT_Vector2T< T > &pt, T tol) const
UT_BoundingRectT< float > UT_BoundingRect
int contains(T x, T y) const
UT_BoundingRectT< fpreal32 > UT_BoundingRectF
void initMaxBounds()
Initialize the box to the largest size.
int intersectRay(const UT_Vector2T< T > &orig, const UT_Vector2T< T > &dir, T tmax=1E17, T *distance=0, UT_Vector2T< T > *xsect=0) const
void enlargeBounds(const fpreal32 *v)
bool isValid() const
Check whether the bounding box contains at least one point.
void initBounds(const fpreal64 *v)
UT_API void dump(const char *msg="") const
T & operator()(unsigned m, unsigned n)
int intersects(const UT_BoundingRectT< T > &rect) const
void enlargeBounds(const fpreal64 *v)
void enlargeBounds(T x, T y)
int operator==(const UT_BoundingRectT< T > &brect) const
friend std::ostream & operator<<(std::ostream &os, const UT_BoundingRectT< T > &brect)
void clampX(T min, T max)
void project(T &x, T &y, int *touchx=0, int *touchy=0) const
void initBounds(const UT_Vector2T< T > &pt)
UT_BoundingRectT(T xmin, T ymin, T xmax, T ymax)
UT_BoundingRectT< int32 > UT_BoundingRecti
UT_API size_t format(char *buf, size_t bufsize, const UT_BoundingRectT< T > &v)
void clampY(T min, T max)
bool operator!=(const UT_BoundingRectT< T > &brect) const
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
int intersects(const UT_Vector2T< T > &v0, const UT_Vector2T< T > &v1, const UT_Vector2T< T > &v2) const
Class to store JSON objects as C++ objects.
T operator()(unsigned m, unsigned n) const
UT_Vector2T< T > closestPoint(const UT_Vector2T< T > &pt) const
GLubyte GLubyte GLubyte GLubyte w
friend std::size_t hash_value(const this_type &t)
Compute UT_BoundingRect hash.
uint64 hash() const
Compute UT_BoundingRect hash.
UT_API bool load(UT_JSONParser &p)
void expandBounds(T dx, T dy)
SIM_API const UT_StringHolder distance
int isInside(const UT_BoundingRectT< T > &brect) const
void enlargeBounds(T xmin, T xmax, T ymin, T ymax)
void initBounds(T x, T y)
int contains(const UT_Vector2T< T > &pt) const
UT_BoundingRectT< T > this_type
void intersectBounds(const UT_BoundingRectT< T > &src)
UT_BoundingRectT< fpreal64 > UT_BoundingRectD
void initBounds(const fpreal32 *v)
constexpr SYS_FORCE_INLINE T & y() noexcept
void initBounds(const UT_BoundingRectT< T > &rect)
UT_BoundingRectT(const UT_Vector2T< T > &lowerbound, const UT_Vector2T< T > &upperbound)