11 #ifndef __UT_RTreeBox_H__
12 #define __UT_RTreeBox_H__
18 #include <type_traits>
39 template<
typename FT >
52 template<
typename U >
53 constexpr
explicit UT_BoxT(
const U p[3] );
55 template<
typename U >
64 template<
typename POINT_ARRAY >
72 template<
typename CIT,
typename POINT_ARRAY >
80 template<
typename POINT_GENERATOR >
90 template<
typename U >
92 template<
typename U >
96 template<
typename U >
98 template<
typename U >
135 (myMax[0]-myMin[0]) / 2,
136 (myMax[1]-myMin[1]) / 2,
137 (myMax[2]-myMin[2]) / 2
148 (myMin[0]+myMax[0])/2,
149 (myMin[1]+myMax[1])/2,
150 (myMin[2]+myMax[2])/2
174 template<
typename FT >
181 writer,
"min[{0}, {1}, {2}]], max[{3}, {4}, {5}]",
203 template<
typename FT >
206 constexpr
auto operator()() {
return std::numeric_limits< FT >::lowest(); }
213 template<
typename FT >
232 template<
typename FT >
243 template<
typename FT >
248 setCopy( ts[ 0 ], as[ 0 ] );
249 setCopy( ts[ 1 ], as[ 1 ] );
250 setCopy( ts[ 2 ], as[ 2 ] );
257 template<
typename FT >
260 void operator()( FT ts[ 3 ],
const FT a0,
const FT a1,
const FT a2 )
268 template<
typename FT >
271 void operator()( FT ts[ 3 ],
const FT a0,
const FT a1,
const FT a2 )
273 setCopy( ts[ 0 ], a0 );
274 setCopy( ts[ 1 ], a1 );
275 setCopy( ts[ 2 ], a2 );
282 template<
typename FT >
297 template<
typename FT >
298 template<
typename U >
313 template<
typename FT >
314 template<
typename U >
329 template<
typename FT >
344 template<
typename FT >
345 template<
typename POINT_ARRAY >
362 for(
int l = 0; l !=
size; ++l )
368 template<
typename FT >
369 template<
typename CIT,
typename POINT_ARRAY >
386 for(
auto cit = begin; cit !=
end; ++cit )
392 template<
typename FT >
393 template<
typename POINT_GENERATOR >
406 for(
int l = 0; l !=
size; ++l )
414 template<
typename FT >
418 ( myMax[ 0 ] < myMin[ 0 ] ) ||
419 ( myMax[ 1 ] < myMin[ 1 ] ) ||
420 ( myMax[ 2 ] < myMin[ 2 ] )
424 template<
typename T >
425 template<
typename U >
437 template<
typename T >
438 template<
typename U >
441 myMin[0] = (myMin[0] > p[0]) ? p[0] : myMin[0];
442 myMin[1] = (myMin[1] > p[1]) ? p[1] : myMin[1];
443 myMin[2] = (myMin[2] > p[2]) ? p[2] : myMin[2];
445 myMax[0] = (myMax[0] < p[0]) ? p[0] : myMax[0];
446 myMax[1] = (myMax[1] < p[1]) ? p[1] : myMax[1];
447 myMax[2] = (myMax[2] < p[2]) ? p[2] : myMax[2];
450 template<
typename T >
453 myMin[0] = (myMin[0] > b.myMin[0]) ? b.myMin[0] : myMin[0];
454 myMin[1] = (myMin[1] > b.myMin[1]) ? b.myMin[1] : myMin[1];
455 myMin[2] = (myMin[2] > b.myMin[2]) ? b.myMin[2] : myMin[2];
457 myMax[0] = (myMax[0] < b.myMax[0]) ? b.myMax[0] : myMax[0];
458 myMax[1] = (myMax[1] < b.myMax[1]) ? b.myMax[1] : myMax[1];
459 myMax[2] = (myMax[2] < b.myMax[2]) ? b.myMax[2] : myMax[2];
462 template<
typename T >
465 myMin[0] = (myMin[0] > b.
xmin()) ? b.
xmin() : myMin[0];
466 myMin[1] = (myMin[1] > b.
ymin()) ? b.
ymin() : myMin[1];
467 myMin[2] = (myMin[2] > b.
zmin()) ? b.
zmin() : myMin[2];
469 myMax[0] = (myMax[0] < b.
xmax()) ? b.
xmax() : myMax[0];
470 myMax[1] = (myMax[1] < b.
ymax()) ? b.
ymax() : myMax[1];
471 myMax[2] = (myMax[2] < b.
zmax()) ? b.
zmax() : myMax[2];
474 template<
typename T >
489 template<
typename T >
498 template<
typename T >
508 template<
typename T >
511 return ( (myMin[0] <= p[0]) && (p[0] <= myMax[0]) &&
512 (myMin[1] <= p[1]) && (p[1] <= myMax[1]) &&
513 (myMin[2] <= p[2]) && (p[2] <= myMax[2]) );
516 template<
typename T >
525 T max_length(myMax[0] - myMin[0]);
529 length = myMax[1] - myMin[1];
530 if( length > max_length )
536 length = myMax[2] - myMin[2];
537 if( length > max_length )
546 template<
typename FT >
567 (
SYSmax( a.myMin[0], b.myMin[0] ) <=
SYSmin( a.myMax[0], b.myMax[0] ) ) &&
568 (
SYSmax( a.myMin[1], b.myMin[1] ) <=
SYSmin( a.myMax[1], b.myMax[1] ) ) &&
569 (
SYSmax( a.myMin[2], b.myMin[2] ) <=
SYSmin( a.myMax[2], b.myMax[2] ) )
578 v4uf tmax( &a.myMin[2] );
579 v4uf tmin( &a.myMin[0] );
580 tmax = tmax.
swizzle<1, 2, 3, 0>();
582 v4uf bmax( &b.myMin[2] );
583 v4uf bmin( &b.myMin[0] );
584 bmax = bmax.
swizzle<1, 2, 3, 0>();
586 tmin = vmax(tmin, bmin);
587 tmax = vmin(tmax, bmax);
588 v4uu valid = tmin <= tmax;
591 validmask = signbits(valid);
593 return ((validmask & 0x7) == 0x7);
600 template<
typename FT >
601 inline int signAxisCenterComparison(
void absorbPoint(const U p[3])
constexpr SYS_FORCE_INLINE T length2() const noexcept
constexpr auto operator()()
void operator()(FT ts[3], const FT a0, const FT a1, const FT a2)
void assignPoint(const U p[3])
size_t UTformatBuffer(char *buffer, size_t buffer_size, const UT_BoxT< FT > &a)
GLsizei const GLfloat * value
constexpr bool isEmpty() const
void absorbPoint(const UT_Vector3T< U > p)
void assignPoint(const UT_Vector3T< U > p)
GLboolean GLboolean GLboolean GLboolean a
GLuint GLsizei GLsizei * length
BoundIndirectRangePointArrayType
constexpr auto operator()()
FT getMax(const int c) const
UT_BoxT & operator=(const UT_BoxT &)=default
bool contains(const FT p[3]) const
void setEmpty(UT_BoxT< FT > &t)
constexpr int SYSsignum(const F a) noexcept
FT getMin(const int c) const
void expandDistance(const FT l)
void operator()(FT ts[3], const FT a0, const FT a1, const FT a2)
void absorbBox(const UT_BoxT< FT > &b)
GLboolean GLboolean GLboolean b
GLfloat GLfloat GLfloat GLfloat h
friend bool intersects(const UT_BoxT< float > &a, const UT_BoxT< float > &b)
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
SYS_FORCE_INLINE v4uf swizzle() const
void operator()(FT ts[3], const FT as[3])
void operator()(FT ts[3], const FT as[3])
friend void setEmpty(UT_BoxT< FT > &t)
int getLargestAxis() const