summaryrefslogtreecommitdiff
path: root/themes/mathlib.cpp
diff options
context:
space:
mode:
authorMatthew Kosarek <mattkae@protonmail.com>2021-09-19 19:53:42 -0400
committerMatthew Kosarek <mattkae@protonmail.com>2021-09-19 19:53:42 -0400
commit9d33d175b5cd564e77bda07fcbce252477f7c40f (patch)
tree21eedba8ca61e6f4e6c5fc20bdfd0488b4c166c3 /themes/mathlib.cpp
parentde850676e79da39aec6f1ce0400cfa94cecbd744 (diff)
Decently working autumn theme
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);
}