Panda3D
 All Classes Functions Variables Enumerations
collisionSphere.I
00001 // Filename: collisionSphere.I
00002 // Created by:  drose (24Apr00)
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: CollisionSphere::Constructor
00018 //       Access: Public
00019 //  Description:
00020 ////////////////////////////////////////////////////////////////////
00021 INLINE CollisionSphere::
00022 CollisionSphere(const LPoint3 &center, PN_stdfloat radius) :
00023   _center(center), _radius(radius)
00024 {
00025   nassertv(_radius >= 0.0f);
00026 }
00027 
00028 ////////////////////////////////////////////////////////////////////
00029 //     Function: CollisionSphere::Constructor
00030 //       Access: Public
00031 //  Description:
00032 ////////////////////////////////////////////////////////////////////
00033 INLINE CollisionSphere::
00034 CollisionSphere(PN_stdfloat cx, PN_stdfloat cy, PN_stdfloat cz, PN_stdfloat radius) :
00035   _center(cx, cy, cz), _radius(radius)
00036 {
00037   nassertv(_radius >= 0.0f);
00038 }
00039 
00040 ////////////////////////////////////////////////////////////////////
00041 //     Function: CollisionSphere::Default constructor
00042 //       Access: Protected
00043 //  Description: Creates an invalid sphere.  Only used when reading
00044 //               from a bam file.
00045 ////////////////////////////////////////////////////////////////////
00046 INLINE CollisionSphere::
00047 CollisionSphere() {
00048 }
00049 
00050 ////////////////////////////////////////////////////////////////////
00051 //     Function: CollisionSphere::Copy Constructor
00052 //       Access: Public
00053 //  Description:
00054 ////////////////////////////////////////////////////////////////////
00055 INLINE CollisionSphere::
00056 CollisionSphere(const CollisionSphere &copy) :
00057   CollisionSolid(copy),
00058   _center(copy._center),
00059   _radius(copy._radius)
00060 {
00061 }
00062 
00063 ////////////////////////////////////////////////////////////////////
00064 //     Function: CollisionSphere::flush_level
00065 //       Access: Public, Static
00066 //  Description: Flushes the PStatCollectors used during traversal.
00067 ////////////////////////////////////////////////////////////////////
00068 INLINE void CollisionSphere::
00069 flush_level() {
00070   _volume_pcollector.flush_level();
00071   _test_pcollector.flush_level();
00072 }
00073 
00074 ////////////////////////////////////////////////////////////////////
00075 //     Function: CollisionSphere::set_center
00076 //       Access: Published
00077 //  Description:
00078 ////////////////////////////////////////////////////////////////////
00079 INLINE void CollisionSphere::
00080 set_center(const LPoint3 &center) {
00081   _center = center;
00082   mark_internal_bounds_stale();
00083   mark_viz_stale();
00084 }
00085 
00086 ////////////////////////////////////////////////////////////////////
00087 //     Function: CollisionSphere::set_center
00088 //       Access: Published
00089 //  Description:
00090 ////////////////////////////////////////////////////////////////////
00091 INLINE void CollisionSphere::
00092 set_center(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z) {
00093   set_center(LPoint3(x, y, z));
00094 }
00095 
00096 ////////////////////////////////////////////////////////////////////
00097 //     Function: CollisionSphere::get_center
00098 //       Access: Published
00099 //  Description:
00100 ////////////////////////////////////////////////////////////////////
00101 INLINE const LPoint3 &CollisionSphere::
00102 get_center() const {
00103   return _center;
00104 }
00105 
00106 ////////////////////////////////////////////////////////////////////
00107 //     Function: CollisionSphere::set_radius
00108 //       Access: Published
00109 //  Description:
00110 ////////////////////////////////////////////////////////////////////
00111 INLINE void CollisionSphere::
00112 set_radius(PN_stdfloat radius) {
00113   nassertv(radius >= 0.0f);
00114   _radius = radius;
00115   mark_internal_bounds_stale();
00116   mark_viz_stale();
00117 }
00118 
00119 ////////////////////////////////////////////////////////////////////
00120 //     Function: CollisionSphere::get_radius
00121 //       Access: Published
00122 //  Description:
00123 ////////////////////////////////////////////////////////////////////
00124 INLINE PN_stdfloat CollisionSphere::
00125 get_radius() const {
00126   return _radius;
00127 }
00128 
 All Classes Functions Variables Enumerations