diff options
Diffstat (limited to 'frontend/shared_cpp/mathlib.h')
-rw-r--r-- | frontend/shared_cpp/mathlib.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/frontend/shared_cpp/mathlib.h b/frontend/shared_cpp/mathlib.h index 383c880..b9f3fee 100644 --- a/frontend/shared_cpp/mathlib.h +++ b/frontend/shared_cpp/mathlib.h @@ -57,6 +57,13 @@ struct Vector2 { return { -y, x }; } + Vector2 rotate(float angle) { + return { + x * cosf(angle) - y * sinf(angle), + x * sinf(angle) + y * cosf(angle) + }; + } + void printDebug(const char* name) { printf("%s=Vector2(%f, %f)\n", name, x, y); } |