summaryrefslogtreecommitdiff
path: root/indra/llmath/v3math.cpp
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2011-04-01 12:12:22 -0400
committerOz Linden <oz@lindenlab.com>2011-04-01 12:12:22 -0400
commit9f4edab4dd93753d2f51e9776d758d5918992c08 (patch)
tree511a6b331e71876372a38a30b7a52d755cb04379 /indra/llmath/v3math.cpp
parenta03f6997d8c3519e2c89930a1ed03a787af6f7ae (diff)
parentc5ae838ce3cd8521b7b4817f153560e03a8dcc32 (diff)
pull latest changes from viewer-autobuild2010
Diffstat (limited to 'indra/llmath/v3math.cpp')
-rw-r--r--indra/llmath/v3math.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/indra/llmath/v3math.cpp b/indra/llmath/v3math.cpp
index fd08df02d8..18b15e08c4 100644
--- a/indra/llmath/v3math.cpp
+++ b/indra/llmath/v3math.cpp
@@ -134,6 +134,21 @@ BOOL LLVector3::clampLength( F32 length_limit )
return changed;
}
+BOOL LLVector3::clamp(const LLVector3 &min_vec, const LLVector3 &max_vec)
+{
+ BOOL ret = FALSE;
+
+ if (mV[0] < min_vec[0]) { mV[0] = min_vec[0]; ret = TRUE; }
+ if (mV[1] < min_vec[1]) { mV[1] = min_vec[1]; ret = TRUE; }
+ if (mV[2] < min_vec[2]) { mV[2] = min_vec[2]; ret = TRUE; }
+
+ if (mV[0] > max_vec[0]) { mV[0] = max_vec[0]; ret = TRUE; }
+ if (mV[1] > max_vec[1]) { mV[1] = max_vec[1]; ret = TRUE; }
+ if (mV[2] > max_vec[2]) { mV[2] = max_vec[2]; ret = TRUE; }
+
+ return ret;
+}
+
// Sets all values to absolute value of their original values
// Returns TRUE if data changed