diff options
author | Oz Linden <oz@lindenlab.com> | 2011-03-31 16:47:35 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2011-03-31 16:47:35 -0400 |
commit | 4047349ade461fa6bac43da2a14c6e7689918aa1 (patch) | |
tree | c1414bf26449ede2ff338b8ab286c19b754697fe /indra/llmath/v3math.cpp | |
parent | 4aad5ee313f580e08f9689b7ff4c4c088c20f831 (diff) | |
parent | 67316ada5a51e1dc1e4d40a805312dddaa653ae2 (diff) |
merge out latest viewer-autobuild2010 changes
Diffstat (limited to 'indra/llmath/v3math.cpp')
-rw-r--r-- | indra/llmath/v3math.cpp | 15 |
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 |