![[]](/images/special/trans.gif)
LibN2L-4 Library Code ReferenceClassesCompounds Files Members Method Index Full Reference cRectangle3.hGo to the documentation of this file.00001 /************************************************************************ 00002 Nova-2 Library (libN2L, or simply n2l) Game development C++ Library 00003 Copyright (C) 2002 Aaron Cameron 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 00019 A copy of the GNU Lesser General Public License has been provided with 00020 this library in the file 'COPYING'. 00021 00022 Contact information for the author of this library has been provided 00023 with this library in the file 'AUTHOR'. 00024 ************************************************************************/ 00025 00026 #ifndef _n2l4_cRectangle3_h 00027 #define _n2l4_cRectangle3_h 00028 00029 #include "n2l/n2l.h" 00030 #include "cVector3.h" 00031 00032 #include <math.h> 00033 00034 namespace n2l 00035 { 00039 template < class TComponent, 00040 class TComponentDiff, 00041 class TMagnitude> 00042 class cRectangle3 00043 { 00044 public: 00045 typedef TComponent tPosComponent; 00046 typedef TMagnitude tSizeComponent; 00047 typedef TComponentDiff tComponentDiff; 00048 typedef TMagnitude tMagnitude; 00049 00050 typedef cRectangle3<TComponent,TComponentDiff,TMagnitude> tThisRectangle; 00051 00052 typedef cVector3<TComponent,TComponentDiff,TMagnitude> tPosVector; 00053 typedef cVector3<TMagnitude,TComponentDiff,TMagnitude> tSizeVector; 00054 00055 /* ************************************************************ */ 00056 cRectangle3() {} 00057 00058 /* ************************************************************ */ 00059 ~cRectangle3() {} 00060 00061 /* ************************************************************ */ 00062 cRectangle3( const tPosComponent & iPosX, 00063 const tPosComponent & iPosY, 00064 const tPosComponent & iPosZ, 00065 const tSizeComponent & iSizeX, 00066 const tSizeComponent & iSizeY, 00067 const tSizeComponent & iSizeZ ) : 00068 mPos(iPosX,iPosY,iPosZ), 00069 mSize(iSizeX,iSizeY,iSizeZ) {} 00070 00071 /* ************************************************************ */ 00072 const tPosComponent & x() const { return mPos.x(); } 00073 const tPosComponent & y() const { return mPos.y(); } 00074 const tPosComponent & z() const { return mPos.z(); } 00075 00076 00077 /* ************************************************************ */ 00078 const tPosComponent & w() const { return mSize.x(); } 00079 const tPosComponent & h() const { return mSize.y(); } 00080 const tPosComponent & d() const { return mSize.z(); } 00081 00082 00083 /* ************************************************************ */ 00084 const tString dump() const { 00085 tString str("tRectangle3("); 00086 str += asString(mPos.x()); 00087 str += ","; 00088 str += asString(mPos.y()); 00089 str += ","; 00090 str += asString(mPos.z()); 00091 str += " x "; 00092 str += asString(mSize.x()); 00093 str += ","; 00094 str += asString(mSize.y()); 00095 str += ","; 00096 str += asString(mSize.z()); 00097 str += ")"; 00098 return str; 00099 } 00100 00101 protected: 00102 00103 private: 00104 tPosVector mPos; 00105 tSizeVector mSize; 00106 00107 }; // class 00108 00109 } // namespace n2l 00110 00111 00112 00113 #endif |