00001 // Filename: boundingSphere.I 00002 // Created by: drose (02Oct99) 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 //////////////////////////////////////////////////////////////////// 00017 // Function: BoundingSphere::Constructor 00018 // Access: Published 00019 // Description: Constructs an empty sphere. 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE_MATHUTIL BoundingSphere:: 00022 BoundingSphere() { 00023 } 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Function: BoundingSphere::Constructor 00027 // Access: Published 00028 // Description: Constructs a specific sphere. 00029 //////////////////////////////////////////////////////////////////// 00030 INLINE_MATHUTIL BoundingSphere:: 00031 BoundingSphere(const LPoint3 ¢er, PN_stdfloat radius) : 00032 _center(center), _radius(radius) 00033 { 00034 _flags = 0; 00035 nassertd(!_center.is_nan() && !cnan(_radius)) { 00036 _flags = F_empty; 00037 } 00038 } 00039 00040 //////////////////////////////////////////////////////////////////// 00041 // Function: BoundingSphere::get_center 00042 // Access: Published 00043 // Description: 00044 //////////////////////////////////////////////////////////////////// 00045 INLINE_MATHUTIL LPoint3 BoundingSphere:: 00046 get_center() const { 00047 nassertr(!is_empty(), LPoint3::zero()); 00048 nassertr(!is_infinite(), LPoint3::zero()); 00049 return _center; 00050 } 00051 00052 //////////////////////////////////////////////////////////////////// 00053 // Function: BoundingSphere::get_radius 00054 // Access: Published 00055 // Description: 00056 //////////////////////////////////////////////////////////////////// 00057 INLINE_MATHUTIL PN_stdfloat BoundingSphere:: 00058 get_radius() const { 00059 nassertr(!is_empty(), 0.0f); 00060 nassertr(!is_infinite(), 0.0f); 00061 return _radius; 00062 } 00063