From be1f78a1fb355bfd0c50747623900254c345ffdf Mon Sep 17 00:00:00 2001
From: Marco Biasini <marco.biasini@unibas.ch>
Date: Sat, 30 Oct 2010 12:35:38 +0200
Subject: [PATCH] added constructor to initialize Mat3 with diagonal elements

---
 modules/geom/pymod/export_mat3.cc | 1 +
 modules/geom/src/mat3.hh          | 8 +++++---
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/geom/pymod/export_mat3.cc b/modules/geom/pymod/export_mat3.cc
index ee66e38d6..9f9e24532 100644
--- a/modules/geom/pymod/export_mat3.cc
+++ b/modules/geom/pymod/export_mat3.cc
@@ -58,6 +58,7 @@ void export_Mat3()
   class_<Mat3>("Mat3",init<>())
     .def(init<Real,Real,Real,Real,Real,Real,Real,Real,Real>())
     .def(init<const Mat2&>())
+    .def(init<Real,Real,Real>())
     .def(self += self)
     .def(self -= self)
     .def(self + self)
diff --git a/modules/geom/src/mat3.hh b/modules/geom/src/mat3.hh
index 158158633..d16a14f55 100644
--- a/modules/geom/src/mat3.hh
+++ b/modules/geom/src/mat3.hh
@@ -27,10 +27,8 @@
 
 #include <ost/geom/module_config.hh>
 #include <ost/geom/mat2.hh>
-
 namespace geom {
 
-class Mat2;
 class Vec3;
 
 class DLLEXPORT_OST_GEOM Mat3:
@@ -76,8 +74,12 @@ public:
   explicit Mat3(const Real arr[9])
   {
     this->set(arr[0],arr[1],arr[2],arr[3],arr[4],arr[5],arr[6],arr[7],arr[8]);
-  }  
+  }
 
+  explicit Mat3(Real x, Real y, Real z)
+  {
+    this->set(x, 0.0, 0.0, 0.0, y, 0.0, 0.0, 0.0, z);
+  }
   //! element access
   Real& operator()(std::size_t r, std::size_t c)
   {
-- 
GitLab