diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2025-04-17 23:57:00 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2025-04-17 23:57:00 +0300 |
commit | 082c9158b2ad961b747ca6a7bd55bc2a79f27b6a (patch) | |
tree | 39200c1ff454ae23c8fd5b76e4c891d26f92c32c /indra/llmath/v2math.cpp | |
parent | 06a76eda6af9fbe36e40a749c44e590ad6cfe363 (diff) | |
parent | c7ebde4ec9d3909c3c2f6503dc9096406297f26d (diff) |
Merge branch 'develop' into marchcat/05-develop
# Conflicts:
# indra/llmath/v2math.cpp
# indra/llmath/v2math.h
# indra/llmath/v3math.h
# indra/llmath/v4math.h
Diffstat (limited to 'indra/llmath/v2math.cpp')
-rw-r--r-- | indra/llmath/v2math.cpp | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/indra/llmath/v2math.cpp b/indra/llmath/v2math.cpp index 63745b881c..175f08df88 100644 --- a/indra/llmath/v2math.cpp +++ b/indra/llmath/v2math.cpp @@ -26,7 +26,6 @@ #include "linden_common.h" -//#include "vmath.h" #include "v2math.h" #include "v3math.h" #include "v4math.h" @@ -47,8 +46,8 @@ bool LLVector2::abs() { bool ret{ false }; - if (mV[0] < 0.f) { mV[0] = -mV[0]; ret = true; } - if (mV[1] < 0.f) { mV[1] = -mV[1]; ret = true; } + if (mV[VX] < 0.f) { mV[VX] = -mV[VX]; ret = true; } + if (mV[VY] < 0.f) { mV[VY] = -mV[VY]; ret = true; } return ret; } @@ -74,14 +73,14 @@ F32 signed_angle_between(const LLVector2& a, const LLVector2& b) return rhombus_square < 0 ? -angle : angle; } -bool are_parallel(const LLVector2 &a, const LLVector2 &b, F32 epsilon) +bool are_parallel(const LLVector2& a, const LLVector2& b, F32 epsilon) { LLVector2 an = a; LLVector2 bn = b; an.normVec(); bn.normVec(); F32 dot = an * bn; - if ( (1.0f - fabs(dot)) < epsilon) + if ((1.0f - fabs(dot)) < epsilon) { return true; } @@ -89,28 +88,28 @@ bool are_parallel(const LLVector2 &a, const LLVector2 &b, F32 epsilon) } -F32 dist_vec(const LLVector2 &a, const LLVector2 &b) +F32 dist_vec(const LLVector2& a, const LLVector2& b) { - F32 x = a.mV[0] - b.mV[0]; - F32 y = a.mV[1] - b.mV[1]; + F32 x = a.mV[VX] - b.mV[VX]; + F32 y = a.mV[VY] - b.mV[VY]; return (F32) sqrt( x*x + y*y ); } -F32 dist_vec_squared(const LLVector2 &a, const LLVector2 &b) +F32 dist_vec_squared(const LLVector2& a, const LLVector2& b) { - F32 x = a.mV[0] - b.mV[0]; - F32 y = a.mV[1] - b.mV[1]; + F32 x = a.mV[VX] - b.mV[VX]; + F32 y = a.mV[VY] - b.mV[VY]; return x*x + y*y; } -F32 dist_vec_squared2D(const LLVector2 &a, const LLVector2 &b) +F32 dist_vec_squared2D(const LLVector2& a, const LLVector2& b) { - F32 x = a.mV[0] - b.mV[0]; - F32 y = a.mV[1] - b.mV[1]; + F32 x = a.mV[VX] - b.mV[VX]; + F32 y = a.mV[VY] - b.mV[VY]; return x*x + y*y; } -LLVector2 lerp(const LLVector2 &a, const LLVector2 &b, F32 u) +LLVector2 lerp(const LLVector2& a, const LLVector2& b, F32 u) { return LLVector2( a.mV[VX] + (b.mV[VX] - a.mV[VX]) * u, @@ -120,14 +119,14 @@ LLVector2 lerp(const LLVector2 &a, const LLVector2 &b, F32 u) LLSD LLVector2::getValue() const { LLSD ret; - ret[0] = mV[0]; - ret[1] = mV[1]; + ret[VX] = mV[VX]; + ret[VY] = mV[VY]; return ret; } void LLVector2::setValue(const LLSD& sd) { - mV[0] = (F32) sd[0].asReal(); - mV[1] = (F32) sd[1].asReal(); + mV[VX] = (F32) sd[0].asReal(); + mV[VY] = (F32) sd[1].asReal(); } |