00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000-2002 by the OpenSG Forum * 00006 * * 00007 * www.opensg.org * 00008 * * 00009 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de * 00010 * * 00011 \*---------------------------------------------------------------------------*/ 00012 /*---------------------------------------------------------------------------*\ 00013 * License * 00014 * * 00015 * This library is free software; you can redistribute it and/or modify it * 00016 * under the terms of the GNU Library General Public License as published * 00017 * by the Free Software Foundation, version 2. * 00018 * * 00019 * This library is distributed in the hope that it will be useful, but * 00020 * WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this library; if not, write to the Free Software * 00026 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 00027 * * 00028 * * 00029 \*---------------------------------------------------------------------------*/ 00030 /*---------------------------------------------------------------------------*\ 00031 * Changes * 00032 * * 00033 * * 00034 * * 00035 * * 00036 * * 00037 * * 00038 \*---------------------------------------------------------------------------*/ 00039 00040 00041 //--------------------------------------------------------------------------- 00042 // Includes 00043 //--------------------------------------------------------------------------- 00044 00045 #include "OSGConfig.h" 00046 #include "OSGVolume.h" 00047 00048 OSG_BEGIN_NAMESPACE 00049 00050 /*-------------------------- constructor ----------------------------------*/ 00051 00055 inline 00056 FrustumVolume::FrustumVolume() : 00057 Volume() 00058 { 00059 } 00060 00064 inline 00065 FrustumVolume::FrustumVolume(const Plane &pnear, const Plane &pfar, 00066 const Plane &left, const Plane &right, 00067 const Plane &top, const Plane &bottom) : 00068 Volume() 00069 { 00070 _planeVec[0] = pnear; 00071 _planeVec[1] = pfar; 00072 _planeVec[2] = left; 00073 _planeVec[3] = right; 00074 _planeVec[4] = top; 00075 _planeVec[5] = bottom; 00076 } 00077 00081 inline 00082 FrustumVolume::FrustumVolume(const FrustumVolume &obj) : 00083 Volume(obj) 00084 { 00085 _planeVec[0] = obj._planeVec[0]; 00086 _planeVec[1] = obj._planeVec[1]; 00087 _planeVec[2] = obj._planeVec[2]; 00088 _planeVec[3] = obj._planeVec[3]; 00089 _planeVec[4] = obj._planeVec[4]; 00090 _planeVec[5] = obj._planeVec[5]; 00091 } 00092 00096 inline 00097 FrustumVolume::~FrustumVolume() 00098 { 00099 } 00100 00101 /*------------------------------ feature ----------------------------------*/ 00102 00106 inline 00107 const Plane &FrustumVolume::getNear(void) const 00108 { 00109 return _planeVec[0]; 00110 } 00111 00115 inline 00116 const Plane &FrustumVolume::getFar(void) const 00117 { 00118 return _planeVec[1]; 00119 } 00120 00124 inline 00125 const Plane &FrustumVolume::getLeft(void) const 00126 { 00127 return _planeVec[2]; 00128 } 00129 00133 inline 00134 const Plane &FrustumVolume::getRight(void) const 00135 { 00136 return _planeVec[3]; 00137 } 00138 00142 inline 00143 const Plane &FrustumVolume::getTop(void) const 00144 { 00145 return _planeVec[4]; 00146 } 00147 00151 inline 00152 const Plane &FrustumVolume::getBottom(void) const 00153 { 00154 return _planeVec[5]; 00155 } 00156 00157 00161 inline 00162 const Plane *FrustumVolume::getPlanes(void) const 00163 { 00164 return _planeVec; 00165 } 00166 00167 /*-------------------------- extending ------------------------------------*/ 00168 00173 inline 00174 void FrustumVolume::extendBy(const FrustumVolume &volume) 00175 { 00176 OSG::extend(*this, volume); 00177 } 00178 00179 /*-------------------------- intersection ---------------------------------*/ 00180 00181 inline 00182 bool FrustumVolume::intersect(const FrustumVolume &volume) const 00183 { 00184 return OSG::intersect(*this, volume); 00185 } 00186 00187 /*-------------------------- operators ------------------------------------*/ 00188 00192 inline 00193 bool operator !=(const FrustumVolume &b1, const FrustumVolume &b2) 00194 { 00195 return !(b1 == b2); 00196 } 00197 00198 /***************************************************************************\ 00199 * Instance methods * 00200 \***************************************************************************/ 00201 00202 OSG_END_NAMESPACE 00203
1.4.3