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