00001 // This file is part of ff3d - http://www.freefem.org/ff3d 00002 // Copyright (C) 2001, 2002, 2003 Stéphane Del Pino 00003 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2, or (at your option) 00007 // any later version. 00008 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software Foundation, 00016 // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 00018 // $Id: SceneBox.hpp,v 1.3 2007/12/19 00:43:05 delpinux Exp $ 00019 00020 00021 00022 #ifndef _SCENEBOX_HPP_ 00023 #define _SCENEBOX_HPP_ 00024 00025 #include <TinyVector.hpp> 00026 00040 class SceneBox 00041 { 00042 private: 00044 bool initialized; 00045 00047 TinyVector<3, real_t> a; 00048 00050 TinyVector<3, real_t> b; 00051 00052 public: 00054 const TinyVector<3,real_t>& A() const 00055 { 00056 return a; 00057 } 00058 00060 const TinyVector<3,real_t>& B() const 00061 { 00062 return b; 00063 } 00064 00066 bool Initialized() const 00067 { 00068 return initialized; 00069 } 00070 00072 SceneBox& operator=(const SceneBox& SB) 00073 { 00074 initialized = SB.initialized; 00075 a = SB.A(); 00076 b = SB.B(); 00077 return *this; 00078 } 00079 00080 00082 SceneBox() 00083 : initialized(false), 00084 a(0), 00085 b(0) 00086 { 00087 ; 00088 } 00089 00091 SceneBox(const SceneBox& SB) 00092 : initialized(SB.initialized), 00093 a(SB.a), 00094 b(SB.b) 00095 { 00096 ; 00097 } 00098 00100 SceneBox(const TinyVector<3>& aa, const TinyVector<3>& bb) 00101 : initialized(true) 00102 { 00103 // ordering TinyVector<3> coordinates. 00104 if (aa[0]>bb[0]) { 00105 a[0] = bb[0]; 00106 b[0] = aa[0]; 00107 } else { 00108 a[0] = aa[0]; 00109 b[0] = bb[0]; 00110 } 00111 00112 if (aa[1]>bb[1]) { 00113 a[1] = bb[1]; 00114 b[1] = aa[1]; 00115 } else { 00116 a[1] = aa[1]; 00117 b[1] = bb[1]; 00118 } 00119 00120 if (aa[2]>bb[2]) { 00121 a[2] = bb[2]; 00122 b[2] = aa[2]; 00123 } else { 00124 a[2] = aa[2]; 00125 b[2] = bb[2]; 00126 } 00127 00128 } 00129 }; 00130 00131 #endif // _SCENEBOX_HPP_ 00132
1.5.6