Fix code quality issues detected by PVS-Studio
This commit is contained in:
@@ -123,7 +123,7 @@ public:
|
||||
/// Sets the size of the box.
|
||||
/// </summary>
|
||||
/// <param name="value">The box size to set.</param>
|
||||
void SetSize(const Vector3 value)
|
||||
void SetSize(const Vector3& value)
|
||||
{
|
||||
Vector3 center;
|
||||
GetCenter(center);
|
||||
|
||||
@@ -1221,61 +1221,54 @@ ContainmentType CollisionsHelper::SphereContainsBox(const BoundingSphere& sphere
|
||||
if (!BoxIntersectsSphere(box, sphere))
|
||||
return ContainmentType::Disjoint;
|
||||
|
||||
const float radiussquared = sphere.Radius * sphere.Radius;
|
||||
const float radiusSquared = sphere.Radius * sphere.Radius;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared() > radiussquared)
|
||||
if (vector.LengthSquared() > radiusSquared)
|
||||
return ContainmentType::Intersects;
|
||||
|
||||
return ContainmentType::Contains;
|
||||
|
||||
@@ -1425,61 +1425,54 @@ namespace FlaxEngine
|
||||
if (!BoxIntersectsSphere(ref box, ref sphere))
|
||||
return ContainmentType.Disjoint;
|
||||
|
||||
float radiussquared = sphere.Radius * sphere.Radius;
|
||||
float radiusSquared = sphere.Radius * sphere.Radius;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Maximum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Maximum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Maximum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
vector.X = sphere.Center.X - box.Minimum.X;
|
||||
vector.Y = sphere.Center.Y - box.Minimum.Y;
|
||||
vector.Z = sphere.Center.Z - box.Minimum.Z;
|
||||
|
||||
if (vector.LengthSquared > radiussquared)
|
||||
if (vector.LengthSquared > radiusSquared)
|
||||
return ContainmentType.Intersects;
|
||||
|
||||
return ContainmentType.Contains;
|
||||
|
||||
Reference in New Issue
Block a user