From ce8f0ec49b3da82075cdb4d955acf03e1ad35af6 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: Thu, 14 Oct 2021 21:03:47 -0700 Subject: [PATCH] Cleanup. --- include/bx/inline/math.inl | 9 ++++++++- include/bx/math.h | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/bx/inline/math.inl b/include/bx/inline/math.inl index 36ed277..6e7fec0 100644 --- a/include/bx/inline/math.inl +++ b/include/bx/inline/math.inl @@ -1272,11 +1272,18 @@ namespace bx _outPlane.dist = -dot(_normal, _pos); } - inline float distance(const Plane& _plane, const Vec3& _pos) + inline BX_CONSTEXPR_FUNC float distance(const Plane& _plane, const Vec3& _pos) { return dot(_plane.normal, _pos) + _plane.dist; } + inline BX_CONSTEXPR_FUNC bool isEqual(const Plane& _a, const Plane& _b, float _epsilon) + { + return isEqual(_a.normal, _b.normal, _epsilon) + && isEqual(_a.dist, _b.dist, _epsilon) + ; + } + inline BX_CONST_FUNC float toLinear(float _a) { const float lo = _a / 12.92f; diff --git a/include/bx/math.h b/include/bx/math.h index 0843cdb..22b2609 100644 --- a/include/bx/math.h +++ b/include/bx/math.h @@ -723,7 +723,10 @@ namespace bx void calcPlane(Plane& _outPlane, const Vec3& _normal, const Vec3& _pos); /// - float distance(const Plane& _plane, const Vec3& _pos); + BX_CONSTEXPR_FUNC float distance(const Plane& _plane, const Vec3& _pos); + + /// + BX_CONSTEXPR_FUNC bool isEqual(const Plane& _a, const Plane& _b, float _epsilon); /// void calcLinearFit2D(float _result[2], const void* _points, uint32_t _stride, uint32_t _numPoints);