From fcf91ae1a1adf64bc953c83c84d436faaf6ce976 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, 3 Jan 2019 22:03:15 -0800 Subject: [PATCH] Cleanup. --- include/bx/inline/math.inl | 12 +++++------- include/bx/math.h | 10 ++++++++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/include/bx/inline/math.inl b/include/bx/inline/math.inl index 4be1e21..0a931d8 100644 --- a/include/bx/inline/math.inl +++ b/include/bx/inline/math.inl @@ -1035,18 +1035,16 @@ namespace bx return bx::normalize(baxca); } - inline void calcPlane(float _result[4], const bx::Vec3& _va, const bx::Vec3& _vb, const bx::Vec3& _vc) + inline void calcPlane(Plane& _outPlane, const bx::Vec3& _va, const bx::Vec3& _vb, const bx::Vec3& _vc) { bx::Vec3 normal = calcNormal(_va, _vb, _vc); - calcPlane(_result, normal, _va); + calcPlane(_outPlane, normal, _va); } - inline void calcPlane(float _result[4], const bx::Vec3& _normal, const bx::Vec3& _pos) + inline void calcPlane(Plane& _outPlane, const bx::Vec3& _normal, const bx::Vec3& _pos) { - _result[0] = _normal.x; - _result[1] = _normal.y; - _result[2] = _normal.z; - _result[3] = -dot(_normal, _pos); + _outPlane.normal = _normal; + _outPlane.dist = -dot(_normal, _pos); } inline BX_CONST_FUNC float toLinear(float _a) diff --git a/include/bx/math.h b/include/bx/math.h index 29d2aed..95fd1b3 100644 --- a/include/bx/math.h +++ b/include/bx/math.h @@ -56,6 +56,12 @@ namespace bx float x, y, z; }; + struct Plane + { + bx::Vec3 normal; + float dist; + }; + /// struct Quaternion { @@ -557,10 +563,10 @@ namespace bx bx::Vec3 calcNormal(const bx::Vec3& _va, const bx::Vec3& _vb, const bx::Vec3& _vc); /// - void calcPlane(float _result[4], const bx::Vec3& _va, const bx::Vec3& _vb, const bx::Vec3& _vc); + void calcPlane(Plane& _outPlane, const bx::Vec3& _va, const bx::Vec3& _vb, const bx::Vec3& _vc); /// - void calcPlane(float _result[4], const bx::Vec3& _normal, const bx::Vec3& _pos); + void calcPlane(Plane& _outPlane, const bx::Vec3& _normal, const bx::Vec3& _pos); /// void calcLinearFit2D(float _result[2], const void* _points, uint32_t _stride, uint32_t _numPoints);