summaryrefslogtreecommitdiff
path: root/themes/mathlib.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'themes/mathlib.cpp')
-rw-r--r--themes/mathlib.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/themes/mathlib.cpp b/themes/mathlib.cpp
index fb09cd9..6fa4266 100644
--- a/themes/mathlib.cpp
+++ b/themes/mathlib.cpp
@@ -73,6 +73,12 @@ Vector2 Vector2::rotate(float angle) {
};
}
+Vector2 Vector2::rotateAbout(float angle, Vector2 p) {
+ Vector2 prev = { x - p.x, y - p.y }; // Translate the point back to the origin
+ Vector2 rot = prev.rotate(angle); // Do the rotation
+ return { rot.x + p.x, rot.y + p.y }; // Translate back to original position
+}
+
void Vector2::printDebug(const char* name) {
printf("%s=Vector2(%f, %f)\n", name, x, y);
}