00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 INLINE_MATHUTIL BoundingVolume::
00021 BoundingVolume() {
00022 _flags = F_empty;
00023 }
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 INLINE_MATHUTIL bool BoundingVolume::
00035 is_empty() const {
00036 return (_flags & F_empty) != 0;
00037 }
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 INLINE_MATHUTIL bool BoundingVolume::
00056 is_infinite() const {
00057 return (_flags & F_infinite) != 0;
00058 }
00059
00060
00061
00062
00063
00064
00065
00066
00067 INLINE_MATHUTIL void BoundingVolume::
00068 set_infinite() {
00069 _flags = F_infinite;
00070 }
00071
00072
00073
00074
00075
00076
00077
00078 INLINE_MATHUTIL bool BoundingVolume::
00079 extend_by(const BoundingVolume *vol) {
00080 if (vol->is_infinite()) {
00081 set_infinite();
00082
00083 } else if (!vol->is_empty()) {
00084
00085
00086
00087 return vol->extend_other(this);
00088 }
00089 return true;
00090 }
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 INLINE_MATHUTIL int BoundingVolume::
00101 contains(const BoundingVolume *vol) const {
00102 if (is_empty() || vol->is_empty()) {
00103 return IF_no_intersection;
00104
00105 } else if (is_infinite()) {
00106 return IF_possible | IF_some | IF_all;
00107
00108 } else if (vol->is_infinite()) {
00109 return IF_possible | IF_some;
00110 }
00111
00112
00113
00114
00115 return vol->contains_other(this);
00116 }
00117
00118 INLINE_MATHUTIL ostream &operator << (ostream &out, const BoundingVolume &bound) {
00119 bound.output(out);
00120 return out;
00121 }