summaryrefslogtreecommitdiffstats
path: root/Vertex.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Vertex.cpp')
-rw-r--r--Vertex.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/Vertex.cpp b/Vertex.cpp
index 7e2528f..6e1f26b 100644
--- a/Vertex.cpp
+++ b/Vertex.cpp
@@ -18,6 +18,14 @@ Vertex Vertex::operator-(const Vertex &v) const {
return Vertex(x - v.x, y - v.y);
}
+Vertex Vertex::operator*(float f) const {
+ return Vertex(x*f, y*f);
+}
+
+Vertex Vertex::operator/(float f) const {
+ return Vertex(x/f, y/f);
+}
+
Vertex& Vertex::operator+=(const Vertex &v) {
x += v.x;
y += v.y;
@@ -31,3 +39,17 @@ Vertex& Vertex::operator-=(const Vertex &v) {
return *this;
}
+
+Vertex& Vertex::operator*=(float f) {
+ x *= f;
+ y *= f;
+
+ return *this;
+}
+
+Vertex& Vertex::operator/=(float f) {
+ x /= f;
+ y /= f;
+
+ return *this;
+}