00001 // Filename: omniBoundingVolume.cxx 00002 // Created by: drose (22Jun00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #include "omniBoundingVolume.h" 00020 #include "boundingHexahedron.h" 00021 #include "config_mathutil.h" 00022 00023 #include <math.h> 00024 00025 TypeHandle OmniBoundingVolume::_type_handle; 00026 00027 //////////////////////////////////////////////////////////////////// 00028 // Function: OmniBoundingVolume::make_copy 00029 // Access: Public, Virtual 00030 // Description: 00031 //////////////////////////////////////////////////////////////////// 00032 BoundingVolume *OmniBoundingVolume:: 00033 make_copy() const { 00034 return new OmniBoundingVolume(*this); 00035 } 00036 00037 //////////////////////////////////////////////////////////////////// 00038 // Function: OmniBoundingVolume::get_approx_center 00039 // Access: Public, Virtual 00040 // Description: 00041 //////////////////////////////////////////////////////////////////// 00042 LPoint3f OmniBoundingVolume:: 00043 get_approx_center() const { 00044 return LPoint3f(0.0f, 0.0f, 0.0f); 00045 } 00046 00047 //////////////////////////////////////////////////////////////////// 00048 // Function: OmniBoundingVolume::xform 00049 // Access: Public, Virtual 00050 // Description: 00051 //////////////////////////////////////////////////////////////////// 00052 void OmniBoundingVolume:: 00053 xform(const LMatrix4f &) { 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: OmniBoundingVolume::output 00058 // Access: Public, Virtual 00059 // Description: 00060 //////////////////////////////////////////////////////////////////// 00061 void OmniBoundingVolume:: 00062 output(ostream &out) const { 00063 out << "omni"; 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: OmniBoundingVolume::extend_other 00068 // Access: Public, Virtual 00069 // Description: 00070 //////////////////////////////////////////////////////////////////// 00071 bool OmniBoundingVolume:: 00072 extend_other(BoundingVolume *other) const { 00073 other->set_infinite(); 00074 return true; 00075 } 00076 00077 //////////////////////////////////////////////////////////////////// 00078 // Function: OmniBoundingVolume::around_other 00079 // Access: Public, Virtual 00080 // Description: 00081 //////////////////////////////////////////////////////////////////// 00082 bool OmniBoundingVolume:: 00083 around_other(BoundingVolume *other, 00084 const BoundingVolume **, 00085 const BoundingVolume **) const { 00086 other->set_infinite(); 00087 return true; 00088 } 00089 00090 //////////////////////////////////////////////////////////////////// 00091 // Function: OmniBoundingVolume::contains_other 00092 // Access: Public, Virtual 00093 // Description: 00094 //////////////////////////////////////////////////////////////////// 00095 int OmniBoundingVolume:: 00096 contains_other(const BoundingVolume *) const { 00097 return IF_possible | IF_some | IF_all; 00098 } 00099 00100 //////////////////////////////////////////////////////////////////// 00101 // Function: OmniBoundingVolume::extend_by_point 00102 // Access: Public, Virtual 00103 // Description: 00104 //////////////////////////////////////////////////////////////////// 00105 bool OmniBoundingVolume:: 00106 extend_by_point(const LPoint3f &) { 00107 return true; 00108 } 00109 00110 //////////////////////////////////////////////////////////////////// 00111 // Function: OmniBoundingVolume::extend_by_sphere 00112 // Access: Public, Virtual 00113 // Description: 00114 //////////////////////////////////////////////////////////////////// 00115 bool OmniBoundingVolume:: 00116 extend_by_sphere(const BoundingSphere *) { 00117 return true; 00118 } 00119 00120 //////////////////////////////////////////////////////////////////// 00121 // Function: OmniBoundingVolume::extend_by_hexahedron 00122 // Access: Public, Virtual 00123 // Description: 00124 //////////////////////////////////////////////////////////////////// 00125 bool OmniBoundingVolume:: 00126 extend_by_hexahedron(const BoundingHexahedron *) { 00127 return true; 00128 } 00129 00130 //////////////////////////////////////////////////////////////////// 00131 // Function: OmniBoundingVolume::around_points 00132 // Access: Public, Virtual 00133 // Description: 00134 //////////////////////////////////////////////////////////////////// 00135 bool OmniBoundingVolume:: 00136 around_points(const LPoint3f *, const LPoint3f *) { 00137 return true; 00138 } 00139 00140 //////////////////////////////////////////////////////////////////// 00141 // Function: OmniBoundingVolume::around_spheres 00142 // Access: Public, Virtual 00143 // Description: 00144 //////////////////////////////////////////////////////////////////// 00145 bool OmniBoundingVolume:: 00146 around_spheres(const BoundingVolume **, 00147 const BoundingVolume **) { 00148 return true; 00149 } 00150 00151 //////////////////////////////////////////////////////////////////// 00152 // Function: OmniBoundingVolume::around_hexahedrons 00153 // Access: Public, Virtual 00154 // Description: 00155 //////////////////////////////////////////////////////////////////// 00156 bool OmniBoundingVolume:: 00157 around_hexahedrons(const BoundingVolume **, 00158 const BoundingVolume **) { 00159 return true; 00160 } 00161 00162 //////////////////////////////////////////////////////////////////// 00163 // Function: OmniBoundingVolume::contains_point 00164 // Access: Public, Virtual 00165 // Description: 00166 //////////////////////////////////////////////////////////////////// 00167 int OmniBoundingVolume:: 00168 contains_point(const LPoint3f &) const { 00169 return IF_possible | IF_some | IF_all; 00170 } 00171 00172 //////////////////////////////////////////////////////////////////// 00173 // Function: OmniBoundingVolume::contains_lineseg 00174 // Access: Public, Virtual 00175 // Description: 00176 //////////////////////////////////////////////////////////////////// 00177 int OmniBoundingVolume:: 00178 contains_lineseg(const LPoint3f &, const LPoint3f &) const { 00179 return IF_possible | IF_some | IF_all; 00180 } 00181 00182 //////////////////////////////////////////////////////////////////// 00183 // Function: OmniBoundingVolume::contains_sphere 00184 // Access: Public, Virtual 00185 // Description: 00186 //////////////////////////////////////////////////////////////////// 00187 int OmniBoundingVolume:: 00188 contains_sphere(const BoundingSphere *) const { 00189 return IF_possible | IF_some | IF_all; 00190 } 00191 00192 //////////////////////////////////////////////////////////////////// 00193 // Function: OmniBoundingVolume::contains_hexahedron 00194 // Access: Public, Virtual 00195 // Description: 00196 //////////////////////////////////////////////////////////////////// 00197 int OmniBoundingVolume:: 00198 contains_hexahedron(const BoundingHexahedron *) const { 00199 return IF_possible | IF_some | IF_all; 00200 }