From 72de73f025aab0b7c15afdf0df1994d4947d4db5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Tue, 6 Nov 2018 20:06:12 -0800 Subject: [PATCH] Added calcPlane from normal and position.: --- include/bx/inline/math.inl | 12 ++++++++---- include/bx/math.h | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/include/bx/inline/math.inl b/include/bx/inline/math.inl index 3b39d79..1016c83 100644 --- a/include/bx/inline/math.inl +++ b/include/bx/inline/math.inl @@ -936,11 +936,15 @@ namespace bx { float normal[3]; calcNormal(normal, _va, _vb, _vc); + calcPlane(_result, normal, _va); + } - _result[0] = normal[0]; - _result[1] = normal[1]; - _result[2] = normal[2]; - _result[3] = -vec3Dot(normal, _va); + inline void calcPlane(float _result[4], const float _normal[3], const float _pos[3]) + { + _result[0] = _normal[0]; + _result[1] = _normal[1]; + _result[2] = _normal[2]; + _result[3] = -vec3Dot(_normal, _pos); } inline BX_CONST_FUNC float toLinear(float _a) diff --git a/include/bx/math.h b/include/bx/math.h index 17d68c0..4d9fce3 100644 --- a/include/bx/math.h +++ b/include/bx/math.h @@ -555,6 +555,9 @@ namespace bx /// void calcPlane(float _result[4], const float _va[3], const float _vb[3], const float _vc[3]); + /// + void calcPlane(float _result[4], const float _normal[3], const float _pos[3]); + /// void calcLinearFit2D(float _result[2], const void* _points, uint32_t _stride, uint32_t _numPoints);