diff options
| author | Oz Linden <oz@lindenlab.com> | 2011-04-06 07:32:56 -0400 |
|---|---|---|
| committer | Oz Linden <oz@lindenlab.com> | 2011-04-06 07:32:56 -0400 |
| commit | f41cbc0ac85ae328f2701aab23e94c0ef7ab5758 (patch) | |
| tree | c0593e4d79918dc10173de5d3dfbb34e8c2ed40e /indra/llmath/v3math.cpp | |
| parent | 85c97c19347c1409f8f7231940b0b8f3a57fc0a5 (diff) | |
| parent | b5c834c6fdcee7d7238bebfc561ecee3ecca3589 (diff) | |
merge changes for storm-1094
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 |
