00001 // Wild Magic Source Code 00002 // David Eberly 00003 // http://www.geometrictools.com 00004 // Copyright (c) 1998-2007 00005 // 00006 // This library is free software; you can redistribute it and/or modify it 00007 // under the terms of the GNU Lesser General Public License as published by 00008 // the Free Software Foundation; either version 2.1 of the License, or (at 00009 // your option) any later version. The license is available for reading at 00010 // either of the locations: 00011 // http://www.gnu.org/copyleft/lgpl.html 00012 // http://www.geometrictools.com/License/WildMagicLicense.pdf 00013 // The license applies to versions 0 through 4 of Wild Magic. 00014 // 00015 // Version: 4.0.0 (2006/06/28) 00016 00017 #ifndef WM4BOX3_H 00018 #define WM4BOX3_H 00019 00020 #include "Wm4FoundationLIB.h" 00021 #include "Wm4Vector3.h" 00022 00023 namespace Wm4 00024 { 00025 00026 template <class Real> 00027 class Box3 00028 { 00029 public: 00030 // A box has center C, axis directions U[0], U[1], and U[2] (all 00031 // unit-length vectors), and extents e[0], e[1], and e[2] (all nonnegative 00032 // numbers). A point X = C+y[0]*U[0]+y[1]*U[1]+y[2]*U[2] is inside or 00033 // on the box whenever |y[i]| <= e[i] for all i. 00034 00035 // construction 00036 Box3 (); // uninitialized 00037 Box3 (const Vector3<Real>& rkCenter, const Vector3<Real>* akAxis, 00038 const Real* afExtent); 00039 Box3 (const Vector3<Real>& rkCenter, const Vector3<Real>& rkAxis0, 00040 const Vector3<Real>& rkAxis1, const Vector3<Real>& rkAxis2, 00041 Real fExtent0, Real fExtent1, Real fExtent2); 00042 00043 void ComputeVertices (Vector3<Real> akVertex[8]) const; 00044 00045 Vector3<Real> Center; 00046 Vector3<Real> Axis[3]; // must be an orthonormal set of vectors 00047 Real Extent[3]; // must be nonnegative 00048 }; 00049 00050 } //namespace Wm4 00051 00052 #include "Wm4Box3.inl" 00053 00054 namespace Wm4 00055 { 00056 typedef Box3<float> Box3f; 00057 typedef Box3<double> Box3d; 00058 } 00059 00060 #endif