diff options
author | Don Kjer <don@lindenlab.com> | 2011-04-01 23:37:30 +0000 |
---|---|---|
committer | Don Kjer <don@lindenlab.com> | 2011-04-01 23:37:30 +0000 |
commit | d292053c04e6adfd48be0484dd5a8a07b48e0541 (patch) | |
tree | bb8814069df178e2bcae041f2c3e9b11338492db /indra/llmath/v3math.cpp | |
parent | f2bb81d17660054697ed984afc0e3f8d90f77eda (diff) | |
parent | 1664c9dc678f7aca9c2bbf38d28e00550e03c4dd (diff) |
Merge with viewer-development
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 |