From b0c7d38804c2cc84e507a47e47fa14e20b3a3990 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=91=D1=80=D0=B0=D0=BD=D0=B8=D0=BC=D0=B8=D1=80=20=D0=9A?= =?UTF-8?q?=D0=B0=D1=80=D0=B0=D1=9F=D0=B8=D1=9B?= Date: Sat, 9 Feb 2019 21:22:00 -0800 Subject: [PATCH] Cleanup. --- include/bx/inline/math.inl | 11 +++++++++++ include/bx/math.h | 6 ++++++ 2 files changed, 17 insertions(+) diff --git a/include/bx/inline/math.inl b/include/bx/inline/math.inl index 3d83668..f9cf158 100644 --- a/include/bx/inline/math.inl +++ b/include/bx/inline/math.inl @@ -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 diff --git a/include/bx/math.h b/include/bx/math.h index 78b0360..f606392 100644 --- a/include/bx/math.h +++ b/include/bx/math.h @@ -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);