35 #ifndef IE_COREMAYA_BOXTRAITS_H
36 #define IE_COREMAYA_BOXTRAITS_H
38 #include "OpenEXR/ImathLimits.h"
40 #include "IECore/BoxTraits.h"
41 #include "IECoreMaya/VectorTraits.h"
43 #include "maya/MBoundingBox.h"
49 struct BoxTraits<MBoundingBox>
51 typedef MPoint BaseType;
54 static MBoundingBox
create(
const MPoint &
min,
const MPoint &
max )
56 return MBoundingBox( min, max );
60 static MPoint
min(
const MBoundingBox& box )
66 static MPoint
max(
const MBoundingBox& box )
72 static MPoint size(
const MBoundingBox& box )
74 return MPoint( box.width(), box.height(), box.depth() );
78 static MPoint center(
const MBoundingBox& box )
84 static bool isEmpty(
const MBoundingBox& box )
86 return box.width() * box.height() * box.depth() <= Imath::limits<double>::epsilon() ;
90 static void makeEmpty( MBoundingBox& box )
98 static void extendBy( MBoundingBox& box,
const MPoint& p )
102 assert( intersects( box, p ) );
106 static void extendBy( MBoundingBox& box,
const MBoundingBox& box2 )
110 assert( intersects( box, box2 ) );
114 static bool intersects(
const MBoundingBox& box,
const MPoint& p )
116 return box.contains( p );
120 static bool intersects(
const MBoundingBox& box,
const MBoundingBox& box2 )
122 assert( box.intersects( box2 ) == box2.intersects( box ) );
124 return box.intersects( box2 );
130 #endif // IE_COREMAYA_BOXTRAITS_H
static BaseType min(const T &box)
Return the box's minimum corner point.
Definition: BoxTraits.h:76
static BaseType max(const T &box)
Return the box's maximum corner point.
Definition: BoxTraits.h:82
static T create()
Create an empty box.
Definition: BoxTraits.h:70
static void makeEmpty(T &box)
Modify the box such that it is considered to be empty.
Definition: BoxTraits.h:104
This namespace contains all components of the core library.
Definition: AddSmoothSkinningInfluencesOp.h:43
static bool isEmpty(const T &box)
Return true if the box is considered to be empty.
Definition: BoxTraits.h:98