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 >
180 writer,
"min[{0}, {1}, {2}]], max[{3}, {4}, {5}]",
202 template<
typename FT >
205 constexpr
auto operator()() {
return std::numeric_limits< FT >::lowest(); }
212 template<
typename FT >
231 template<
typename FT >
242 template<
typename FT >
247 setCopy( ts[ 0 ], as[ 0 ] );
248 setCopy( ts[ 1 ], as[ 1 ] );
249 setCopy( ts[ 2 ], as[ 2 ] );
256 template<
typename FT >
259 void operator()( FT ts[ 3 ],
const FT a0,
const FT a1,
const FT a2 )
267 template<
typename FT >
270 void operator()( FT ts[ 3 ],
const FT a0,
const FT a1,
const FT a2 )
272 setCopy( ts[ 0 ], a0 );
273 setCopy( ts[ 1 ], a1 );
274 setCopy( ts[ 2 ], a2 );
281 template<
typename FT >
296 template<
typename FT >
297 template<
typename U >
312 template<
typename FT >
313 template<
typename U >
328 template<
typename FT >
343 template<
typename FT >
344 template<
typename POINT_ARRAY >
361 for(
int l = 0; l !=
size; ++l )
367 template<
typename FT >
368 template<
typename CIT,
typename POINT_ARRAY >
385 for(
auto cit = begin; cit !=
end; ++cit )
391 template<
typename FT >
392 template<
typename POINT_GENERATOR >
405 for(
int l = 0; l !=
size; ++l )
413 template<
typename FT >
417 ( myMax[ 0 ] < myMin[ 0 ] ) ||
418 ( myMax[ 1 ] < myMin[ 1 ] ) ||
419 ( myMax[ 2 ] < myMin[ 2 ] )
423 template<
typename T >
424 template<
typename U >
436 template<
typename T >
437 template<
typename U >
440 myMin[0] = (myMin[0] > p[0]) ? p[0] : myMin[0];
441 myMin[1] = (myMin[1] > p[1]) ? p[1] : myMin[1];
442 myMin[2] = (myMin[2] > p[2]) ? p[2] : myMin[2];
444 myMax[0] = (myMax[0] < p[0]) ? p[0] : myMax[0];
445 myMax[1] = (myMax[1] < p[1]) ? p[1] : myMax[1];
446 myMax[2] = (myMax[2] < p[2]) ? p[2] : myMax[2];
449 template<
typename T >
452 myMin[0] = (myMin[0] > b.myMin[0]) ? b.myMin[0] : myMin[0];
453 myMin[1] = (myMin[1] > b.myMin[1]) ? b.myMin[1] : myMin[1];
454 myMin[2] = (myMin[2] > b.myMin[2]) ? b.myMin[2] : myMin[2];
456 myMax[0] = (myMax[0] < b.myMax[0]) ? b.myMax[0] : myMax[0];
457 myMax[1] = (myMax[1] < b.myMax[1]) ? b.myMax[1] : myMax[1];
458 myMax[2] = (myMax[2] < b.myMax[2]) ? b.myMax[2] : myMax[2];
461 template<
typename T >
464 myMin[0] = (myMin[0] > b.
xmin()) ? b.
xmin() : myMin[0];
465 myMin[1] = (myMin[1] > b.
ymin()) ? b.
ymin() : myMin[1];
466 myMin[2] = (myMin[2] > b.
zmin()) ? b.
zmin() : myMin[2];
468 myMax[0] = (myMax[0] < b.
xmax()) ? b.
xmax() : myMax[0];
469 myMax[1] = (myMax[1] < b.
ymax()) ? b.
ymax() : myMax[1];
470 myMax[2] = (myMax[2] < b.
zmax()) ? b.
zmax() : myMax[2];
473 template<
typename T >
488 template<
typename T >
497 template<
typename T >
507 template<
typename T >
510 return ( (myMin[0] <= p[0]) && (p[0] <= myMax[0]) &&
511 (myMin[1] <= p[1]) && (p[1] <= myMax[1]) &&
512 (myMin[2] <= p[2]) && (p[2] <= myMax[2]) );
515 template<
typename T >
524 T max_length(myMax[0] - myMin[0]);
528 length = myMax[1] - myMin[1];
529 if( length > max_length )
535 length = myMax[2] - myMin[2];
536 if( length > max_length )
545 template<
typename FT >
566 (
SYSmax( a.myMin[0], b.myMin[0] ) <=
SYSmin( a.myMax[0], b.myMax[0] ) ) &&
567 (
SYSmax( a.myMin[1], b.myMin[1] ) <=
SYSmin( a.myMax[1], b.myMax[1] ) ) &&
568 (
SYSmax( a.myMin[2], b.myMin[2] ) <=
SYSmin( a.myMax[2], b.myMax[2] ) )
577 v4uf tmax( &a.myMin[2] );
578 v4uf tmin( &a.myMin[0] );
579 tmax = tmax.
swizzle<1, 2, 3, 0>();
581 v4uf bmax( &b.myMin[2] );
582 v4uf bmin( &b.myMin[0] );
583 bmax = bmax.
swizzle<1, 2, 3, 0>();
585 tmin = vmax(tmin, bmin);
586 tmax = vmin(tmax, bmax);
587 v4uu valid = tmin <= tmax;
590 validmask = signbits(valid);
592 return ((validmask & 0x7) == 0x7);
599 template<
typename FT >
600 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])
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
size_t format(char *buffer, size_t buffer_size, const UT_BoxT< FT > &a)
GLfloat GLfloat GLfloat GLfloat h
friend bool intersects(const UT_BoxT< float > &a, const UT_BoxT< float > &b)
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
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.