From 4abfe211c28a06fda665e128d24b017f4f6ba45a Mon Sep 17 00:00:00 2001 From: Eric Bechet <eric.bechet@ulg.ac.be> Date: Sun, 20 Dec 2009 19:28:12 +0000 Subject: [PATCH] changed default constructor / Stensor3 --- Geo/STensor3.h | 16 +++++++++++++--- Geo/SVector3.h | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Geo/STensor3.h b/Geo/STensor3.h index 63413901ce..26ed1893dc 100644 --- a/Geo/STensor3.h +++ b/Geo/STensor3.h @@ -191,7 +191,7 @@ class STensor3 { { for (int i = 0; i < 3; i++){ for (int j = 0; j < 3; j++){ - mat(i,j) = _val[getIndex(i, j)]; + mat(i,j) = _val[getIndex(i, j)]; } } } @@ -205,8 +205,8 @@ class STensor3 { { for (int i = 0; i < 9; i++) _val[i] = other._val[i]; } - // default constructor, identity - STensor3(const double v = 1.0) + // default constructor, null tensor + STensor3(const double v = 0.0) { _val[0] = _val[4] = _val[8] = v; _val[1] = _val[2] = _val[3] = 0.0; @@ -275,5 +275,15 @@ inline double dot(const STensor3 &a, const STensor3 &b) return prod; } +inline STensor3 operator*(const STensor3 &t, double m) +{ STensor3 val(t); + val*=m; + return val; } + +inline STensor3 operator*(double m,const STensor3 &t) +{ STensor3 val(t); + val*=m; + return val; } + #endif diff --git a/Geo/SVector3.h b/Geo/SVector3.h index da0c486a1b..31e4aa7d6b 100644 --- a/Geo/SVector3.h +++ b/Geo/SVector3.h @@ -15,7 +15,7 @@ class SVector3 { protected: SPoint3 P; public: - SVector3() {} + SVector3():P() {} // Construct from 2 SPoints, vector from p1 to p2 SVector3(const SPoint3 &p1, const SPoint3 &p2) : P(p2 - p1) {} // Construct from a single SPoint, vector from origin to p1 -- GitLab