assert against negative radius

This commit is contained in:
David Rose 2006-02-23 03:51:48 +00:00
parent 11a5ffd557
commit 95826297fb
2 changed files with 6 additions and 0 deletions

View File

@ -26,6 +26,7 @@ INLINE CollisionSphere::
CollisionSphere(const LPoint3f &center, 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();

View File

@ -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