diff options
author | Oz Linden <oz@lindenlab.com> | 2011-03-24 13:22:43 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2011-03-24 13:22:43 -0400 |
commit | fb1facf13a2f7413b42802bd7293d504eb4e4174 (patch) | |
tree | 9f0e5b980fa2d2e2d4bf97902610456fa279d6cd /indra/llmath | |
parent | a4f2c570dd42066f0e2738a0fd2de6c61c35b47b (diff) | |
parent | 1c375a8c880354432da2b218c321ed708497e161 (diff) |
syncing up to viewer-development
Diffstat (limited to 'indra/llmath')
-rw-r--r-- | indra/llmath/v3math.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/indra/llmath/v3math.h b/indra/llmath/v3math.h index d3fc6fcb2f..4b3efe7394 100644 --- a/indra/llmath/v3math.h +++ b/indra/llmath/v3math.h @@ -157,6 +157,8 @@ F32 dist_vec(const LLVector3 &a, const LLVector3 &b); // Returns distance betwe F32 dist_vec_squared(const LLVector3 &a, const LLVector3 &b);// Returns distance squared between a and b F32 dist_vec_squared2D(const LLVector3 &a, const LLVector3 &b);// Returns distance squared between a and b ignoring Z component LLVector3 projected_vec(const LLVector3 &a, const LLVector3 &b); // Returns vector a projected on vector b +LLVector3 parallel_component(const LLVector3 &a, const LLVector3 &b); // Returns vector a projected on vector b (same as projected_vec) +LLVector3 orthogonal_component(const LLVector3 &a, const LLVector3 &b); // Returns component of vector a not parallel to vector b (same as projected_vec) LLVector3 lerp(const LLVector3 &a, const LLVector3 &b, F32 u); // Returns a vector that is a linear interpolation between a and b inline LLVector3::LLVector3(void) @@ -491,6 +493,17 @@ inline LLVector3 projected_vec(const LLVector3 &a, const LLVector3 &b) return project_axis * (a * project_axis); } +inline LLVector3 parallel_component(const LLVector3 &a, const LLVector3 &b) +{ + return projected_vec(a, b); +} + +inline LLVector3 orthogonal_component(const LLVector3 &a, const LLVector3 &b) +{ + return a - projected_vec(a, b); +} + + inline LLVector3 lerp(const LLVector3 &a, const LLVector3 &b, F32 u) { return LLVector3( |