This commit is contained in:
Бранимир Караџић
2019-02-09 21:22:00 -08:00
parent 9c28abafad
commit b0c7d38804
2 changed files with 17 additions and 0 deletions

View File

@@ -499,6 +499,17 @@ namespace bx
return sqrt(dot(_a, _a) );
}
inline BX_CONST_FUNC float distanceSq(const Vec3 _a, const Vec3 _b)
{
const Vec3 ba = sub(_b, _a);
return dot(ba, ba);
}
inline BX_CONST_FUNC float distance(const Vec3 _a, const Vec3 _b)
{
return length(sub(_b, _a) );
}
inline BX_CONSTEXPR_FUNC Vec3 lerp(const Vec3 _a, const Vec3 _b, float _t)
{
return

View File

@@ -333,6 +333,12 @@ namespace bx
///
BX_CONST_FUNC float length(const Vec3 _a);
///
BX_CONST_FUNC float distanceSq(const Vec3 _a, const Vec3 _b);
///
BX_CONST_FUNC float distance(const Vec3 _a, const Vec3 _b);
///
BX_CONSTEXPR_FUNC Vec3 lerp(const Vec3 _a, const Vec3 _b, float _t);