00001 // Filename: geometricBoundingVolume.I 00002 // Created by: drose (07Oct99) 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 //////////////////////////////////////////////////////////////////// 00020 // Function: GeometricBoundingVolume::Constructor 00021 // Access: Public 00022 // Description: 00023 //////////////////////////////////////////////////////////////////// 00024 INLINE_MATHUTIL GeometricBoundingVolume:: 00025 GeometricBoundingVolume() { 00026 } 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Function: GeometricBoundingVolume::extend_by 00030 // Access: Public 00031 // Description: Increases the size of the volume to include the given 00032 // volume. 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE_MATHUTIL bool GeometricBoundingVolume:: 00035 extend_by(const GeometricBoundingVolume *vol) { 00036 return BoundingVolume::extend_by(vol); 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: GeometricBoundingVolume::extend_by 00041 // Access: Public 00042 // Description: Increases the size of the volume to include the given 00043 // point. 00044 //////////////////////////////////////////////////////////////////// 00045 INLINE_MATHUTIL bool GeometricBoundingVolume:: 00046 extend_by(const LPoint3f &point) { 00047 return extend_by_point(point); 00048 } 00049 00050 //////////////////////////////////////////////////////////////////// 00051 // Function: GeometricBoundingVolume::around 00052 // Access: Public 00053 // Description: Resets the volume to enclose only the volumes 00054 // indicated. 00055 //////////////////////////////////////////////////////////////////// 00056 INLINE_MATHUTIL bool GeometricBoundingVolume:: 00057 around(const GeometricBoundingVolume **first, 00058 const GeometricBoundingVolume **last) { 00059 return BoundingVolume::around((const BoundingVolume **)first, 00060 (const BoundingVolume **)last); 00061 } 00062 00063 //////////////////////////////////////////////////////////////////// 00064 // Function: GeometricBoundingVolume::around 00065 // Access: Public 00066 // Description: Resets the volume to enclose only the points 00067 // indicated. 00068 //////////////////////////////////////////////////////////////////// 00069 INLINE_MATHUTIL bool GeometricBoundingVolume:: 00070 around(const LPoint3f *first, const LPoint3f *last) { 00071 _flags = F_empty; 00072 if (first != last) { 00073 return around_points(first, last); 00074 } 00075 return true; 00076 } 00077 00078 00079 //////////////////////////////////////////////////////////////////// 00080 // Function: GeometricBoundingVolume::contains 00081 // Access: Public 00082 // Description: Returns the appropriate set of IntersectionFlags to 00083 // indicate the amount of intersection with the 00084 // indicated volume. 00085 //////////////////////////////////////////////////////////////////// 00086 INLINE_MATHUTIL int GeometricBoundingVolume:: 00087 contains(const GeometricBoundingVolume *vol) const { 00088 return BoundingVolume::contains(vol); 00089 } 00090 00091 //////////////////////////////////////////////////////////////////// 00092 // Function: GeometricBoundingVolume::contains 00093 // Access: Public 00094 // Description: Returns the appropriate set of IntersectionFlags to 00095 // indicate the amount of intersection with the 00096 // indicated point. 00097 //////////////////////////////////////////////////////////////////// 00098 INLINE_MATHUTIL int GeometricBoundingVolume:: 00099 contains(const LPoint3f &point) const { 00100 if (is_empty()) { 00101 return IF_no_intersection; 00102 } 00103 00104 return contains_point(point); 00105 } 00106 00107 //////////////////////////////////////////////////////////////////// 00108 // Function: GeometricBoundingVolume::contains 00109 // Access: Public 00110 // Description: Returns the appropriate set of IntersectionFlags to 00111 // indicate the amount of intersection with the 00112 // indicated line segment. 00113 //////////////////////////////////////////////////////////////////// 00114 INLINE_MATHUTIL int GeometricBoundingVolume:: 00115 contains(const LPoint3f &a, const LPoint3f &b) const { 00116 if (is_empty()) { 00117 return IF_no_intersection; 00118 } 00119 00120 return contains_lineseg(a, b); 00121 }