"...ssh:/git@developer.sourcefind.cn:2222/tsoc/openmm.git" did not exist on "fe129ae2e7e434ba761984676ddb2a77558b06f5"
Commit 15a2db5e authored by Christopher Bruns's avatar Christopher Bruns
Browse files

Actually return values from Vec3::operator+=, -=, and *=, like they claim to.

parent 802be281
...@@ -80,10 +80,11 @@ public: ...@@ -80,10 +80,11 @@ public:
return Vec3(lhs[0] + rhs[0], lhs[1] + rhs[1], lhs[2] + rhs[2]); return Vec3(lhs[0] + rhs[0], lhs[1] + rhs[1], lhs[2] + rhs[2]);
} }
Vec3 operator+=(const Vec3& rhs) { Vec3& operator+=(const Vec3& rhs) {
data[0] += rhs[0]; data[0] += rhs[0];
data[1] += rhs[1]; data[1] += rhs[1];
data[2] += rhs[2]; data[2] += rhs[2];
return *this;
} }
// unary minus // unary minus
...@@ -98,10 +99,11 @@ public: ...@@ -98,10 +99,11 @@ public:
return Vec3(lhs[0] - rhs[0], lhs[1] - rhs[1], lhs[2] - rhs[2]); return Vec3(lhs[0] - rhs[0], lhs[1] - rhs[1], lhs[2] - rhs[2]);
} }
Vec3 operator-=(const Vec3& rhs) { Vec3& operator-=(const Vec3& rhs) {
data[0] -= rhs[0]; data[0] -= rhs[0];
data[1] -= rhs[1]; data[1] -= rhs[1];
data[2] -= rhs[2]; data[2] -= rhs[2];
return *this;
} }
// scalar product // scalar product
...@@ -110,10 +112,11 @@ public: ...@@ -110,10 +112,11 @@ public:
return Vec3(lhs[0]*rhs, lhs[1]*rhs, lhs[2]*rhs); return Vec3(lhs[0]*rhs, lhs[1]*rhs, lhs[2]*rhs);
} }
Vec3 operator*=(double rhs) { Vec3& operator*=(double rhs) {
data[0] *= rhs; data[0] *= rhs;
data[1] *= rhs; data[1] *= rhs;
data[2] *= rhs; data[2] *= rhs;
return *this;
} }
// dot product // dot product
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment