From 9d33d175b5cd564e77bda07fcbce252477f7c40f Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Sun, 19 Sep 2021 19:53:42 -0400 Subject: Decently working autumn theme --- themes/mathlib.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'themes/mathlib.cpp') 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); } -- cgit v1.2.1