From db25e21fde7f82bd5b389d3ee045093488b82a28 Mon Sep 17 00:00:00 2001 From: "erwin.coumans" Date: Mon, 21 Dec 2009 23:13:11 +0000 Subject: [PATCH] added isZero and fuzzyZero to btVector3 Thanks jazztickets for the report, see Issue 145 --- src/LinearMath/btVector3.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/LinearMath/btVector3.h b/src/LinearMath/btVector3.h index f053a87d0..7689f1de5 100644 --- a/src/LinearMath/btVector3.h +++ b/src/LinearMath/btVector3.h @@ -320,6 +320,17 @@ public: setValue(btScalar(0.),btScalar(0.),btScalar(0.)); } + SIMD_FORCE_INLINE bool isZero() const + { + return m_floats[0] == btScalar(0) && m_floats[1] == btScalar(0) && m_floats[2] == btScalar(0); + } + + SIMD_FORCE_INLINE bool fuzzyZero() const + { + return length2() < SIMD_EPSILON; + } + + SIMD_FORCE_INLINE void serialize(struct btVector3Data& dataOut) const; SIMD_FORCE_INLINE void deSerialize(const struct btVector3Data& dataIn);