Added ToFactor function
This commit is contained in:
parent
c2b5791f53
commit
307a94c567
@ -217,6 +217,7 @@ public:
|
|||||||
/// Value -1 is *from* vector minus the difference between *from* and *to* etc.
|
/// Value -1 is *from* vector minus the difference between *from* and *to* etc.
|
||||||
static Vector2 Lerp(Vector2 from, Vector2 to, float f);
|
static Vector2 Lerp(Vector2 from, Vector2 to, float f);
|
||||||
|
|
||||||
|
static float ToFactor(Vector2 a, Vector2 b);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -120,7 +120,11 @@ float Vector2::SignedAngle(Vector2 from, Vector2 to) {
|
|||||||
return (angleTo - angleFrom) * Rad2Deg;
|
return (angleTo - angleFrom) * Rad2Deg;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Vector2 Lerp(Vector2 from, Vector2 to, float f) {
|
Vector2 Vector2::Lerp(Vector2 from, Vector2 to, float f) {
|
||||||
Vector2 v = from + (to - from) * f;
|
Vector2 v = from + (to - from) * f;
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Vector2::ToFactor(Vector2 a, Vector2 b) {
|
||||||
|
return (1 - Vector2::Dot(a, b)) / 2;
|
||||||
|
}
|
||||||
|
@ -417,8 +417,10 @@ TEST(Vector2, SignedAngle) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TEST(Vector2, DISABLED_Lerp) {
|
TEST(Vector2, DISABLED_Lerp) {
|
||||||
//
|
}
|
||||||
//}
|
|
||||||
|
TEST(Vector2, DIABLED_ToFactor) {
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
x
Reference in New Issue
Block a user