Skip to content
Snippets Groups Projects
Commit 4abfe211 authored by Éric Béchet's avatar Éric Béchet
Browse files

changed default constructor / Stensor3

parent f8ee7c1c
No related branches found
No related tags found
No related merge requests found
...@@ -191,7 +191,7 @@ class STensor3 { ...@@ -191,7 +191,7 @@ class STensor3 {
{ {
for (int i = 0; i < 3; i++){ for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++){ 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 { ...@@ -205,8 +205,8 @@ class STensor3 {
{ {
for (int i = 0; i < 9; i++) _val[i] = other._val[i]; for (int i = 0; i < 9; i++) _val[i] = other._val[i];
} }
// default constructor, identity // default constructor, null tensor
STensor3(const double v = 1.0) STensor3(const double v = 0.0)
{ {
_val[0] = _val[4] = _val[8] = v; _val[0] = _val[4] = _val[8] = v;
_val[1] = _val[2] = _val[3] = 0.0; _val[1] = _val[2] = _val[3] = 0.0;
...@@ -275,5 +275,15 @@ inline double dot(const STensor3 &a, const STensor3 &b) ...@@ -275,5 +275,15 @@ inline double dot(const STensor3 &a, const STensor3 &b)
return prod; 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 #endif
...@@ -15,7 +15,7 @@ class SVector3 { ...@@ -15,7 +15,7 @@ class SVector3 {
protected: protected:
SPoint3 P; SPoint3 P;
public: public:
SVector3() {} SVector3():P() {}
// Construct from 2 SPoints, vector from p1 to p2 // Construct from 2 SPoints, vector from p1 to p2
SVector3(const SPoint3 &p1, const SPoint3 &p2) : P(p2 - p1) {} SVector3(const SPoint3 &p1, const SPoint3 &p2) : P(p2 - p1) {}
// Construct from a single SPoint, vector from origin to p1 // Construct from a single SPoint, vector from origin to p1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment