diff options
| author | Leyla Farazha <leyla@lindenlab.com> | 2011-03-23 11:36:00 -0700 |
|---|---|---|
| committer | Leyla Farazha <leyla@lindenlab.com> | 2011-03-23 11:36:00 -0700 |
| commit | 3ad81bb4a642d25018b773d2ef005380664d8170 (patch) | |
| tree | b1bbf66c0babf6c541858b34d4a7f66ad19308b0 /indra/llmath/v3math.h | |
| parent | a2c659378b8b7c8a4128c61b5cde91eccc9db4e6 (diff) | |
| parent | 62a958d341532287519a23a362ff7aebd501e1c9 (diff) | |
Merge
Diffstat (limited to 'indra/llmath/v3math.h')
| -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 b6425087b3..acb2240075 100644 --- a/indra/llmath/v3math.h +++ b/indra/llmath/v3math.h @@ -158,6 +158,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) @@ -492,6 +494,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( |
