From 31e566475b3940f120b383d33b5b274077574df3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 19 Mar 2012 17:21:08 +1100 Subject: [PATCH] Math: added zero() and identity() methods to Matrix3f --- libraries/AP_Math/matrix3.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/libraries/AP_Math/matrix3.h b/libraries/AP_Math/matrix3.h index 85861d6783..1f16d23717 100644 --- a/libraries/AP_Math/matrix3.h +++ b/libraries/AP_Math/matrix3.h @@ -124,6 +124,21 @@ public: Matrix3 transpose(void) { return *this = transposed(); } + // zero the matrix + void zero(void) { + a.x = a.y = a.z = 0; + b.x = b.y = b.z = 0; + c.x = c.y = c.z = 0; + } + + // setup the identity matrix + void identity(void) { + a.x = b.y = c.z = 1; + a.y = a.z = 0; + b.x = b.z = 0; + c.x = c.y = 0; + } + // check if any elements are NAN bool is_nan(void) { return a.is_nan() || b.is_nan() || c.is_nan(); }