00001 /*---------------------------------------------------------------------------*\ 00002 * OpenSG * 00003 * * 00004 * * 00005 * Copyright (C) 2000,2001 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 #include "OSGPolytopeVolume.h" 00049 00050 OSG_BEGIN_NAMESPACE 00051 00052 /***************************************************************************\ 00053 * Types * 00054 \***************************************************************************/ 00055 00056 /***************************************************************************\ 00057 * Class variables * 00058 \***************************************************************************/ 00059 00060 00061 /***************************************************************************\ 00062 * Class methods * 00063 \***************************************************************************/ 00064 00065 /*------------------------------ feature ----------------------------------*/ 00066 00068 void PolytopeVolume::setPlane(const Plane& p, const UInt16 i) 00069 { 00070 if(i>=_numPlanes) 00071 { 00072 std::cerr << "\nARGL!\n\n"; 00073 return; 00074 } 00075 _planes[i]=p; 00076 } 00077 00079 void PolytopeVolume::getCenter(Pnt3f &OSG_CHECK_ARG(center)) const 00080 { 00081 // not implemented 00082 return; 00083 } 00084 00086 Real32 PolytopeVolume::getScalarVolume() const 00087 { 00088 // not implemented 00089 return 0.0; 00090 } 00091 00093 void PolytopeVolume::getBounds(Pnt3f &OSG_CHECK_ARG(minPnt), 00094 Pnt3f &OSG_CHECK_ARG(maxPnt)) const 00095 { 00096 // not implemented !!! 00097 return; 00098 } 00099 00100 /*-------------------------- extending ------------------------------------*/ 00101 00103 void PolytopeVolume::extendBy(const Pnt3f &OSG_CHECK_ARG(pt)) 00104 { 00105 // not implemented !!! 00106 return; 00107 } 00108 00109 /*-------------------------- intersection ---------------------------------*/ 00110 00112 bool PolytopeVolume::intersect(const Pnt3f &point) const 00113 { 00114 int i; 00115 bool retCode = true; 00116 00117 for (i = 0; i < _numPlanes; i++) 00118 { 00119 /* 00120 if ( ( _planes[i].getNormal().x() * point.x() + 00121 _planes[i].getNormal().y() * point.x() + 00122 _planes[i].getNormal().z() * point.x() + 00123 _planes[i].getDistanceFromOrigin()) < 0 ) { 00124 retCode = false; 00125 break; 00126 } 00127 */ 00128 if(_planes[i].isInHalfSpace(point)==false) 00129 { 00130 retCode = false; 00131 break; 00132 } 00133 } 00134 00135 return retCode; 00136 } 00137 00138 00140 bool PolytopeVolume::intersect (const Line &OSG_CHECK_ARG(line)) const 00141 { 00142 // not implented 00143 return 0; 00144 } 00145 00146 00147 00149 bool PolytopeVolume::intersect (const Line &OSG_CHECK_ARG(line), 00150 Real32 &OSG_CHECK_ARG(minDist), 00151 Real32 &OSG_CHECK_ARG(maxDist)) const 00152 { 00153 // not implented 00154 return 0; 00155 } 00156 00157 bool PolytopeVolume::isOnSurface (const Pnt3f &OSG_CHECK_ARG(point)) const 00158 { 00159 // not implemented 00160 return false; 00161 } 00162 00163 00165 void PolytopeVolume::transform(const Matrix &OSG_CHECK_ARG(m)) 00166 { 00167 // not implemented 00168 return; 00169 } 00170 00172 const PolytopeVolume &PolytopeVolume::operator =(const PolytopeVolume &b1) 00173 { 00174 for (int i = 0; i < _numPlanes; i++) 00175 _planes[i] = b1._planes[i]; 00176 00177 return *this; 00178 } 00179 00181 void PolytopeVolume::dump( UInt32 OSG_CHECK_ARG(uiIndent), 00182 const BitVector OSG_CHECK_ARG(bvFlags )) const 00183 { 00184 // not implemented... 00185 } 00186 00188 OSG_BASE_DLLMAPPING 00189 bool operator ==(const PolytopeVolume &OSG_CHECK_ARG(b1), 00190 const PolytopeVolume &OSG_CHECK_ARG(b2)) 00191 { 00192 FWARNING(("PolytopeVolume == NIY!\n")); 00193 // not implemented... 00194 /* 00195 if(b1._numPlanes == b2._numPlanes){ 00196 for(int i=0; i<b1._numPlanes; i++){ 00197 if(b1.planes[i]!=b2.planes[i]) 00198 return(false); 00199 } 00200 return(true); 00201 } 00202 */ 00203 return(false); 00204 } 00205 00206 00207 /***************************************************************************\ 00208 * Instance methods * 00209 \***************************************************************************/ 00210 00211 OSG_END_NAMESPACE
1.5.5