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