![[]](/images/special/trans.gif)
LibN2L-4 Library Code ReferenceClassesCompounds Files Members Method Index Full Reference cShape2.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_cShape2_h 00027 #define _n2l4_cShape2_h 00028 00029 #include <math.h> 00030 00031 namespace n2l 00032 { 00033 00041 template < class TComponent, 00042 class TComponentDiff, 00043 class TMagnitude> 00044 class cShape2 00045 { 00046 public: 00047 typedef TComponent tComponent; 00048 typedef TComponentDiff tComponentDiff; 00049 typedef TMagnitude tMagnitude; 00050 00051 typedef cShape2<TComponent,TComponentDiff,TMagnitude> tThisShape; 00052 00053 00054 /* ************************************************************ */ 00055 cShape2() : m_a(), m_b() 00056 {} 00057 00058 /* ************************************************************ */ 00059 cShape2( const tThisShape & i_shape ) : 00060 m_a(i_shape.m_a), m_b(i_shape.m_b) 00061 {} 00062 00063 /* ************************************************************ */ 00064 cShape2( const tComponent & i_a, const tComponent & i_b ) : 00065 m_a(i_a), m_b(i_b) 00066 {} 00067 00068 /* ************************************************************ */ 00069 void setA( const tComponent & i_a ) { m_a = i_a; } 00070 00071 /* ************************************************************ */ 00072 void setB( const tComponent & i_b ) { m_b = i_b; } 00073 00074 /* ************************************************************ */ 00075 void setBDelta( const tComponentDiff & i_bd ) { m_b = m_a+i_bd; } 00076 00077 /* ************************************************************ */ 00078 const tComponent & getA() const { return m_a; } 00079 00080 /* ************************************************************ */ 00081 const tComponent & getB() const { return m_b; } 00082 00083 /* ************************************************************ */ 00084 const tComponentDiff getBDelta() const { return m_b-m_a; } 00085 00086 00087 protected: 00088 00089 private: 00090 tComponent m_a, m_b; 00091 00092 }; // class 00093 00094 } // namespace n2l 00095 00096 00097 00098 #endif |