summaryrefslogtreecommitdiff
path: root/indra/llmath/llsphere.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2024-05-07 09:47:37 -0500
committerGitHub <noreply@github.com>2024-05-07 09:47:37 -0500
commit155ddf23363f1d5c534c69f50505faf67e51948f (patch)
tree976912ed4fa3bc2af7b0b68201460f08614748b5 /indra/llmath/llsphere.cpp
parentf79548ec68ebcef8f8f83705b65fd59da43c3e26 (diff)
parentf9473e8afcb624cc1b101195bf15943ec372b56f (diff)
Merge pull request #1421 from secondlife/DRTVWR-600-maint-A
Drtvwr 600 maint a
Diffstat (limited to 'indra/llmath/llsphere.cpp')
-rw-r--r--indra/llmath/llsphere.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/indra/llmath/llsphere.cpp b/indra/llmath/llsphere.cpp
index 7292e3c0de..3f04ca704c 100644
--- a/indra/llmath/llsphere.cpp
+++ b/indra/llmath/llsphere.cpp
@@ -73,14 +73,14 @@ F32 LLSphere::getRadius() const
bool LLSphere::contains(const LLSphere& other_sphere) const
{
F32 separation = (mCenter - other_sphere.mCenter).length();
- return (mRadius >= separation + other_sphere.mRadius) ? true : false;
+ return mRadius >= separation + other_sphere.mRadius;
}
// returns 'true' if this sphere completely contains other_sphere
bool LLSphere::overlaps(const LLSphere& other_sphere) const
{
F32 separation = (mCenter - other_sphere.mCenter).length();
- return (separation <= mRadius + other_sphere.mRadius) ? true : false;
+ return mRadius >= separation - other_sphere.mRadius;
}
// returns overlap
@@ -93,9 +93,8 @@ F32 LLSphere::getOverlap(const LLSphere& other_sphere) const
bool LLSphere::operator==(const LLSphere& rhs) const
{
- // TODO? -- use approximate equality for centers?
- return (mRadius == rhs.mRadius
- && mCenter == rhs.mCenter);
+ return fabs(mRadius - rhs.mRadius) <= FLT_EPSILON &&
+ (mCenter - rhs.mCenter).length() <= FLT_EPSILON;
}
std::ostream& operator<<( std::ostream& output_stream, const LLSphere& sphere)