assert against negative radius
This commit is contained in:
parent
11a5ffd557
commit
95826297fb
|
|
@ -26,6 +26,7 @@ INLINE CollisionSphere::
|
|||
CollisionSphere(const LPoint3f ¢er, float radius) :
|
||||
_center(center), _radius(radius)
|
||||
{
|
||||
nassertv(_radius >= 0.0f);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -37,6 +38,7 @@ INLINE CollisionSphere::
|
|||
CollisionSphere(float cx, float cy, float cz, float radius) :
|
||||
_center(cx, cy, cz), _radius(radius)
|
||||
{
|
||||
nassertv(_radius >= 0.0f);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -101,6 +103,7 @@ get_center() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void CollisionSphere::
|
||||
set_radius(float radius) {
|
||||
nassertv(radius >= 0.0f);
|
||||
_radius = radius;
|
||||
mark_internal_bounds_stale();
|
||||
mark_viz_stale();
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ CollisionTube(const LPoint3f &a, const LPoint3f &b, float radius) :
|
|||
_a(a), _b(b), _radius(radius)
|
||||
{
|
||||
recalc_internals();
|
||||
nassertv(_radius >= 0.0f);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -41,6 +42,7 @@ CollisionTube(float ax, float ay, float az,
|
|||
_a(ax, ay, az), _b(bx, by, bz), _radius(radius)
|
||||
{
|
||||
recalc_internals();
|
||||
nassertv(_radius >= 0.0f);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -137,6 +139,7 @@ get_point_b() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void CollisionTube::
|
||||
set_radius(float radius) {
|
||||
nassertv(radius >= 0.0f);
|
||||
_radius = radius;
|
||||
|
||||
// We don't need to call recalc_internals(), since the radius
|
||||
|
|
|
|||
Loading…
Reference in New Issue