00001 /* 00002 Copyright (C) 2005-2007 Feeling Software Inc. 00003 Portions of the code are: 00004 Copyright (C) 2005-2007 Sony Computer Entertainment America 00005 00006 MIT License: http://www.opensource.org/licenses/mit-license.php 00007 */ 00008 00014 #ifndef _FU_BOUNDINGBOX_H_ 00015 #define _FU_BOUNDINGBOX_H_ 00016 00017 class FUBoundingSphere; 00018 00024 class FCOLLADA_EXPORT FUBoundingBox 00025 { 00026 private: 00027 FMVector3 minimum; 00028 FMVector3 maximum; 00029 00030 public: 00033 FUBoundingBox(); 00034 00038 FUBoundingBox(const FMVector3& minimum, const FMVector3& maximum); 00039 00042 FUBoundingBox(const FUBoundingBox& copy); 00043 00045 ~FUBoundingBox(); 00046 00050 void Reset(); 00051 00056 bool IsValid() const; 00057 00060 inline const FMVector3& GetMin() const { return minimum; } 00061 00064 inline const FMVector3& GetMax() const { return maximum; } 00065 00068 inline void SetMin(const FMVector3& _min) { minimum = _min; } 00069 00072 inline void SetMax(const FMVector3& _max) { maximum = _max; } 00073 00076 inline FMVector3 GetCenter() const { return (minimum + maximum) / 2.0f; } 00077 00081 bool Contains(const FMVector3& point) const; 00082 00087 bool Overlaps(const FUBoundingBox& boundingBox, FMVector3* overlapCenter = NULL) const; 00088 00094 bool Overlaps(const FUBoundingSphere& boundingSphere, FMVector3* overlapCenter = NULL) const; 00095 00098 void Include(const FMVector3& point); 00099 00102 void Include(const FUBoundingBox& boundingBox); 00103 00107 FUBoundingBox Transform(const FMMatrix44& transform) const; 00108 00112 bool Equals(const FUBoundingBox& right) const; 00113 00114 public: 00116 static const FUBoundingBox Infinity; 00117 }; 00118 00119 #endif // _FU_BOUNDINGBOX_H_