"libraries/sfmt/vscode:/vscode.git/clone" did not exist on "813275a0827fad4b75de484aa908f18dd3e94dfd"
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:
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[1] += rhs[1];
data[2] += rhs[2];
return *this;
}
// unary minus
......@@ -98,10 +99,11 @@ public:
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[1] -= rhs[1];
data[2] -= rhs[2];
return *this;
}
// scalar product
......@@ -110,10 +112,11 @@ public:
return Vec3(lhs[0]*rhs, lhs[1]*rhs, lhs[2]*rhs);
}
Vec3 operator*=(double rhs) {
Vec3& operator*=(double rhs) {
data[0] *= rhs;
data[1] *= rhs;
data[2] *= rhs;
return *this;
}
// 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