summaryrefslogtreecommitdiffstats
path: root/src/Data/Vector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Data/Vector.cpp')
-rw-r--r--src/Data/Vector.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/Data/Vector.cpp b/src/Data/Vector.cpp
index ad17447..8677fd1 100644
--- a/src/Data/Vector.cpp
+++ b/src/Data/Vector.cpp
@@ -39,6 +39,10 @@ Vector Vector::operator-(const Vector &v) const {
return Vector(x - v.x, y - v.y, z - v.z);
}
+float Vector::operator*(const Vector &v) const {
+ return (x*v.x + y*v.y + z*v.z);
+}
+
Vector Vector::operator*(float f) const {
return Vector(x*f, y*f, z*f);
}
@@ -47,6 +51,10 @@ Vector Vector::operator/(float f) const {
return Vector(x/f, y/f, z/f);
}
+Vector Vector::operator%(const Vector &v) const {
+ return Vector(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x);
+}
+
Vector& Vector::operator+=(const Vector &v) {
x += v.x;
y += v.y;
@@ -79,5 +87,10 @@ Vector& Vector::operator/=(float f) {
return *this;
}
+Vector& Vector::operator%=(const Vector &v) {
+ *this = *this % v;
+ return *this;
+}
+
}
}