diff options
author | Richard Linden <none@none> | 2011-04-06 15:15:33 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2011-04-06 15:15:33 -0700 |
commit | 75ddf612ad29240d6d34b5044ae09e4295217766 (patch) | |
tree | 70eeb78247ef3ae779809485afaaf592aa495b34 /indra/llmath/v3math.cpp | |
parent | 4dd471d055bea672f5eb21cfcc4d07e6b3ba3f9b (diff) | |
parent | 80efbeead1d59b64b615f8a33cb0966cf7fef9f1 (diff) |
Automated merge with ssh://hg.lindenlab.com/richard/viewer-social-2
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 |